FHIR / sushi

SUSHI (aka "SUSHI Unshortens Short Hand Inputs") is a reference implementation command-line interpreter/compiler for FHIR Shorthand (FSH).
Apache License 2.0
145 stars 44 forks source link

SUSHI MappingExporter does not consider Mapping rules when merging mappings #1501

Closed cmoesel closed 3 weeks ago

cmoesel commented 1 month ago

When authors define a Mapping, SUSHI attempts to merge the mapping into the set of existing mappings based on the Mapping's declared Id: (and FHIR mapping's identity), additionally checking its Title: and Target: values for conflicts (with FHIR mapping's name and uri respectfully). I.e.

const matchingParentMapping = parent?.mapping?.find(
  (m: StructureDefinitionMapping) => m.identity === fshDefinition.id
);
if (matchingParentMapping != null) {
  const isMatchingTitle = fshDefinition.title
    ? fshDefinition.title === matchingParentMapping.name
    : true;
  const isMatchingTarget = fshDefinition.target
    ? fshDefinition.target === matchingParentMapping.uri
    : true;
  // ... more code using isMatchingTitle and isMatchingTarget values...
}

Now that FSH 3.0 supports rules, the identity, name, and uri, could be set via rules (not just keywords), so we should be checking those as well. And just to make it even more fun, don't forget that rules could be added using RuleSets!

jafeltra commented 3 weeks ago

FSH 3.0 actually doesn't support AssignmentRules on Mappings, so this issue isn't applicable.