FHIR Chat · slice cardinalities · shorthand

Stream: shorthand

Topic: slice cardinalities


view this post on Zulip Craig Newman (May 19 2020 at 15:57):

I'm trying to create slices on MessageHeader.focus to point to a couple of profiles in my IG and I've got the .fsh file looking like this (which I think is correct):

  • focus ^slicing.discriminator.type = #pattern
  • focus ^slicing.discriminator.path = "reference"
  • focus ^slicing.rules = #open
  • focus ^slicing.ordered = false
  • focus ^slicing.description = "Focus Resource types"
  • focus contains BDRPatient 1..1
  • focus[BDRPatient] only Reference(BDRPatient)
  • focus contains BDRReportableDiagnosis 1..*
  • focus[BDRReportableDiagnosis] only Reference(BDRReportableDiagnosis)

However, the IG ends up looking like this, where the overall cardinality of .focus is correct (2..*) but the cardinality of second slice is wrong:
slice.jpg

view this post on Zulip Craig Newman (May 19 2020 at 15:57):

Looking at the StructureDefinition, it seems to be missing the cardinality on the second slice
{
"id": "MessageHeader.focus",
"path": "MessageHeader.focus",
"slicing": {
"discriminator": [
{
"type": "pattern",
"path": "reference"
}
],
"rules": "open",
"ordered": false,
"description": "Focus Resource types"
},
"min": 2
},
{
"id": "MessageHeader.focus:BDRPatient",
"path": "MessageHeader.focus",
"sliceName": "BDRPatient",
"min": 1,
"max": "1",
"type": [
{
"code": "Reference",
"targetProfile": [
"http://hl7.org/fhir/us/birthdefectreporting/StructureDefinition/bdr-patient"
]
}
]
},
{
"id": "MessageHeader.focus:BDRReportableDiagnosis",
"path": "MessageHeader.focus",
"sliceName": "BDRReportableDiagnosis",
"type": [
{
"code": "Reference",
"targetProfile": [
"http://hl7.org/fhir/us/birthdefectreporting/StructureDefinition/bdr-reportablediagnosis"
]
}
]
}
]
}
}

view this post on Zulip Craig Newman (May 19 2020 at 15:58):

Have I messed up the .fsh file or is there maybe a problem in converting it to a StructureDefinition?

view this post on Zulip Lloyd McKenzie (May 19 2020 at 16:02):

Orthogonal from the FSH question: Normally, the focus would just point to the Condition - the Patient would hang off the Condition and not be a focus. What is your event?

view this post on Zulip Craig Newman (May 19 2020 at 16:05):

The event is submission of a birth defect report to a jurisdictional program. There may be multiple reportable birth defect diagnoses in a message bundle but only a single patient. If the patient shouldn't be a focus, I can remove it. I just always think of the patient as central as well in a case like this.

view this post on Zulip Lloyd McKenzie (May 19 2020 at 16:22):

In an ADT message for a patient admit, the only focus would be the Encounter - even though you're probably sending 100+ resources. Everything else is just linked somehow to that encounter (possibly through other resources). Being 'important' has nothing to do with being a focus. It's "is this the focus of the event code".

view this post on Zulip Chris Moesel (May 19 2020 at 16:41):

@Craig Newman - I don't know why the cardinality is getting dropped on the 2nd slice. That looks like a bug in the SUSHI generation of the profile to me. We'll have to try to reproduce this on our end.

I'll add my own orthogonal comment as well -- I'm not sure that the discriminator is correct. I think it may be more appropriate for the discriminator type to be type and the path to be $this.resolve(). See: http://hl7.org/fhir/R4/profiling.html#discriminator

view this post on Zulip Nick Freiter (May 19 2020 at 16:42):

When using the contains, the more standard usage is to do:

* focus contains BDRPatient 1..1 and BDRReportableDiagnosis 1..*

instead of:

* focus contains BDRPatient 1..1
* focus contains BDRReportableDiagnosis 1..*

However, I don't believe we have explicitly disallowed the second usage, so that should work correctly. So this is a bug, but for now using the first syntax shown will give you a workaround to that bug.

view this post on Zulip Craig Newman (May 19 2020 at 16:45):

Thanks for the feedback. Given Lloyd's advice to limit .focus to the Condition, my original question is probably moot. I think now, rather than slicing, I can just restrict .focus to the reportable diagnosis profile Condition. Does this seem right?

  • focus only Reference(<Condition Profile>)

view this post on Zulip Chris Moesel (May 19 2020 at 16:46):

Yep -- that would work! I'm glad we had this conversation though -- you uncovered a bug for us! Thanks!

view this post on Zulip Nick Freiter (May 19 2020 at 16:47):

And just for completeness, that bug is logged here: https://github.com/FHIR/sushi/issues/450.

view this post on Zulip Craig Newman (May 19 2020 at 16:48):

I like to break things. I've been the idiot in many idiot-proofing activities. :slight_smile:
Thanks for the quick feedback

view this post on Zulip David Hay (May 19 2020 at 19:32):

I've been the idiot in many idiot-proofing activities.

I can empathise with that!

view this post on Zulip Gaurav Sharma (May 21 2020 at 22:00):

Profile: PatientDataBundle
Parent: Bundle
Id: PatientDataBundle

I am trying to create a slice based on fullUrl for which I cannot fix the value or pattern. When trying validate the structure definition. I am getting error as below.
SingleValidationMessage[col=452,row=1,locationString=Parameters.parameter[0].resource.entry[0],message=Could not match discriminator ([fullUrl]) for slice Bundle.entry:Organization in profile http://labcorp.com/fhir/lvs-er/StructureDefinition/PatientDataBundle - the discriminator [fullUrl] does not have fixed value, binding or existence assertions,severity=error]

Title: "PatientDataBundle"
Description: "Bundle for Patient Data that is a parameter within Input"

  • type = #collection
  • entry ^slicing.discriminator.type = #value
  • entry ^slicing.discriminator.path = "fullUrl"
  • entry ^slicing.rules = #open
  • entry ^slicing.ordered = false // can be omitted, since false is the default
  • entry ^slicing.description = "Slice based on the entry.fullUrl pattern" // optional
  • entry contains
    Organization 1..* and
    Practitioner 1..* and
    Patient 1..1 and
    ServiceRequest 1..1 and
    Encounter 1..* and
    DiagnosticReport 1..* and
    Observation 1..*

view this post on Zulip Gaurav Sharma (May 21 2020 at 23:11):

Gaurav Sharma said:

Profile: PatientDataBundle
Parent: Bundle
Id: PatientDataBundle

I am trying to create a slice based on fullUrl for which I cannot fix the value or pattern. When trying validate the structure definition. I am getting error as below.
SingleValidationMessage[col=452,row=1,locationString=Parameters.parameter[0].resource.entry[0],message=Could not match discriminator ([fullUrl]) for slice Bundle.entry:Organization in profile http://labcorp.com/fhir/lvs-er/StructureDefinition/PatientDataBundle - the discriminator [fullUrl] does not have fixed value, binding or existence assertions,severity=error]

Title: "PatientDataBundle"
Description: "Bundle for Patient Data that is a parameter within Input"

  • type = #collection
  • entry ^slicing.discriminator.type = #value
  • entry ^slicing.discriminator.path = "fullUrl"
  • entry ^slicing.rules = #open
  • entry ^slicing.ordered = false // can be omitted, since false is the default
  • entry ^slicing.description = "Slice based on the entry.fullUrl pattern" // optional
  • entry contains
    Organization 1..* and
    Practitioner 1..* and
    Patient 1..1 and
    ServiceRequest 1..1 and
    Encounter 1..* and
    DiagnosticReport 1..* and
    Observation 1..*

My bad was trying to do wrong slicing. Changing to following worked fine.

Profile: PatientDataBundle
Parent: Bundle
Id: PatientDataBundle
Title: "PatientDataBundle"
Description: "Bundle for Patient Data that is a parameter within Input"

  • type = #collection
  • entry ^slicing.discriminator.type = #type
  • entry ^slicing.discriminator.path = "resource"
  • entry ^slicing.rules = #open
  • entry ^slicing.ordered = false // can be omitted, since false is the default
  • entry ^slicing.description = "Slice based on the entry.fullUrl pattern" // optional
  • entry contains
    Organization 1..* and
    Practitioner 1..* and
    Patient 1..1 and
    ServiceRequest 1..1 and
    Encounter 1..* and
    DiagnosticReport 1..* and
    Observation 1..*

  • entry[Organization].resource only Organization

  • entry[Practitioner].resource only Practitioner
  • entry[Patient].resource only Patient
  • entry[ServiceRequest].resource only ServiceRequest
  • entry[Encounter].resource only Encounter
  • entry[DiagnosticReport].resource only DiagnosticReport
  • entry[Observation].resource only Observation

Last updated: Apr 12 2022 at 19:14 UTC