FHIR Chat · StructureDefinition and unknown properties · implementers

Stream: implementers

Topic: StructureDefinition and unknown properties


view this post on Zulip Pash (Mar 16 2021 at 23:34):

Is it possible to validate the resource with StructureDefinition specifying ONLY the fields I want to validate and don't care about non-specified properties? Ex: I want only to validate Patient.identifier > 0.
Using my custom definition without BaseDefinition leads to errors like "Encountered unknown child elements 'id','meta','extension','name','telecom','gender','birthDate','address','maritalStatus','communication' for definition 'Patient' (at Patient)". I want to avoid such errors and do just partial profile validation. Please advice.

view this post on Zulip Richard Townley-O'Neill (Mar 17 2021 at 00:30):

I'm confused.
The definition of Patient imports all of DomainResource. But all of those elements are optional. A Patient whose only element is Patient.identifier is valid.

view this post on Zulip Richard Townley-O'Neill (Mar 17 2021 at 00:30):

<Patient xmlns="http://hl7.org/fhir">
<identifier>
<system value="http://ns.electronichealth.net.au/id/hi/ihi/1.0"/>
<value value="8003608833357361"/>
</identifier>
</Patient>

view this post on Zulip Richard Townley-O'Neill (Mar 17 2021 at 00:39):

A minimal StructureDefinition to validate this is
<StructureDefinition xmlns="http://hl7.org/fhir">
<url value="http://example.org/fhir/StructureDefinition/MyPatient"/>
<name value="MyPatient"/>
<status value="draft"/>
<fhirVersion value="4.0.1"/>
<kind value="resource"/>
<abstract value="false"/>
<type value="Patient"/>
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Patient"/>
<derivation value="constraint"/>
<differential>
<element id="Patient.identifier">
<path value="Patient.identifier"/>
<min value="1"/>
</element>
</differential>
</StructureDefinition>

view this post on Zulip Pash (Mar 17 2021 at 09:20):

@Richard Townley-O'Neill yes, but I am not using core profiles, only my "partial" profile. Where the only Differential Element is Identifier, the same if you delete "baseDefinition" from your example. So when I am validating full Patient resource there are errors about unknown fields. Don't want to validate using full core profiles because of performance and uselessness in my case.

view this post on Zulip Lloyd McKenzie (Mar 17 2021 at 14:29):

First, you should always check modifier elements (e.g. Patient.active, Patient.deceased[x], modifierExtension, etc.) because those could cause the meaning of your instance to be non-computable. Second, right now, the Java validator doesn't have an option to only validate certain elements. You could submit a Git issue against it asking for that enhancement. I believe the .NET validator is in the same boat. Third, skipping elements is only one way of boosting performance. I'd recommend profiling your validation experience and see where most of the time is. Cutting down on calls to the terminology server (e.g. by ensuring all of your terminologies are pre-expanded and having a terminology service of n/a) is a big one.

view this post on Zulip Pash (Mar 17 2021 at 14:52):

@Lloyd McKenzie I am using .Net lib, and even without requests to the external terminology servers it takes up to 1 second to validate my big bundle with the official core profiles (cold start is even worse), and also it is some fast internal "Attribute" validation which is not profile validation but at least something. Here I am asking - is it even valid to check only fields I want by the FHIR specification. Probably I am missing something in my profile, and it is possible to use the Patient profile above with some tweaks.

view this post on Zulip Lloyd McKenzie (Mar 17 2021 at 16:00):

There's no requirement to validate at all. The only FHIR requirement is that all data you expose must be completely valid. Typically, the easiest way to ensure that what you expose is valid is to ensure that everything you take in is valid. It's completely legitimate to only validate those elements your system is going to pay attention to (though you should always pay attention to modifier elements). But I don't believe the .NET validator has a capability to perform that sort of filtering as of yet.

view this post on Zulip Radha Rajendran (Apr 08 2021 at 10:11):

Hello all,

Can anyone please share structure definition examples with minValue and maxValue ?
These fields are choice of datatype, so could not find the exact key name for this fields .

view this post on Zulip Radha Rajendran (Apr 08 2021 at 10:15):

Can we create our own profiles based on our functionality ?

view this post on Zulip Lloyd McKenzie (Apr 08 2021 at 15:22):

Don't have any examples near to hand, but the instances would look like this:
<minValueDate value="2021-04-08"/>
or
"minValueDate": "2021-04-08",

You're certainly free to (and encouraged to) define your own profiles to document your own functionality in a standardized way.

view this post on Zulip Radha Rajendran (Apr 09 2021 at 05:29):

@Lloyd McKenzie Thank you very much for your reply

view this post on Zulip Radha Rajendran (Apr 09 2021 at 06:40):

Hi @Lloyd McKenzie

How to declare default value and validate data type(Codeableconcept) elements in structure definition .?
This example is created by me . may be its not the real case but Like this i may get the data for other data types.

Example: Patient.communication[0].language.coding[0].code they given "-" in resource request.
I want to update default value "en-us" for this field .
Shall i give direct path (Eg: Patient..communication[0].language.coding[0].code) in structure definition ?

view this post on Zulip Radha Rajendran (Apr 09 2021 at 14:32):

Can anyone please guide me how to implement meaningWhenMissing and defaultValue ?

In FHIR document they mentioned like below
default value and meaningWhenMissing are mutually exclusive defaultValue.empty() or meaningWhenMissing.empty()

Whether i can allow empty value for field and then apply default value (But fhir schema not allowing null or empty values in resource data) . How defaultValue and meaningWhenMissing mutually exclusive ?

meaningWhenMissing is markdown datatype how i validate based on this ?

view this post on Zulip Lloyd McKenzie (Apr 09 2021 at 16:25):

FHIR doesn't have default values. I.e. there's no "value" you can infer when an element is missing. Where meaningIfMissing is specified, that tells how to interpret instances where the element is omitted. It's prohibited to define meaningIfMissing in a profile - because profiles can't ever inject meaning into an instance.

view this post on Zulip Radha Rajendran (Apr 27 2021 at 11:16):

Hello all,

I am using http://hl7.org/fhir/validation.html#jar JAR validator for stucture definition validation.
If i add any additional validation property in Elements such as minValueDate, minValueInteger , The validator not validating the resource data .

Can any one please help - Is my key is correct or am i missing something ?

view this post on Zulip Radha Rajendran (Apr 27 2021 at 11:18):

What is the usecase of "pattern" in structure definition ?

view this post on Zulip Lloyd McKenzie (Apr 27 2021 at 14:02):

Pattern is primarily used for slicing - it allows you to specify a limited amount of information to match on while still leaving other elements unconstrained. Can you provide an example of a profile declaring mins that isn't working?

view this post on Zulip Radha Rajendran (Apr 27 2021 at 14:32):

{
"id": "Patient.birthDate",
"path": "Patient.birthDate",
"short": "The date of birth for the individual",
"definition": "The date of birth for the individual.",
"comment": "At least an estimated year should be provided as a guess if the real DOB is unknown There is a standard extension \"patient-birthTime\" available that should be used where Time is required (such as in maternity/infant care systems).",
"requirements": "Age of the individual drives many clinical processes.",
"min": 0,
"max": "1",
"minValueDate": "1900-01-01",
"base": {
"path": "Patient.birthDate",
"min": 0,
"max": "1"
},
"type": [
{
"code": "date"
}
],
"constraint": [
{
"key": "ele-1",
"severity": "error",
"human": "All FHIR elements must have a @value or children",
"expression": "exists() or (children().count() > id.count())",
"xpath": "@value|f:*|h:div",
"source": "http://hl7.org/fhir/StructureDefinition/Element"
}
],
"mustSupport": true,
"isModifier": false,
"isSummary": true,
"mapping": [
{
"identity": "v2",
"map": "PID-7"
},
{
"identity": "rim",
"map": "player[classCode=PSN|ANM and determinerCode=INSTANCE]/birthTime"
},
{
"identity": "cda",
"map": ".patient.birthTime"
},
{
"identity": "loinc",
"map": "21112-8"
},
{
"identity": "argonaut-dq-dstu2",
"map": "Patient.birthDate"
}
]
},

view this post on Zulip Radha Rajendran (Apr 27 2021 at 14:32):

I have tested using above element @Lloyd McKenzie

view this post on Zulip Lloyd McKenzie (Apr 27 2021 at 16:18):

@Mark Iantorno @Grahame Grieve

view this post on Zulip Grahame Grieve (Apr 27 2021 at 21:12):

it turns out I've overlooked that. can you provide a profile and test instance?


Last updated: Apr 12 2022 at 19:14 UTC