Skip to content

Commit

Permalink
feat: add art examples in schema (#34)
Browse files Browse the repository at this point in the history
* feat: remove Observation.identifier from required field

* feat: add examples

* fix: update tests
  • Loading branch information
HJunyuan authored Jul 22, 2021
1 parent 261b86a commit 2f1c162
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 24 deletions.
54 changes: 43 additions & 11 deletions src/sg/gov/moh/pdt-healthcert/1.0/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,27 @@
},
"type": {
"description": "The kind of material that forms the specimen.",
"$ref": "#/definitions/CodeableConcept"
"$ref": "#/definitions/CodeableConcept",
"examples": [
{
"coding": [
{
"system": "http://snomed.info/sct",
"code": "258500001",
"display": "Nasopharyngeal swab"
}
]
},
{
"coding": [
{
"system": "http://snomed.info/sct",
"code": "697989009",
"display": "Anterior nares swab"
}
]
}
]
},
"collection": {
"description": "Details concerning the specimen collection.",
Expand All @@ -188,15 +208,7 @@
"Observation": {
"description": "Measurements and simple assertions made about a patient, device or other subject.",
"type": "object",
"required": [
"resourceType",
"identifier",
"code",
"valueCodeableConcept",
"effectiveDateTime",
"qualification",
"status"
],
"required": ["resourceType", "code", "valueCodeableConcept", "effectiveDateTime", "qualification", "status"],
"properties": {
"fullUrl": {
"type": "string",
Expand Down Expand Up @@ -229,7 +241,27 @@
},
"code": {
"description": "Describes what was observed. Sometimes this is called the observation \"name\".",
"$ref": "#/definitions/CodeableConcept"
"$ref": "#/definitions/CodeableConcept",
"examples": [
{
"coding": [
{
"system": "http://loinc.org",
"code": "94531-1",
"display": "Reverse transcription polymerase chain reaction (rRT-PCR) test"
}
]
},
{
"coding": [
{
"system": "http://snomed.info/sct",
"code": "97097-0",
"display": "SARS-CoV-2 (COVID-19) Ag [Presence] in Upper respiratory specimen by Rapid immunoassay"
}
]
}
]
},
"valueCodeableConcept": {
"description": "The information determined as a result of making the observation, if the information has a simple value.",
Expand Down
13 changes: 0 additions & 13 deletions src/sg/gov/moh/pdt-healthcert/1.0/schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -652,19 +652,6 @@ describe("schema", () => {
});

describe("Observation", () => {
it("should fail when identifier is missing", () => {
const document = omit(cloneDeep(sampleDocument), "fhirBundle.entry[2].identifier");
expect(validator(document)).toBe(false);
expect(validator.errors).toContainEqual({
dataPath: ".fhirBundle.entry[2]",
keyword: "required",
message: "should have required property 'identifier'",
params: {
missingProperty: "identifier"
},
schemaPath: "#/required"
});
});
it("should fail when identifier is empty", () => {
const document = set(cloneDeep(sampleDocument), "fhirBundle.entry[2].identifier", []);
expect(validator(document)).toBe(false);
Expand Down

0 comments on commit 2f1c162

Please sign in to comment.