Stream: IG creation
Topic: Validation issue with partial type slicing
Lloyd McKenzie (Nov 05 2020 at 19:07):
This profiles: http://build.fhir.org/ig/HL7/fhir-sdoh-clinicalcare/branches/master/StructureDefinition-SDOHCC-Observation-ScreeningResponseBase-1.html says that effective[x] can be a dateTime or a Period. We define an optional type slice on Period. However, the validator yells about this example: http://build.fhir.org/ig/HL7/fhir-sdoh-clinicalcare/branches/master/Observation-SDOHCC-Observation-HungerVitalSign-Example-3.html saying that it doesn't match the slice. But it's not expected to match the slice - and the slice is optional...
Grahame Grieve (Nov 06 2020 at 05:13):
so this is an issue in the snapshot generator - validator is faithfully doing what the snapshot says:
<element id="Observation.effective[x]">
<path value="Observation.effective[x]"/>
<slicing>
<discriminator>
<type value="type"/>
<path value="$this"/>
</discriminator>
<ordered value="false"/>
<rules value="closed"/>
</slicing>
<type>
<code value="dateTime"/>
</type>
<type>
<code value="Period"/>
</type>
</element>
<element id="Observation.effective[x]:effectivePeriod">
<path value="Observation.effective[x]"/>
<sliceName value="effectivePeriod"/>
<short value="Clinically relevant time/time-period for observation"/>
<definition
value="The time or time-period the observed value is asserted as being true. For biological subjects - e.g. human patients - this is usually called the "physiologically relevant time". This is usually either the time of the procedure or of specimen collection, but very often the source of the date/time is not known, only the date/time itself."/>
<comment
value="At least a date should be present unless this observation is a historical report. For recording imprecise or "fuzzy" times (For example, a blood glucose measurement taken "after breakfast") use the [Timing](http://hl7.org/fhir/R4/datatypes.html#timing) datatype which allow the measurement to be tied to regular life events."/>
<requirements
value="Knowing when an observation was deemed true is important to its relevance as well as determining trends."/>
<alias value="Occurrence"/>
<min value="0"/>
<max value="1"/>
<base>
<path value="Observation.effective[x]"/>
<min value="0"/>
<max value="1"/>
</base>
<type>
<code value="Period"/>
</type>
</element>
Grahame Grieve (Nov 06 2020 at 05:14):
17 of the existing 104 snapshot generation tests explore this area. A typical example is in t44a:
<differential>
<element>
<path value="Observation"/>
</element>
<!-- <element>
<path value="Observation.value[x]"/>
<short value="some text"/>
<type>
<code value="Quantity"/>
</type>
</element> -->
<element>
<path value="Observation.valueQuantity"/>
<short value="some text for quantity"/>
</element>
</differential>
Grahame Grieve (Nov 06 2020 at 05:14):
which leads to this:
Grahame Grieve (Nov 06 2020 at 05:15):
<element id="Observation.value[x]">
<path value="Observation.value[x]"/>
<slicing>
<discriminator>
<type value="type"/>
<path value="$this"/>
</discriminator>
<ordered value="false"/>
<rules value="closed"/>
</slicing>
<type>
<code value="Quantity"/>
</type>
<type>
<code value="CodeableConcept"/>
</type>
<type>
<code value="string"/>
</type>
<type>
<code value="boolean"/>
</type>
<type>
<code value="integer"/>
</type>
<type>
<code value="Range"/>
</type>
<type>
<code value="Ratio"/>
</type>
<type>
<code value="SampledData"/>
</type>
<type>
<code value="time"/>
</type>
<type>
<code value="dateTime"/>
</type>
<type>
<code value="Period"/>
</type>
</element>
<element id="Observation.value[x]:valueQuantity">
<path value="Observation.value[x]"/>
<sliceName value="valueQuantity"/>
<type>
<code value="Quantity"/>
</type>
</element>
Grahame Grieve (Nov 06 2020 at 05:18):
it's driven by how extensions are defined, in fact, were this is how it works.
Lloyd McKenzie (Nov 06 2020 at 14:11):
I don't understand. The base type allows dateTime or Period. We define an optional slice on Period. The snapshot looks fine. The issue is that the validator shouldn't yell about the optional slice on effectivePeriod when we send a dateTime?
Grahame Grieve (Nov 06 2020 at 17:31):
the snapshot is not fine - the slices are closed
Lloyd McKenzie (Nov 06 2020 at 20:48):
Oh, piddle. Sorry for not catching that.
Jean Duteau (Nov 06 2020 at 20:50):
(shocked at Lloyd's strong language on Zulip!)
Grahame Grieve (Nov 06 2020 at 21:44):
so I think that the snapshot is wrong, but I don't likely change a pile of accepted tests, and I haven't figured out how I could make a change with a technical correction since it would break all existing extension definitions
Lloyd McKenzie (Nov 06 2020 at 22:09):
The snapshot is indeed wrong. The differential lists the slicing as open.
Lloyd McKenzie (Nov 06 2020 at 22:11):
Why is the snapshot closing it? I think that's the problem here...
Grahame Grieve (Nov 06 2020 at 23:40):
because if it doesn't, every single extension will allow any type
Lloyd McKenzie (Nov 07 2020 at 01:31):
Can you make a separate rule for extensions, at least for now? Because there's no other way to enforce the behavior this IG needs...
Grahame Grieve (Nov 07 2020 at 05:40):
you can make an explicit slice
Lloyd McKenzie (Nov 07 2020 at 07:30):
I could, but it's methodologically wrong to force all type slices to be closed. And for something like Observation where you want to constrain a couple of them, but leave the full set available, it's a ton of work and super ugly in the rendering. This isn't a bug we should be continuing to propagate. I recognize we may need to leave it in place for a while until people can fix their extension definitions (presumably prompted by warnings), but it makes no sense to leave things broken like this forever...
Grahame Grieve (Nov 07 2020 at 20:24):
it's every extension definition we have
Grahame Grieve (Nov 07 2020 at 20:25):
and any existing relevant profiles - I haven't found a criteria to decide by
Lloyd McKenzie (Nov 07 2020 at 20:25):
Right. So something that might not be able to be fixed for extensions until R5. The validator will have to take that approach for all extensions in R4 and earlier.
Grahame Grieve (Nov 07 2020 at 20:26):
e.g. the test cases include a telus profile that has this problem
Grahame Grieve (Nov 07 2020 at 20:41):
no. not that one. But all these test cases:
t6: Error at Patient.deceased[x]: Allowed Types not sliced = [boolean]
t28: Error at OperationOutcome.issue.details.text.extension.value[x]: Allowed Types not sliced = [string]
t34: Error at Extension.value[x]: Allowed Types not sliced = [date, Meta, Address, Attachment, integer, Count, DataRequirement, Dosage, uuid, Identifier, Coding, SampledData, id, positiveInt, Distance, Period, Duration, canonical, Range, RelatedArtifact, base64Binary, UsageContext, Timing, decimal, CodeableConcept, ParameterDefinition, dateTime, string, Contributor, oid, instant, ContactPoint, HumanName, Money, markdown, Ratio, Age, Reference, TriggerDefinition, Quantity, uri, url, Annotation, ContactDetail, boolean, Expression, Signature, unsignedInt, time]
t44a: Error at Observation.value[x]: Allowed Types not sliced = [dateTime, boolean, string, SampledData, Period, Ratio, integer, time, Range, CodeableConcept]
au2: Error at Extension.extension.value[x]: Allowed Types not sliced = [date, Meta, Address, Attachment, integer, Count, DataRequirement, Dosage, uuid, Identifier, Coding, SampledData, id, positiveInt, Distance, Period, Duration, canonical, Range, RelatedArtifact, base64Binary, UsageContext, Timing, decimal, CodeableConcept, ParameterDefinition, dateTime, code, Contributor, oid, instant, ContactPoint, HumanName, Money, markdown, Ratio, Age, Reference, TriggerDefinition, Quantity, uri, url, Annotation, ContactDetail, boolean, Expression, Signature, unsignedInt, time]
au3: Error at Observation.effective[x]: Allowed Types not sliced = [Period, Timing, instant]
dv1: Error at Timing.repeat.bounds[x]: Allowed Types not sliced = [Period, Range]
obs-2: Error at Observation.value[x]: Allowed Types not sliced = [dateTime, boolean, string, SampledData, Quantity, Period, Ratio, integer, time, Range]
obs-2b: Error at Observation.value[x]: Allowed Types not sliced = [dateTime, boolean, string, SampledData, Quantity, Period, Ratio, integer, time, Range]
obs-4: Error at Observation.value[x]: Allowed Types not sliced = [dateTime, boolean, string, SampledData, Quantity, Period, Ratio, integer, time, Range]
obs-5: Error at Observation.value[x]: Allowed Types not sliced = [dateTime, boolean, string, SampledData, Period, Ratio, integer, time, Range]
pattern-ext-1: Error at MessageHeader.event[x]: Allowed Types not sliced = [uri]
pattern-ext-2: Error at MessageHeader.event[x]: Allowed Types not sliced = [uri]
ext-sort-issue: Error at Extension.value[x]: Allowed Types not sliced = [date, Meta, Address, Attachment, integer, Count, DataRequirement, Dosage, uuid, Identifier, Coding, SampledData, id, positiveInt, Distance, Period, Duration, canonical, Range, RelatedArtifact, base64Binary, UsageContext, Timing, decimal, CodeableConcept, ParameterDefinition, dateTime, code, string, Contributor, oid, instant, ContactPoint, HumanName, Money, markdown, Ratio, Age, TriggerDefinition, Quantity, uri, url, Annotation, ContactDetail, boolean, Expression, Signature, unsignedInt, time]
dk1: Error at Extension.value[x]: Allowed Types not sliced = [date, Meta, Address, Attachment, integer, Count, DataRequirement, Dosage, uuid, Identifier, Coding, SampledData, id, positiveInt, Distance, Period, Duration, canonical, Range, RelatedArtifact, base64Binary, UsageContext, Timing, decimal, ParameterDefinition, dateTime, code, string, Contributor, oid, instant, ContactPoint, HumanName, Money, markdown, Ratio, Age, Reference, TriggerDefinition, Quantity, uri, url, Annotation, ContactDetail, boolean, Expression, Signature, unsignedInt, time]
nl-med: Error at List.source.extension.value[x]: Allowed Types not sliced = [date, Meta, Address, Attachment, integer, Count, DataRequirement, Dosage, uuid, Identifier, Coding, SampledData, id, positiveInt, Distance, Period, Duration, canonical, Range, RelatedArtifact, base64Binary, UsageContext, Timing, decimal, CodeableConcept, ParameterDefinition, dateTime, code, string, Contributor, oid, instant, ContactPoint, HumanName, Money, markdown, Ratio, Age, TriggerDefinition, Quantity, uri, url, Annotation, ContactDetail, boolean, Expression, Signature, unsignedInt, time]
zib-BodyHeight: Error at Observation.value[x]: Allowed Types not sliced = [dateTime, boolean, string, SampledData, Period, Ratio, integer, time, Range, CodeableConcept]
type-slice-missing: Error at Observation.effective[x]: Allowed Types not sliced = [dateTime]
Lloyd McKenzie (Nov 07 2020 at 20:48):
So leave it as is and fix it in R5? It's wrong to auto-change "open" slices to "closed" just because that's how people erroneously did it when they started defining extensions.
Grahame Grieve (Nov 07 2020 at 20:48):
it's not just extensions
Grahame Grieve (Nov 07 2020 at 20:49):
but I may have an idea. let me investigate
Grahame Grieve (Nov 12 2020 at 06:37):
returning to this, after several days or work (I really don't like finding bugs in the snapshot generation)
@Lloyd McKenzie please review the changes to the test cases here: https://github.com/FHIR/fhir-test-cases/commit/acceaea7126b90c6c421268dc7098e4eba68c771
everyone else is welcome to review them as well
Lloyd McKenzie (Nov 12 2020 at 15:42):
In au3-expected.xml, I think <img src="http://hl7.org/fhirhelp16.png"
should be <img src="http://hl7.org/fhir/help16.png"
Lloyd McKenzie (Nov 12 2020 at 15:42):
Same issue with <a href="http://hl7.org/fhirreferences.html">
Lloyd McKenzie (Nov 12 2020 at 15:43):
(and a few others)
Lloyd McKenzie (Nov 12 2020 at 15:44):
In dv1-expected.xml, why did the links change to no longer be R4-specific?
Lloyd McKenzie (Nov 12 2020 at 15:48):
Missing '/' issues appear on a few of the other test cases too. No other issues I could see
Last updated: Apr 12 2022 at 19:14 UTC