Skip to content

Add Documents Entity to deal with documents such as photos, scanned CMRs, PDFs, etc. #7

Closed

Description

@bmeesters

Type of request

  • I'd like to add something to the OTM 5 spec
  • I'd like to change something in the OTM 5 spec

Is your feature request related to a problem?

Currently OTM does have no way of communicating data about documents, whereas documents are an important source of information in logistics. Examples include providing an eCMR (an eCMR might be added natively later) scanned CMRs, an official transport order, a proof of delivery in the shape of a photo, etc. Since this type of data is quite rich we cannot use (or abuse) external attributes for this purpose.

Describe the solution you'd like

After discussion between TANS, Centric and Simacan we came up with the following proposal:

  • Create a new entity Document. The reason to make this an entity instead of a data type is that we believe it is important that documents can be queried, inserted, updated, and associated from other entities.
  • Like all other entities, it should at least include the uuid, the name, and external attributes.
  • On top of that we want to add (all optional fields):
    • The filename, so the original name of the document can be shared and won't be lost among multiple exchanges of data.
    • The type of document (photo, text file, etc.)
    • The mimeType that indicates what kind of type the document is.
    • The encoding of the document.
    • The description of the document.
    • The status (proposal to use the same status as Consignments and Trips for consistency, though we need to check whether we are grouping unrelated things). There is already another proposal to extend the possible statuses.
    • The owner (associated actor) and creator (associated actor) of the document.
    • And the only mandatory field, the content. Where the content can either be a reference to some file (URI), or the actual content encoded (as base64). The reference also contains some data about what kind of reference it is.

Documents can be associated to loads, unloads, handOvers, consignments, transportOrders, goods and trips

An example document then looks like this:

{
  "uuid": "cf32da57-5edc-4c46-9a97-58c97ae27cf8",
  "name": "Photo of PoD",
  "externalAttributes": {
    "externalID": "photo1234"
  },
  "documentType": "photo",
  "filename": "my_photo.JPG",
  "mimeType": "image/jpeg",
  "encoding": "JPEG",
  "description": "Proof that the goods are delivered by providing the photo that captures the moment",
  "owner": {
    "assocaitionType": ":reference",
    "uuid": "655a2a4e-79b1-4637-9f13-b904730022ef"
  },
  "content": {
    "contentType": "data",
    "data": "<some base64 string>"
  }
}

The alternative content would look like this:

...
  "content": {
    "contentType": "reference",
    "uri": "https://link-to-photo.com/photo1234"
  }

Something that still needs some discussion:

  • Where do we want to use open text fields and where to we want to provide a list of possible options (enums)? Enums provide consistency and clarity in usage but can be too restrictive.
  • Are the associations to Documents good? Do we also want to include other entities such as actors or actions such as stops?

Describe alternatives you've considered

Additional context

Activity

  1. rvanweegberg commented on Mar 25, 2021

    @rvanweegberg

    Good description of necessary solution.

  2. rverberne commented on Mar 25, 2021

    @rverberne

    Overall a good proposal. A few points:

    • Is there overlap between encoding and mimeType? If so, could we remove one of them? If not, how do they differ?
    • I propose a attribute named origin. Values could be Planning and Driver. I would choose to use this instead of the creator Actor because a Actor is heavier in terms of implementation complexity. It can be hard to establish a translation between your system and a Actor. Using a origin attribite you could distinguish between different document streams independent of a Actor. You can answer the question: "Is this a Document from the planner to the driver?" and "Is this a Document originating from the driver"?
  3. bmeesters commented on Mar 25, 2021

    @bmeesters
    ContributorAuthor

    @rvanweegberg

    • Originally the idea was in case of text content to also provide the encoding (e.g. UTF-8, UTF-16, etc.). But I think mimeTypes cover most use cases, so we can leave encoding out for now.
    • I like the idea of the origin, but I don't think it can completely replace the owner Actor. Especially with format documents I think we will need to make the owner explicit as an actor. We can do both though, but it may be redundant with the owner role. And indeed replace creator with origin. Though we still need to think what kind of origins would be possible (Driver, Shipper, Carrier, Customer, etc. basically all actor roles that currently exist).
  4. thomaskolmans commented on Apr 8, 2021

    @thomaskolmans

    How does this support eCMR exactly? Are we supposed to save the eCMR data as base64 then or how is this meant? I get that scanned CMRs as a PDF or image can be saved in this format.

    The addition is very much welcome for the handling of documents of course!

  5. bmeesters commented on Apr 8, 2021

    @bmeesters
    ContributorAuthor

    Yes, you are right, it does not natively handle eCMRs. Which could also be a good addition to OTM. However it can support any kind of raw document, which includes just CMRs as PDFs or links to digital document containing the eCMR. Currently Simcan works with Transfollow for the eCMRs and these Document entities could be used for that, so I was a little quick to jump to the conclusion that eCMRs are supported. It does not truly incorporate eCMRs. I'll update the title to make this distinction better.

  6. changed the title [-]Add Documents Entity to deal with documents such as photos, eCMRs, PDFs, etc.[/-] [+]Add Documents Entity to deal with documents such as photos, scanned CMRs, PDFs, etc.[/+] on Apr 8, 2021
  7. added this to the OTM 5.1 milestone on Apr 22, 2021
  8. bmeesters commented on Jun 1, 2021

    @bmeesters
    ContributorAuthor

    Closing this as it is now official part of OTM5.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OTM 5.1This ticket is included in OTM 5.1enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions