Stream: IG creation
Topic: Differential does not have a slice error
Tim Blake (Dec 15 2019 at 20:39):
I'm getting the following error from a profile which built without an issue a couple of IGPublisher versions ago:
org.hl7.fhir.exceptions.FHIRException: Unable to generate snapshot for http://fhir.health.nsw.gov.au/fhir/ehealth/itoc/v1.0/StructureDefinition/nswhealthitocmedicationstatement in C:\Users\timbl\OneDrive\Documents\nsw-health-fhir-itoc\resources\nswhealthitocmedicationstatement
at org.hl7.fhir.igtools.publisher.Publisher.generateSnapshot(Publisher.java:3805)
at org.hl7.fhir.igtools.publisher.Publisher.generateSnapshots(Publisher.java:3762)
at org.hl7.fhir.igtools.publisher.Publisher.loadConformance(Publisher.java:3217)
at org.hl7.fhir.igtools.publisher.Publisher.createIg(Publisher.java:768)
at org.hl7.fhir.igtools.publisher.Publisher.execute(Publisher.java:655)
at org.hl7.fhir.igtools.publisher.Publisher.main(Publisher.java:6662)
Caused by: org.hl7.fhir.exceptions.DefinitionException: Differential does not have a slice: MedicationStatement.medication[x].coding/ (b:22 of 56 / 6/ 11) in profile http://fhir.health.nsw.gov.au/fhir/ehealth/itoc/v1.0/StructureDefinition/nswhealthitocmedicationstatement
at org.hl7.fhir.r5.conformance.ProfileUtilities.processPaths(ProfileUtilities.java:945)
at org.hl7.fhir.r5.conformance.ProfileUtilities.processPaths(ProfileUtilities.java:1179)
at org.hl7.fhir.r5.conformance.ProfileUtilities.generateSnapshot(ProfileUtilities.java:492)
at org.hl7.fhir.igtools.publisher.Publisher.generateSnapshot(Publisher.java:3803)
... 5 more
Profile as follows:
<?xml version="1.0" encoding="utf-8"?>
<StructureDefinition xmlns="http://hl7.org/fhir">
<id value="nswhealthitocmedicationstatement" />
<url value="http://fhir.health.nsw.gov.au/fhir/ehealth/itoc/v1.0/StructureDefinition/nswhealthitocmedicationstatement" />
<version value="1.0.0" />
<name value="NSWHealthiTOCMedicationStatement" />
<status value="draft" />
<date value="2019-10-29"/>
<publisher value="NSW eHealth" />
<fhirVersion value="4.0.1" />
<kind value="resource" />
<abstract value="false" />
<type value="MedicationStatement" />
<baseDefinition value="http://hl7.org.au/fhir/StructureDefinition/au-medicationstatement" />
<derivation value="constraint" />
<differential>
<element id="MedicationStatement">
<path value="MedicationStatement" />
<short value="A record of medication being taken by a patient in an Australian healthcare context." />
</element>
<element id="MedicationStatement.extension:diluent">
<path value="MedicationStatement.extension" />
<sliceName value="diluent" />
<short value="The diluent medication" />
<min value="0" />
<max value="1" />
<type>
<code value="Extension" />
<profile value="http://fhir.health.nsw.gov.au/fhir/ehealth/itoc/v1.0/StructureDefinition/diluent" />
</type>
</element>
<element id="MedicationStatement.basedOn">
<path value="MedicationStatement.basedOn"/>
<type>
<code value="Reference"/>
<targetProfile value="http://fhir.health.nsw.gov.au/fhir/ehealth/itoc/v1.0/StructureDefinition/nswhealthitocorder"/>
</type>
</element>
<element id="MedicationStatement.category">
<path value="MedicationStatement.category" />
<short value="The type of medication usage. For Medication List use case use "inpatient". For Medication History use case use "patientspecified"." />
<definition value="Indicates where type of medication statement and where the medication is expected to be consumed or administered. For Medication List use case use "inpatient". For Medication History use case use "patientspecified"." />
<min value="1" />
</element>
<element id="MedicationStatement.medication[x]:medicationCodeableConcept">
<path value="MedicationStatement.medication[x]"/>
<sliceName value="medicationCodeableConcept"/>
</element>
<element id="MedicationStatement.medication[x]:medicationCodeableConcept.coding:cerner">
<path value="MedicationStatement.medication[x].coding"/>
<sliceName value="cerner"/>
<short value="The cerner (MULTUM) code for the medication"/>
<max value="1"/>
</element>
<element id="MedicationStatement.medication[x]:medicationCodeableConcept.coding:cerner.system">
<path value="MedicationStatement.medication[x].coding.system"/>
<min value="1"/>
<fixedUri value="http://cerner.com/itoc/codes"/>
</element>
<element id="MedicationStatement.medication[x]:medicationCodeableConcept.coding:cerner.code">
<path value="MedicationStatement.medication[x].coding.code"/>
<short value="Cerner (MULTUM) code value" />
<min value="1"/>
</element>
<element id="MedicationStatement.medication[x]:medicationCodeableConcept.coding:imdsoft">
<path value="MedicationStatement.medication[x].coding"/>
<sliceName value="imdsoft"/>
<short value="The MetaVision / IMDsoft code for the medication"/>
<max value="1"/>
</element>
<element id="MedicationStatement.medication[x]:medicationCodeableConcept.coding:imdsoft.system">
<path value="MedicationStatement.medication[x].coding.system"/>
<min value="1"/>
<fixedUri value="http://www.imd-soft.com/itoc/codes"/>
</element>
<element id="MedicationStatement.medication[x]:medicationCodeableConcept.coding:imdsoft.code">
<path value="MedicationStatement.medication[x].coding.code"/>
<short value="MetaVision / IMDsoft code value" />
<min value="1"/>
</element>
<element id="MedicationStatement.medication[x]:medicationReference">
<path value="MedicationStatement.medicationReference"/>
<sliceName value="medicationReference"/>
<short value="A reference to a NSW Health iTOC Medication" />
<type>
<code value="Reference"/>
<targetProfile value="http://fhir.health.nsw.gov.au/fhir/ehealth/itoc/v1.0/StructureDefinition/nswhealthitocmedication"/>
</type>
</element>
<element id="MedicationStatement.subject">
<path value="MedicationStatement.subject" />
<short value="The patient who is or was taking the medication." />
<definition value="The person who is/was taking the medication." />
<type>
<code value="Reference" />
<targetProfile value="http://fhir.health.nsw.gov.au/fhir/ehealth/itoc/v1.0/StructureDefinition/nswhealthitocpatient" />
</type>
</element>
</differential>
</StructureDefinition>
@Grahame Grieve Has something changed?
Grahame Grieve (Dec 15 2019 at 20:46):
well, something has changed, but not that actual detail. I think of this as a discovered issue - something wasn't working before and is now, so you see this error.
Grahame Grieve (Dec 15 2019 at 20:46):
you need to be explicit about your slicing on coding
Tim Blake (Dec 15 2019 at 20:59):
Not quite sure what that means? Can you please give an example?
Grahame Grieve (Dec 15 2019 at 21:13):
from your sd:
<element id="MedicationStatement.medication[x]:medicationCodeableConcept"> <path value="MedicationStatement.medication[x]"/> <sliceName value="medicationCodeableConcept"/> </element> <element id="MedicationStatement.medication[x]:medicationCodeableConcept.coding:cerner"> <path value="MedicationStatement.medication[x].coding"/> <sliceName value="cerner"/> <short value="The cerner (MULTUM) code for the medication"/> <max value="1"/> </element>
Grahame Grieve (Dec 15 2019 at 21:13):
you launched right into the cerner slice without first defining the slicing
Grahame Grieve (Dec 15 2019 at 21:15):
so you should have something like:
<element id="MedicationStatement.medication[x]:medicationCodeableConcept.coding"> <path value="MedicationStatement.medication[x].coding"/> <slicing> <discriminator> <type value="value"/> <path value="system"/> </discriminator> <discriminator> <type value="value"/> <path value="code"/> </discriminator> <rules value="open"/> </slicing> </element>
Grahame Grieve (Dec 15 2019 at 21:15):
in between
Tim Blake (Dec 15 2019 at 21:27):
Okay, thanks.
Tim Blake (Dec 18 2019 at 22:05):
Still having issues. If I add in:
<element id="MedicationStatement.medication[x]:medicationCodeableConcept.coding"> <path value="MedicationStatement.medication[x].coding" /> <slicing> <discriminator> <type value="value" /> <path value="system" /> </discriminator> <rules value="open" /> </slicing> <short value="Medication Codes" /> </element>
I get error:
Stack Dump (for debugging): (00:47.0615)
org.hl7.fhir.exceptions.DefinitionException: Slice encountered midway through path on MedicationStatement.medication[x].coding; profile http://fhir.health.nsw.gov.au/fhir/ehealth/itoc/v1.0/StructureDefinition/nswhealthitocmedicationstatement; instance patientprofile1-medhistory-example0
at org.hl7.fhir.r5.validation.InstanceValidator.assignChildren(InstanceValidator.java:4661)
at org.hl7.fhir.r5.validation.InstanceValidator.validateElement(InstanceValidator.java:4320)
at org.hl7.fhir.r5.validation.InstanceValidator.checkChild(InstanceValidator.java:4533)
at org.hl7.fhir.r5.validation.InstanceValidator.validateElement(InstanceValidator.java:4327)
at org.hl7.fhir.r5.validation.InstanceValidator.start(InstanceValidator.java:3256)
at org.hl7.fhir.r5.validation.InstanceValidator.validateResource(InstanceValidator.java:4984)
at org.hl7.fhir.r5.validation.InstanceValidator.validateContains(InstanceValidator.java:4234)
at org.hl7.fhir.r5.validation.InstanceValidator.checkChild(InstanceValidator.java:4437)
at org.hl7.fhir.r5.validation.InstanceValidator.validateElement(InstanceValidator.java:4327)
at org.hl7.fhir.r5.validation.InstanceValidator.checkChild(InstanceValidator.java:4453)
at org.hl7.fhir.r5.validation.InstanceValidator.validateElement(InstanceValidator.java:4327)
at org.hl7.fhir.r5.validation.InstanceValidator.start(InstanceValidator.java:3235)
at org.hl7.fhir.r5.validation.InstanceValidator.validateResource(InstanceValidator.java:4984)
at org.hl7.fhir.r5.validation.InstanceValidator.validate(InstanceValidator.java:850)
at org.hl7.fhir.r5.validation.InstanceValidator.validate(InstanceValidator.java:810)
at org.hl7.fhir.igtools.publisher.Publisher.validate(Publisher.java:4031)
at org.hl7.fhir.igtools.publisher.Publisher.validate(Publisher.java:4008)
at org.hl7.fhir.igtools.publisher.Publisher.createIg(Publisher.java:775)
at org.hl7.fhir.igtools.publisher.Publisher.execute(Publisher.java:657)
at org.hl7.fhir.igtools.publisher.Publisher.main(Publisher.java:6689)
This is a derived profile. Does that make a difference?
Tim Blake (Dec 18 2019 at 22:05):
@Brett Esler Thoughts?
Grahame Grieve (Dec 18 2019 at 23:40):
are you adding that on the first element?
Tim Blake (Dec 18 2019 at 23:59):
Full profile here:
<?xml version="1.0" encoding="utf-8"?>
<StructureDefinition xmlns="http://hl7.org/fhir">
<id value="nswhealthitocmedicationstatement" />
<url value="http://fhir.health.nsw.gov.au/fhir/ehealth/itoc/v1.0/StructureDefinition/nswhealthitocmedicationstatement" />
<version value="1.0.0" />
<name value="NSWHealthiTOCMedicationStatement" />
<status value="draft" />
<date value="2019-10-29"/>
<publisher value="NSW eHealth" />
<fhirVersion value="4.0.1" />
<kind value="resource" />
<abstract value="false" />
<type value="MedicationStatement" />
<baseDefinition value="http://hl7.org.au/fhir/StructureDefinition/au-medicationstatement" />
<derivation value="constraint" />
<differential>
<element id="MedicationStatement">
<path value="MedicationStatement" />
<short value="A record of medication being taken by a patient in an Australian healthcare context." />
</element>
<element id="MedicationStatement.extension:diluent">
<path value="MedicationStatement.extension" />
<sliceName value="diluent" />
<short value="The diluent medication" />
<min value="0" />
<max value="1" />
<type>
<code value="Extension" />
<profile value="http://fhir.health.nsw.gov.au/fhir/ehealth/itoc/v1.0/StructureDefinition/diluent" />
</type>
</element>
<element id="MedicationStatement.basedOn">
<path value="MedicationStatement.basedOn"/>
<type>
<code value="Reference"/>
<targetProfile value="http://fhir.health.nsw.gov.au/fhir/ehealth/itoc/v1.0/StructureDefinition/nswhealthitocorder"/>
</type>
</element>
<element id="MedicationStatement.category">
<path value="MedicationStatement.category" />
<short value="The type of medication usage. For Medication List use case use "inpatient". For Medication History use case use "patientspecified"." />
<definition value="Indicates where type of medication statement and where the medication is expected to be consumed or administered. For Medication List use case use "inpatient". For Medication History use case use "patientspecified"." />
<min value="1" />
</element>
<element id="MedicationStatement.medication[x]:medicationCodeableConcept">
<path value="MedicationStatement.medication[x]"/>
<sliceName value="medicationCodeableConcept"/>
</element>
<element id="MedicationStatement.medication[x]:medicationCodeableConcept.coding">
<path value="MedicationStatement.medication[x].coding" />
<slicing>
<discriminator>
<type value="value" />
<path value="system" />
</discriminator>
<rules value="open" />
</slicing>
<short value="Medication Codes" />
</element>
<element id="MedicationStatement.medication[x]:medicationCodeableConcept.coding:cerner">
<path value="MedicationStatement.medication[x].coding"/>
<sliceName value="cerner"/>
<short value="The cerner (MULTUM) code for the medication"/>
<max value="1"/>
</element>
<element id="MedicationStatement.medication[x]:medicationCodeableConcept.coding:cerner.system">
<path value="MedicationStatement.medication[x].coding.system"/>
<min value="1"/>
<fixedUri value="http://cerner.com/itoc/codes"/>
</element>
<element id="MedicationStatement.medication[x]:medicationCodeableConcept.coding:cerner.code">
<path value="MedicationStatement.medication[x].coding.code"/>
<short value="Cerner (MULTUM) code value" />
<min value="1"/>
</element>
<element id="MedicationStatement.medication[x]:medicationCodeableConcept.coding:imdsoft">
<path value="MedicationStatement.medication[x].coding"/>
<sliceName value="imdsoft"/>
<short value="The MetaVision / IMDsoft code for the medication"/>
<max value="1"/>
</element>
<element id="MedicationStatement.medication[x]:medicationCodeableConcept.coding:imdsoft.system">
<path value="MedicationStatement.medication[x].coding.system"/>
<min value="1"/>
<fixedUri value="http://www.imd-soft.com/itoc/codes"/>
</element>
<element id="MedicationStatement.medication[x]:medicationCodeableConcept.coding:imdsoft.code">
<path value="MedicationStatement.medication[x].coding.code"/>
<short value="MetaVision / IMDsoft code value" />
<min value="1"/>
</element>
<element id="MedicationStatement.medication[x]:medicationReference">
<path value="MedicationStatement.medicationReference"/>
<sliceName value="medicationReference"/>
<short value="A reference to a NSW Health iTOC Medication" />
<type>
<code value="Reference"/>
<targetProfile value="http://fhir.health.nsw.gov.au/fhir/ehealth/itoc/v1.0/StructureDefinition/nswhealthitocmedication"/>
</type>
</element>
<element id="MedicationStatement.subject">
<path value="MedicationStatement.subject" />
<short value="The patient who is or was taking the medication." />
<definition value="The person who is/was taking the medication." />
<type>
<code value="Reference" />
<targetProfile value="http://fhir.health.nsw.gov.au/fhir/ehealth/itoc/v1.0/StructureDefinition/nswhealthitocpatient" />
</type>
</element>
</differential>
</StructureDefinition>
Tim Blake (Dec 19 2019 at 04:35):
@Grahame Grieve The slicing is present on the profile from which I derive (AU Base MediciationStatement). Does it need to be repeated in this derived profile?
Richard Townley-O'Neill (Dec 19 2019 at 06:44):
@Tim Blake
MedicationStatement.category short and definition have instances of " in their values.
Tim Blake (Dec 19 2019 at 06:52):
I think that was Zulip. The original has "
Tim Blake (Dec 19 2019 at 06:52):
& quot;
Richard Townley-O'Neill (Dec 19 2019 at 08:08):
Strange.
Tim Blake (Dec 19 2019 at 08:11):
It used to build fine until some recent IG publisher changes. I need some help @Grahame Grieve Do you want the link to the GitHub repo?
Grahame Grieve (Dec 19 2019 at 08:15):
sure
Tim Blake (Dec 19 2019 at 08:43):
https://github.com/timblake78/nsw-health-itoc
Grahame Grieve (Dec 19 2019 at 10:52):
carumba that was a subtle one - a bug in the snapshot generator. I'm releasing a new IGPublisher
Tim Blake (Dec 19 2019 at 20:56):
Thanks, I’ll test shortly.
Tim Blake (Dec 19 2019 at 22:08):
carumba that was a subtle one - a bug in the snapshot generator. I'm releasing a new IGPublisher
Just keeping you on your toes @Grahame Grieve Thanks, builds successfully now...
Chris Moesel (Feb 10 2020 at 14:43):
A SUSHI user has reported a similar (but different) issue to us here. In short, they are profiling a profile -- and more specifically, constraining an existing slice in the base profile. SUSHI puts the specific constraint in the differential, but does not put the sliceName
property in the differential (since it is not, in fact, different from the parent -- and our basic approach is to only put things that are actually different in the differential). Unfortunately, this causes the IG Publisher to crash. The SUSHI user reports that they think the sliceName
needs to be included in the differential -- and that relying on the id
to identify the existing slice in the parent is not enough for the publisher. I couldn't find documentation around this, so just wanted to confirm before we adjust SUSHI to always spit out a sliceName
element/property in the differential when constraining an existing slice.
Lloyd McKenzie (Feb 10 2020 at 14:59):
Correct. The tooling does not drive off the id
Chris Moesel (Feb 10 2020 at 15:18):
So is it sequence-based? In other words, going back to the sliceName
example -- if the tooling sees a sliceName
in a differential element, then does it just assume that all sequentially following elements with a child path are in that slice -- until it gets to a non-child element (at which point the slicename context is cleared or reset to the next slicename if it's there)?
Lloyd McKenzie (Feb 10 2020 at 15:49):
Correct. (It doesn't assume - that's a rule.)
Grahame Grieve (Feb 10 2020 at 19:54):
Lloyd is right, but I don't think it's documented well enough at the moment. There's a task to fix that up somewhere
Last updated: Apr 12 2022 at 19:14 UTC