Skip to main content

Model Definition Reference

A definition for a model to be used with the National Infrastructure Modeling Service.

FieldTypeValuesRequiredDescription
api_versionstring['v1beta3']YesThe version of the API that should be used to process the document.
kindstring['M', 'P', 'W']YesThe kind of object the document represents. Should equal 'M' for models
metadatametadata object-YesThe metadata for the Model.
specspec object-YesThe model specification.

metadata

The metadata for the Model.

FieldTypeValuesRequiredDescription
descriptionstring-YesA rich description of the Model's function.
display_namestring-YesThe display name of the Model.
namestring-YesThe name that the Model should be stored under. This can only contain alphanumeric characters and hyphens.
publisherstring-YesThe name of the person or organisation who has published the Model.
summarystring-YesA short summary of the Model's function.
contact_point_namestring-YesThe name of the person to contact for information about the Model.
contact_point_emailstring-YesThe email of the person to contact for information about the Model.
source_codestring-NoA URL pointing to the source code for this Model.
typestring['model', 'service']NoWhether this is a service or a model. The default is model.
licencestring-NoPermanent URL of applicable licence for this Model.
rightsstring-NoDetails of any usage rights, restrictions or citations required by users of this Model.
subjectstring['Biota', 'Boundaries', 'Climatology / Meteorology / Atmosphere', 'Economy', 'Elevation', 'Environment', 'Farming', 'Geoscientific Information', 'Health', 'Imagery / Base Maps / Earth Cover', 'Inland Waters', 'Intelligence / Military', 'Location', 'Oceans', 'Planning / Cadastre', 'Society', 'Structure', 'Transportation', 'Utilities / Communication']NoSpecific area of study or expertise.
project_namestring-NoName or acronym of the model's associated project.
project_urlstring-NoURL of the model's associated project.
fundingstring-NoFunding details of the model's associated project.
embargo_end_datestring-NoDate when the embargo is lifted for this model, in single quotes (i.e. 'YYYY-MM-DD').

spec

The model specification.

FieldTypeValuesRequiredDescription
commandarray of strings-NoThe command to be run with the image.
inputsinputs object-NoThe possible model inputs in a model definition.
outputsoutputs object-NoThe outputs of the model
resourcesresources object-NoThe hardware requirements of the model
sidecarsarray of model_sidecars-NoThe sidecars used by the model

inputs

The possible model inputs in a model definition.

FieldTypeValuesRequiredDescription
parametersarray of model_definition_parameters-NoArray of parameter definitions, this property is required but can be empty.
dataslotsarray of model_definition_input_dataslots-NoThe dataslots that contain the datasets that the Model expects as inputs when run in a Workflow, this property is required but can be empty.

model_definition_parameters

Metadata for the parameters a model uses as input. Depending on the type of the expected parameter some of these fields may be unnecessary (e.g. numeric variables should have a min and max value but these fields make no sense when set for a text variable.

Each input parameter has a type which, amongst other things, dictates how the parameter is represented on the front end to the user. For strings, integers, and numbers, the user is given an input field on the front end where they can type the value. Users will not be allowed to exceed the limitations given with min and max. String types that have options specified will have a dropdown box (as opposed to an input field) on the front end allowing users to pick from any of the options given in the list.

Boolean parameter types create a tick box on the front end which, if ticked, will set the corresponding envrionment variable to "True". If unticked, the variable will be set to "False".

JSON parameter types again provide the user with a text box. Given schema is a required field when using the JSON type, the JSON inputted by the user will be checked against that schema for validity.

The parameters are injected to Models as environment variables.

Given environment variables can only contain string values, all of the above types will be injected as string values which will need to be cast to the appropriate type at run time.

If the required property is set to False and a default property has also been set, the default will always be sent meaning that the runner of the model couldn't intentionally leave a parameter blank if it has a default associated with it. In addition to this, boolean parameters will always be sent by the front end regardless of whether you have set required or not. This is due to the desire to keep checkboxes simple and to avoid having a tri-state checkbox.

FieldTypeValuesRequiredDescription
namestring-YesThe name of the parameter.
titlestring-YesThe title to use when displaying this variable.
descriptionstring-YesWhat this parameter controls in the model.
typestring['string', 'integer', 'number', 'boolean', 'json', 'link']YesThe type of the value to be assigned to the parameter.
default--NoThe default value for this parameter.
minnumber-NoThe minimum value if this parameter is an integer or a number.
maxnumber-NoThe maximum value if this parameter is an integer or a number.
regexstring-NoThe regular expression which the parameter should match.
optionsarray of model_definition_parameters_options-NoA list of possible string values.
requiredboolean-YesAn indication as to whether or not the parameter is required for the model to run.
schemaschema object-NoThe valid schema for a JSON type.

model_definition_parameters_options

FieldTypeValuesRequiredDescription
name--YesThe name of this option.
title--YesThe display name to use for this option.

schema

The valid schema for a JSON type.

FieldTypeValuesRequiredDescription
itemsobject-NoThe items in a json array.
min_itemsnumber-NoThe minimum number of items in an array.
propertiesobject-NoThe properties in a json object.

model_definition_input_dataslots

The metadata required for a Model to find a Dataset loaded into this slot.

FieldTypeValuesRequiredDescription
namestring-YesThe name of the dataslot.
pathstring-YesThe path at which the Model expects to access the Datasets input into this slot.
defaultarray of strings-NoA list of the Datasets to be used as defaults for this slot. Must be specified if required is True.
descriptionstring-NoA description of what kind of data this slot should contain.
requiredboolean-YesA flag that determines whether this slot can be left empty. If required is True, default must be specified.

outputs

The outputs of the model

FieldTypeValuesRequiredDescription
datasetsarray of model_output_dataset-NoThe datasets that will be output from the model

model_output_dataset

Metadata associated with an output dataset.

FieldTypeValuesRequiredDescription
namestring-YesThe path to the output file from the model.
typestring-YesThe file format the data set will be in.
descriptionstring-YesA description of the output file.

resources

The hardware requirements of the model

FieldTypeValuesRequiredDescription
use_gpuboolean-NoA flag that determines whether or not your model will be assigned a GPU to run on.
readiness_probereadiness_probe object-NoA url Argo can call to check that a service model is running

readiness_probe

A url Argo can call to check that a service model is running

FieldTypeValuesRequiredDescription
hoststring-NoHost name to connect to, defaults to the pod IP
schemestring['HTTP', 'HTTPS']NoScheme to use for connecting to the host (HTTP or HTTPS). Defaults to HTTP.
pathstring-NoPath to access on the HTTP server. Defaults to /.
portinteger-NoNumber of the port to access on the container.

model_sidecars

The information required for this sidecar to be created.

FieldTypeValuesRequiredDescription
namestring-NoThe name used by the sidecar. This can only container alphanumeric characters and hyphens.
imagestring-NoThe image to use for this sidecar.
commandarray of strings-NoThe command to be run with the image.