FHIR Chat · Underscore vs. Dash · shorthand

Stream: shorthand

Topic: Underscore vs. Dash


view this post on Zulip Matt Rouhana (Nov 04 2021 at 20:53):

It seems that you can use an underscore character (_) in logical model element names, SUSHI converts these to dashes/hyphens (-) if you try to profile the logical model reference the element. Is this intentional?

view this post on Zulip Nick Freiter (Nov 04 2021 at 20:58):

I'm having trouble imagining exactly what you're describing, could you give an example?

view this post on Zulip Matt Rouhana (Nov 05 2021 at 01:19):

I'm defining a logical model (Logical) in FSH. One of the elements looks like this:

* _source 1..1 code "A value representing the source of the data captured within this record"

When I run SUSHI, this shows up correctly in the corresponding StructureDefinition:

      {
        "id": "my-logical-model._source",
        "path": "my-logical-model._source",
        "short": "A value representing the source of the data captured within this record",
        "definition": "A value representing the source of the data captured within this record",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "code"
          }
        ]
      },

However, when I profile the logical model:

* _source MS

The corresponding StructureDefinition changes the _ to a -:

      {
        "id": "my-logical-model.-source",
        "path": "my-logical-model.-source",
        "mustSupport": true
      },

This causes all sorts of weirdness when rendering an IG, as it looks like the element isn't defined in the parent.

view this post on Zulip Stephen MacVicar (Nov 05 2021 at 12:28):

Underscores are not allowed in ids. https://www.hl7.org/fhir/datatypes.html#id

view this post on Zulip Matt Rouhana (Nov 05 2021 at 13:13):

Thanks @Stephen MacVicar - I think SUSHI should throw a warning about this rather than silently changing the character. I'll add an issue in GitHub.

view this post on Zulip John Silva (Nov 05 2021 at 17:00):

I ran into the underscore problem with some of the DaVinci profiles; hopefully they have been fixed to not use underscores.

view this post on Zulip Chris Moesel (Nov 09 2021 at 13:56):

@Matt Rouhana -- I agree. SUSHI needs to warn in these cases. It's also inconsistent that SUSHI actually allows the underscore in the logical definition but transforms it in the profile. I was about to log an issue for this, but see that you already did (SUSHI#950)! Thanks!

view this post on Zulip Mint Thompson (Dec 14 2021 at 17:04):

I've done some investigation on this issue, and here's what I can report:

  • This behavior does not appear to occur in recent versions of SUSHI. FSH Online is currently using SUSHI v2.2.1. The example used to demonstrate this is https://fshschool.org/FSHOnline/#/share/3IRjku7
  • Underscores are not allowed in elements of type id, but ElementDefinition.id, which is inherited from Element, is string type, and there are no listed restrictions on _ in Element.id.
  • ElementDefinition.path contains the name of the element. _ is not in the list of prohibited characters for ElementDefinition.path: https://hl7.org/fhir/elementdefinition.html#path
    Therefore, the behavior as of SUSHI v2.2.1 seems to be in compliance with the specifications, and since _ are no longer being changed to -, there is no longer an inconsistency in the id and path. Please let me know if there is some additional detail about this scenario that I have not considered. Otherwise, I think that there is nothing that needs to change in SUSHI.

Last updated: Apr 12 2022 at 19:14 UTC