Skip to content

Instantly share code, notes, and snippets.

@denniskigen
Last active March 31, 2024 07:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save denniskigen/80e4cd0765cbeda0efba79c6e6675e49 to your computer and use it in GitHub Desktop.
Save denniskigen/80e4cd0765cbeda0efba79c6e6675e49 to your computer and use it in GitHub Desktop.
Standard schema for OpenMRS 3.0
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "OpenMRS 3.0 form schema",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of the form"
},
"uuid": {
"type": "string",
"description": "Unique identifier of the form. Autogenerated by the system"
},
"encounterType": {
"type": "string",
"description": "The encounter type UUID that represents the encounter type that the form gets mapped to"
},
"pages": {
"type": "array",
"description": "Pages of the form",
"properties": {
"label": {
"type": "string",
"description": "Label of the page"
},
"sections": {
"type": "array",
"description": "Sections of the page",
"properties": {
"label": {
"type": "string",
"description": "Label of the section"
},
"isExpanded": {
"type": "string",
"description": "Whether the section is expanded or not"
},
"questions": {
"type": "array",
"description": "Question in a section",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier of the question"
},
"label": {
"type": "string",
"description": "Label of the question"
},
"required": {
"type": "boolean",
"description": "Whether the question is a required field or not"
},
"questionOptions": {
"type": "object",
"description": "Options of the question",
"properties": {
"type": {
"type": "string",
"description": "The datatype that the question maps to in OpenMRS"
},
"rendering": {
"type": "string",
"description": "Rendering type of the question"
},
"concept": {
"type": "string",
"description": "Concept UUID of the question"
},
"conceptMappings": {
"type": "array",
"description": "Concept mappings associated with the answer",
"properties": {
"relationship": {
"type": "string",
"description": "Relationship between concepts"
},
"type": {
"type": "string",
"description": "Concept mapping references"
},
"value": {
"type": "string",
"description": "Concept reference term"
}
}
},
"required": {
"type": "boolean",
"description": "Whether the question is a required field or not"
},
"answers": {
"type": "array",
"description": "Answers of the question",
"properties": {
"concept": {
"type": "string",
"description": "Concept UUID of the answer"
},
"label": {
"type": "string",
"description": "Label of the answer"
}
},
"required": [
"concept",
"label"
]
},
"calculate": {
"type": "object",
"description": "Calculate logic of the question",
"properties": {
"calculateExpression": {
"type": "string",
"description": "JavaScript expression that determines the value of the question from evaluating a calculation"
}
}
},
"min": {
"type": "string",
"description": "Minimum value of the question"
},
"max": {
"type": "string",
"description": "Maximum value of the question"
},
"minLength": {
"type": "string",
"description": "Minimum length of the question"
},
"maxLength": {
"type": "string",
"description": "Maximum length of the question"
}
},
"required": [
"type",
"rendering",
"answers"
]
},
"validators": {
"type": "array",
"description": "Validators of the question",
"properties": {
"type": {
"type": "string",
"description": "Type of the validator"
},
"message": {
"type": "string",
"description": "Message to be displayed when the validation fails"
},
"allowFutureDates": {
"type": "string",
"description": "Whether future dates are allowed or not"
},
"failsWhenExpression": {
"type": "string",
"description": "JavaScript expression that determines whether the validation fails or not"
},
"warnsWhenExpression": {
"type": "string",
"description": "JavaScript expression that determines whether the a warning shoud be displayed next to the field or not"
}
}
},
"hide": {
"type": "object",
"description": "Hide logic of the question",
"properties": {
"hideWhenExpression": {
"type": "string",
"description": "JavaScript expression that determines whether the question should be hidden or not"
}
}
},
"historicalExpression": {
"type": "object",
"description": "Logic that encapsulates information from past encounters specific to a question"
}
}
}
},
"required": [
"label",
"questions"
]
}
},
"required": [
"label",
"sections"
]
},
"processor": {
"type": "string",
"description": "Processor that mediates conversion of data between form data and the OpenMRS API"
},
"published": {
"type": "boolean",
"description": "Whether the form is published or not"
},
"retired": {
"type": "boolean",
"description": "Whether the form is retired or not"
},
"version": {
"type": "string",
"description": "Version of the form"
},
"availableIntents": {
"type": "string",
"description": "Intents that are available for the form"
},
"inlineRendering": {
"type": "string",
"description": "Whether the form is rendered inline or not"
}
},
"required": [
"name",
"version",
"pages",
"encounterType"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment