FirelyTeam / firely-net-sdk

The official Firely .NET SDK for HL7 FHIR
Other
823 stars 342 forks source link

[SnapshotGenerator] Change min cardinality of slice intro, depending an min card. of the slices. #1255

Open mmsmits opened 4 years ago

mmsmits commented 4 years ago

Should the snapshot generator change the cardinality of a slice intro?

Example:

<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="obs-1"/>
  <url value="urn:uuid:616632e3-a5b9-4a7d-820d-1119b80f6820"/>
  <name value="Obs1"/>
  <status value="draft"/>
  <description value="fixture for #1: closed slicing on polymorphic"/>
  <kind value="resource"/>
  <abstract value="false"/>
  <type value="Observation"/>
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Observation"/>
  <derivation value="constraint"/>
  <differential>
    <element>
      <path value="Observation.value[x]"/>
      <slicing>
        <rules value="open"/>
      </slicing>
    </element>
    <element>
      <path value="Observation.value[x]"/>
      <sliceName value="valueCodeableConcept"/>
      <min value="1"/>
      <type>  
        <code value="CodeableConcept"/>
      </type>
      <binding>
        <strength value="required"/>
        <valueSet value="http://somewhere/something"/>
      </binding>
    </element>
  </differential>
</StructureDefinition>

Should the slice intro have a min cardinality of 1 in the snapshot?

Test: snapshotmanifest -> obs-4

abelenthoven commented 4 years ago

Just my opinion: In general I would say a snapshot generator does not have the responsibility to repair what is essentially broken. Having said that, however, I think it would be practical if it could give warnings and do repairs at the same time. But only if a broken situation can be interpreted only in 1 way. In the case you describe, I think we can be completely sure this is what the user meant. So in this case I would go for the repair.

mmsmits commented 2 months ago

We could do this, we don't have to give a warning. Just make the snapshot a bit more readable.