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

Error when adding a caret rule to a versioned code in a ValueSet #1492

Closed sebg-mio42 closed 3 months ago

sebg-mio42 commented 3 months ago

Adding a caret rule like a designation to a versioned code in a ValueSet currently causes an error.

For example this FSH ValueSet with a designation for a specific version of SNOMED:

ValueSet: Test
Id: test
Title: "Test"
Description: "test"
* http://snomed.info/sct#182869005 "Drug not taken - patient lost tablets (situation)"
  * ^designation[0].language = #de
  * ^designation[0].value = "Medikament nicht eingenommen wegen Verlust des Arzneimittels"
* http://snomed.info/sct|http://snomed.info/sct/11000274103/version/20240515#182879007 "Medication decreased (finding)"
  * ^designation[0].language = #de
  * ^designation[0].value = "Dosisreduktion" 

This causes the following errors:

error Could not find concept http://snomed.info/sct|http://snomed.info/sct/11000274103/version/20240515#182879007, skipping rule.
  File: ...\input\fsh\vs_test.fsh
  Line: 9
error Could not find concept http://snomed.info/sct|http://snomed.info/sct/11000274103/version/20240515#182879007, skipping rule.
  File: ...\input\fsh\vs_test.fsh
  Line: 10

and the output JSON does not include the designation:

{
  "resourceType": "ValueSet",
  "status": "draft",
  "name": "Test",
  "id": "test",
  "title": "Test",
  "description": "test",
  "url": "http://example.org/ValueSet/test",
  "compose": {
    "include": [
      {
        "system": "http://snomed.info/sct",
        "concept": [
          {
            "code": "182869005",
            "display": "Drug not taken - patient lost tablets (situation)",
            "designation": [
              {
                "language": "de",
                "value": "Medikament nicht eingenommen wegen Verlust des Arzneimittels"
              }
            ]
          }
        ]
      },
      {
        "system": "http://snomed.info/sct",
        "version": "http://snomed.info/sct/11000274103/version/20240515",
        "concept": [
          {
            "code": "182879007",
            "display": "Medication decreased (finding)"
          }
        ]
      }
    ]
  }
}

Expected output would be no errors and the following JSON:

{
  "resourceType": "ValueSet",
  "status": "draft",
  "name": "Test",
  "id": "test",
  "title": "Test",
  "description": "test",
  "url": "http://example.org/ValueSet/test",
  "compose": {
    "include": [
      {
        "system": "http://snomed.info/sct",
        "concept": [
          {
            "code": "182869005",
            "display": "Drug not taken - patient lost tablets (situation)",
            "designation": [
              {
                "language": "de",
                "value": "Medikament nicht eingenommen wegen Verlust des Arzneimittels"
              }
            ]
          }
        ]
      },
      {
        "system": "http://snomed.info/sct",
        "version": "http://snomed.info/sct/11000274103/version/20240515",
        "concept": [
          {
            "code": "182879007",
            "display": "Medication decreased (finding)",
            "designation": [
              {
                "language": "de",
                "value": "Dosisreduktion"
              }
            ]
          }
        ]
      }
    ]
  }
}
cmoesel commented 3 months ago

Thanks for finding and reporting this issue, @sebg-mio42. I've created a FSH Online link that also reproduces it: https://fshschool.org/FSHOnline/#/share/3WomCxu

And I see you've submitted a PR to fix it. That's great! I'll go take a look...