Stream: implementers
Topic: Json-Schema validation errors
emilio (Mar 15 2018 at 20:31):
Hi, there are some errors in the json-schema schemas. The problem is that basically sometimes a value can be either an array or an object, but the schema only defines the case of an array. For example, Encounter.reason, the json-schema currently is:
"reason": { "description": "Reason the encounter takes place, expressed as a code. For admissions, this can be used for a coded admission diagnosis.", "type": "array", "items": { "$ref": "CodeableConcept.schema.json#/definitions/CodeableConcept" } }
but it should be
"reason": { "oneOf": [ { "description": "Reason the encounter takes place, expressed as a code. For admissions, this can be used for a coded admission diagnosis.", "type": "array", "items": { "$ref": "CodeableConcept.schema.json#/definitions/CodeableConcept" } }, { "$ref": "CodeableConcept.schema.json#/definitions/CodeableConcept" } ] },
I could use the $validate
operation of a public server, but that would be slower and less reliable than doing it in my own server with json-schema
Lloyd McKenzie (Mar 15 2018 at 21:51):
@Abigail Watson ?
Grahame Grieve (Mar 15 2018 at 23:22):
umm, I don't undertand the base claim here: "sometimes a value can be either an array or an object" - not so
emilio (Mar 15 2018 at 23:43):
@Grahame Grieve Well, I used the $validate
endpoint of this server http://hapi.fhir.org/baseDstu3
and it validates an Encounter in both cases, when reason
is an object (codeableConcept), and also when its an array of objects
emilio (Mar 15 2018 at 23:45):
I discovered this when uploading data to my server from the Synthea Project. It writes codeableConcepts independently and also inside of arrays.
emilio (Mar 15 2018 at 23:53):
The .org.hl7.fhir.validator.jar
also validates both formats without errors.
Grahame Grieve (Mar 15 2018 at 23:58):
well, you've found bugs in at least the validators then. and probably in the synthea project. I've already reported some cardinality bugs in the synthea data.
Grahame Grieve (Mar 15 2018 at 23:59):
want to post the actual examples here?
emilio (Mar 16 2018 at 00:04):
I have just been using a simple Encounter resource:
{ "resourceType": "Encounter", "id": "f003", "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative with Details</b></p></div>" }, "identifier": [ { "use": "official", "system": "http://www.bmc.nl/zorgportal/identifiers/encounters", "value": "v6751" } ], "status": "finished", "subject": { "reference": "Patient/f001", "display": "P. van de Heuvel" }, "reason": { "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/encounter-primaryDiagnosis", "valuePositiveInt": 1 } ] }, "serviceProvider": { "reference": "Organization/f001" } }
emilio (Mar 16 2018 at 00:04):
That resource gets validated by the .jar
. See how reason
is not an array.
emilio (Mar 16 2018 at 00:05):
I no longer have the exact resource generated by Synthea, but it was something like that
Grahame Grieve (Mar 16 2018 at 00:58):
yep sure was a bug in the validator - it will start noting an error if you provide an object in place of an array now
emilio (Mar 16 2018 at 01:03):
Oh, thanks. I guess we'll have to report the issue to Synthea.
@Grahame Grieve would you mind doing it yourself? I'm not sure about how to redact the issue
Grahame Grieve (Mar 16 2018 at 01:23):
@Jason Walonoski I think I already reported this...
emilio (Mar 16 2018 at 01:35):
It may be relevant to note that I didn't use Synthea directly. The bad data came from Crucible which uses Synthea
Jason Walonoski (Mar 16 2018 at 21:45):
We've fixed this in Synthea already. @Robert Scanlon The version of Synthea that Crucible uses needs to be updated.
Last updated: Apr 12 2022 at 19:14 UTC