Stream: IG creation
Topic: how to slice effective[x]
Brian Reinhold (Nov 21 2018 at 12:09):
I am at a lost at how to 'slice' effective[x] or if I even need to slice it. In my profile, the Observation.effective[x] must exist, but it can be either effectiveDateTime or effectivePeriod. Which one of the two depends upon what a medical device reports.
My effort is as follows:
<element id="Observation.effective[x]"> <path value="Observation.effective[x]" /> <slicing> <discriminator> <type value="type" /> <path value="$this" /> </discriminator> <rules value="open" /> </slicing> <definition value="The time or time-period the observed value is asserted as being true. It is a time period if a Measure-Active-Period (duration) attribute is part of the metric measurement sent by the PHD. Otherwise it is the time stamp sent by the PHD or the time of reception by the PHG if the PHD sent no time stamp." /> <min value="1" /> <!-- The base Observation profile specifies that max=1. However, if you do not re-specify it here, you will get a slicing on non-repeating element error unless you have a constraint that restricts the total number. Here I end up stating both since the constraint makes it clearer to the implementer that not only can only one exists but that has to be at least one. --> <max value="1" /> <type> <code value="dateTime"/> </type> <type> <code value="Period"/> </type> <constraint> <key value="phd-obs-1"/> <!-- Some time stamp SHALL be present --> <severity value="error"/> <human value="Either an effectiveDateTime or effectivePeriod shall be present"/> <expression value="effectiveDateTime.exists() or effectivePeriod.exists().exists()"/> </constraint> </element>
I do not really understand the <path value="$this"/> as I obtained it from another guide which seemed to do what I needed to do but I have not found anything about it on the FHIR pages. In any case, the IG Publisher validator does not like it and reports an error for every example resource I have (no surprise as the element is required). The error is
Profile http://hl7.org/fhir/uv/phd/StructureDefinition/PhdCoincidentTimeStampObservation, Element matches more than one slice - , dateTime
which indicates to me the '$this' is not doing what I thought it was supposed to do.
Is it sufficient just to have the constraint in the element?
Stefan Karl (Nov 21 2018 at 15:35):
I got a similar error which was discussed here. Not sure if it has been fixed.
Eric Haas (Nov 21 2018 at 16:10):
I don't think that needs to be profiled at all. It sounds like the base resource does the trick
Lloyd McKenzie (Nov 21 2018 at 17:44):
What are you doing with your slices? The invariant is declared on the wrong element. You can't check if effective is present within the context of effective
Last updated: Apr 12 2022 at 19:14 UTC