Design Patterns

A collection of design patterns to be used when working with the Field Systems data services.

Attachment Tags

For example, an image file can serve various purposes such as a background map, design input, report, or field data.

When an image file is attached to a job, its purpose may need to be specified. This can be done by using the attachments Tag[] property when adding or updating the attachment.

We might want to define the following tags Background, Design,Report and FieldData.

Tags can be added using the PUT/POST /projects/{projectTrn}/jobs/{jobsId}/attachments end points. See swagger/ui for examples.

These tags should be declared in your application’s jobType schema using a $defs / attachmentTags definition. This ensures the enforcement of attribute naming rules. If your application uses the Jobs Service feature, don’t forget to include RootDataFile.

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
...
"$defs": {
"attachmentTags" : {
"type" : "string",
"description": "Possible tags are."
"enum" : ["RootDataFile","Background","Design","Report","FieldData"]
}
}
}

Schema Metadata

Job data is stored in the attributes object of an individual job record.

These attributes follow the schema registered for each jobType and can be retrieved using the GET /schema/{jobType} API end point. This schema definition is managed by the jobType owner.

In addition to the normal JSON Schema type information, you can enhance this schema to add additional metadata for jobType attributes.

For instance, you might want to include SI storage units or fields that are only visible to administrators.

For this example we will add SI storage units to some attributes. Imagine we have the following schema types that need SI units.

"attributes": {
"type": "object",
"properties": {
"area": {
"type": "number"
},
"altitude": {
"type": "number",
"default": 0
}
}
}

The type information can be added like this.

"attributes": {
"type": "object",
"properties": {
"area": {
"si_units" : "sq_m",
"type": "number"
},
"altitude": {
"si_units" : "m",
"type": "number",
"default": 0
}
}
}

Once the schema definition has been updated it needs to be given to the Trimble Field Data Jobs Service team for publication in the Jobs Service. Once published applications will be able to GET the schema and use this new attribute metadata.

© 2023, Trimble Inc.

Dedicated to the world's tomorrow, Trimble is a technology company delivering solutions that enable our customers to work in new ways to measure, build, grow and move goods for a better quality of life. Core technologies in positioning, modeling, connectivity and data analytics connect the digital and physical worlds to improve productivity, quality, safety, transparency and sustainability. From purpose-built products and enterprise lifecycle solutions to industry cloud services, Trimble is transforming critical industries such as construction, geospatial, agriculture and transportation to power an interconnected world of work.