Skip to content

Annytab Dox Drive Log v1

This is a documentation of Annytab Dox Drive Log v1, our own royalty-free standard that represents a driving log that can be used to register private driving and business driving. It is possible to calculate the distance traveled and the traveled time from each row in the drive log.

This standard is based on JSON, a compact and text-based format that is used to exchange data. It’s easy to serialize objects to JSON and it’s easy to deserialize JSON to objects. This standard is available in a NuGet package: a-dox-standards (NuGet Gallery).

AnnytabDoxDriveLog [Model]

Property
Type
Description
personnel_id
string
The employment number of the person that the drive log refers to.
name
string
The name of the person that the drive log refers to.
cost_center
string
A code for the division, department or activity to which the person belongs. Used to allocate the expenses to the unit that should bear the expense.
registration_number
string
Registreringsnumret för den bil som används vid körning.
unit_code
string
A unit code for the specified quantity. May for example be miles or kilometers.
start_date
string
Date and time of the drive log start date. Must be entered as yyyy-MM-ddThh:mm:ss (2017-09-31T08:00:54).
end_date
string
Date and time of the drive log end date. Must be entered as yyyy-MM-ddThh:mm:ss (2017-09-31T08:00:54).
opening_odometer
decimal
Measurement at the start date, shall be equal to the measurement at the end of the previous drive log. Should be entered in the specified unit code.
log_rows
IList<DriveLogRow>
A list of drive log rows, see description of DriveLogRow below.
ending_odometer
decimal
Measurement at the end date. Should be entered in the specified unit code.

DriveLogRow [Model]

Property
Type
Description
start_odometer
decimal
The measurement at the start of the trip. Entered in the specified unit code.
start_time
string
Date and time when the trip begins. Must be entered as yyyy-MM-ddThh:mm:ss (2017-09-31T08:00:54).
from
string
Address of the starting point for the trip.
end_odometer
decimal
Mätarställningen vid resans slut. Anges i angiven enhetskod.
end_time
string
Date and time when the trip ends. Must be entered as yyyy-MM-ddThh:mm:ss (2017-09-31T08:00:54).
to
string
The address of the travel destination.
description
string
A description of the matter / mission carried out during the trip.
business_trip
bool
Indicates if the trip is a business trip. A trip that is not a business trip is a private trip.

JSON Example

{
  "personnel_id": "001",
  "name": "Nils Nilsson",
  "cost_center": "Marketing",
  "registration_number": "SXL 837",
  "unit_code": "km",
  "start_date": "2018-08-01T00:00:00",
  "end_date": "2018-08-31T23:59:59",
  "opening_odometer": 5000,
  "log_rows": [
    {
      "start_odometer": 5000,
      "start_time": "2018-08-05T09:30:11",
      "from": "Halmstad",
      "end_odometer": 5065,
      "end_time": "2018-08-05T12:30:11",
      "to": "Stockholm",
      "description": "Meeting with Olle.",
      "business_trip": true
    },
    {
      "start_odometer": 5065,
      "start_time": "2018-08-05T15:10:34",
      "from": "Stockholm",
      "end_odometer": 5125,
      "end_time": "2018-08-05T20:15:55",
      "to": "Halmstad",
      "description": "Driving home from meeting with Olle.",
      "business_trip": false
    }
  ],
  "ending_odometer": 5125
}

Code Example

// Create a drive log
AnnytabDoxDriveLog post = new AnnytabDoxDriveLog();
post.personnel_id = "001";
post.name = "Nils Nilsson";
post.cost_center = "Marketing";
post.registration_number = "SXL 837";
post.unit_code = "km";
post.start_date = "2018-08-01T00:00:00";
post.end_date = "2018-08-31T23:59:59";
post.opening_odometer = 5000M;
post.ending_odometer = 5125M;

// Add log rows
post.log_rows = new List<DriveLogRow>();
post.log_rows.Add(new DriveLogRow
{
    start_odometer = 5000M,
    start_time = "2018-08-05T09:30:11",
    from = "Halmstad",
    end_odometer = 5065M,
    end_time = "2018-08-05T12:30:11",
    to = "Stockholm",
    description = "Meeting with Olle.",
    business_trip = true
});
post.log_rows.Add(new DriveLogRow
{
    start_odometer = 5065M,
    start_time = "2018-08-05T15:10:34",
    from = "Stockholm",
    end_odometer = 5125M,
    end_time = "2018-08-05T20:15:55",
    to = "Halmstad",
    description = "Driving home from meeting with Olle.",
    business_trip = true
});

// Convert the object to a byte array
string json = JsonConvert.SerializeObject(post, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
byte[] array = Encoding.UTF8.GetBytes(json);

// Write to the stream
stream.Write(array, 0, array.Length);

Leave a Reply

Your email address will not be published. Required fields are marked *