Stream: implementers
Topic: Mandatory/optional fields inconsistency (docs/json schema)
Arseniy Zhizhelev (Jul 22 2020 at 11:09):
It seems to me that there is a mismatch between FHIR Structure definition and JSON schema.
In particular, JSON schema specifies Claim Insurance Focal field as optional, while documentation https://www.hl7.org/fhir/claim-definitions.html#Claim.insurance.focal says it's mandatory.
See
https://github.com/nazrulworld/fhir.resources/issues/18#issuecomment-661692087 for the context.
Lloyd McKenzie (Jul 22 2020 at 14:32):
That's not an error. I expect you'll see there's a co-occurrence rule that requires either focal
or _focal
.
Arseniy Zhizhelev (Jul 28 2020 at 13:57):
Could you help me find this co-occurrence rule inside json schema? What I see for "Claim_Insurance":
is this:
{
"description": "A provider issued list of professional services and products which have been provided, or are to be provided, to a patient which is sent to an insurer for reimbursement.",
"properties": {
"focal": {
"description": "A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.",
"$ref": "#/definitions/boolean"
},
"_focal": {
"description": "Extensions for focal",
"$ref": "#/definitions/Element"
},
"coverage": {
"description": "Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient\u0027s actual coverage within the insurer\u0027s information system.",
"$ref": "#/definitions/Reference"
}
},
"additionalProperties": false,
"required": [
"coverage"
]
}
I only see required
field here - coverage
.
Lloyd McKenzie (Jul 28 2020 at 15:10):
@Grahame Grieve
Grahame Grieve (Jul 28 2020 at 21:53):
I'm not generating the co-occurence rules
Grahame Grieve (Jul 28 2020 at 21:56):
because I don't see how to, I think
Michele Mottini (Jul 28 2020 at 22:02):
FHIR has its own structure definition and validation code - why not use that? JSON schemas are a poor fit
Lloyd McKenzie (Jul 29 2020 at 02:55):
I thought in a post long ago you said you had? But if it's not possible, so be it. In any case, the elements have to be optional because the minOccurs rule applies to (at least one of) not both of.
Benjamin Flessner (Aug 25 2020 at 14:49):
I'm seeing several other missing required
statements in the JSON Schema and am wondering if I'm just not reading it right. A couple of exmaples:
- Annotation does not require
text
- Extension does not require
url
I do see some required
properties in other DataTypes, but they're not consistent. For example, Signature lists type
and who
as required but not when
.
Benjamin Flessner (Aug 25 2020 at 14:56):
Oh; the missing required
flags are all on primitive data types. Does this mean that if you have an extension on a required field with a primitive datatype that the instance is valid if only the extension is present? E.g. you can have an Extension with _url
but no url
? I thought url
was still required in this case.
Lloyd McKenzie (Aug 25 2020 at 15:23):
url is not required if _url is present
Grahame Grieve (Aug 25 2020 at 21:21):
extension is a special case, but the json schema generator doesn't know about that. Feel free to create a task to make extension.url a special case in the generator
Last updated: Apr 12 2022 at 19:14 UTC