IHTSDO / snowstorm

Scalable SNOMED CT Terminology Server using Elasticsearch
Other
204 stars 80 forks source link

Help with creating new refset types #284

Open hurtigcodes opened 3 years ago

hurtigcodes commented 3 years ago

Hi, We're trying to establish a new refset with custom attributes for our national extension.

I've created a complex map and a simple map.

In summary:

Steps

Created refset concepts and loaded into Snowstorm on branch in module 51000202101:

{
      "conceptId": "2041000202101",
      "fsn": {
        "term": "SNOMED CT to ATC complex map (foundation metadata concept)",
        "lang": "en"
      },
      "pt": {
        "term": "SNOMED CT til ATC kompleks map",
        "lang": "no"
      },
      "active": true,
      "effectiveTime": "20201015",
      "released": true,
      "releasedEffectiveTime": 20201015,
      "moduleId": "51000202101",
      "definitionStatus": "PRIMITIVE",
      "descriptions": [
        {
          "active": true,
          "moduleId": "51000202101",
          "released": true,
          "releasedEffectiveTime": 20201015,
          "descriptionId": "735281000202117",
          "term": "SNOMED CT to ATC complex map (foundation metadata concept)",
          "conceptId": "2041000202101",
          "typeId": "900000000000003001",
          "acceptabilityMap": {
            "900000000000509007": "PREFERRED"
          },
          "type": "FSN",
          "caseSignificance": "ENTIRE_TERM_CASE_SENSITIVE",
          "lang": "en",
          "effectiveTime": "20201015"
        },
        {
          "active": true,
          "moduleId": "51000202101",
          "released": true,
          "releasedEffectiveTime": 20201015,
          "descriptionId": "735291000202115",
          "term": "SNOMED CT to ATC complex map",
          "conceptId": "2041000202101",
          "typeId": "900000000000013009",
          "acceptabilityMap": {
            "900000000000509007": "PREFERRED"
          },
          "type": "SYNONYM",
          "caseSignificance": "ENTIRE_TERM_CASE_SENSITIVE",
          "lang": "en",
          "effectiveTime": "20201015"
        },
        {
          "active": true,
          "moduleId": "51000202101",
          "released": true,
          "releasedEffectiveTime": 20201015,
          "descriptionId": "735301000202116",
          "term": "SNOMED CT til ATC kompleks map",
          "conceptId": "2041000202101",
          "typeId": "900000000000013009",
          "acceptabilityMap": {
            "61000202103": "PREFERRED"
          },
          "type": "SYNONYM",
          "caseSignificance": "ENTIRE_TERM_CASE_SENSITIVE",
          "lang": "no",
          "effectiveTime": "20201015"
        }
      ],
      "classAxioms": [
        {
          "axiomId": "e0b46527-0fd0-4c76-8d39-f8e7c0e5431a",
          "moduleId": "51000202101",
          "active": true,
          "released": true,
          "definitionStatusId": "900000000000074008",
          "relationships": [
            {
              "active": true,
              "moduleId": "900000000000207008",
              "released": false,
              "sourceId": "2041000202101",
              "destinationId": "1231000202105",
              "typeId": "116680003",
              "type": {
                "conceptId": "116680003",
                "definitionStatus": "PRIMITIVE",
                "moduleId": "900000000000012004",
                "fsn": {
                  "term": "Is a (attribute)",
                  "lang": "en"
                },
                "pt": {
                  "term": "Is a",
                  "lang": "en"
                },
                "id": "116680003"
              },
              "target": {
                "conceptId": "1231000202105",
                "definitionStatus": "PRIMITIVE",
                "moduleId": "51000202101",
                "fsn": {
                  "term": "Norwegian national reference set (foundation metadata concept)",
                  "lang": "en"
                },
                "pt": {
                  "term": "Norske nasjonale referansesett",
                  "lang": "no"
                },
                "id": "1231000202105"
              },
              "groupId": 0,
              "characteristicType": "STATED_RELATIONSHIP",
              "modifier": "EXISTENTIAL"
            },
            {
              "active": true,
              "moduleId": "900000000000207008",
              "released": false,
              "sourceId": "2041000202101",
              "destinationId": "447250001",
              "typeId": "116680003",
              "type": {
                "conceptId": "116680003",
                "definitionStatus": "PRIMITIVE",
                "moduleId": "900000000000012004",
                "fsn": {
                  "term": "Is a (attribute)",
                  "lang": "en"
                },
                "pt": {
                  "term": "Is a",
                  "lang": "en"
                },
                "id": "116680003"
              },
              "target": {
                "conceptId": "447250001",
                "definitionStatus": "PRIMITIVE",
                "moduleId": "900000000000012004",
                "fsn": {
                  "term": "Complex map type reference set (foundation metadata concept)",
                  "lang": "en"
                },
                "pt": {
                  "term": "Complex map type reference set",
                  "lang": "en"
                },
                "id": "447250001"
              },
              "groupId": 0,
              "characteristicType": "STATED_RELATIONSHIP",
              "modifier": "EXISTENTIAL"
            }
          ],
          "definitionStatus": "PRIMITIVE",
          "id": "e0b46527-0fd0-4c76-8d39-f8e7c0e5431a",
          "effectiveTime": 20201015
        }
      ],
      "gciAxioms": [],
      "relationships": [
        {
          "active": true,
          "moduleId": "51000202101",
          "released": true,
          "releasedEffectiveTime": 20201015,
          "relationshipId": "8791000202120",
          "sourceId": "2041000202101",
          "destinationId": "447250001",
          "typeId": "116680003",
          "type": {
            "conceptId": "116680003",
            "definitionStatus": "PRIMITIVE",
            "moduleId": "900000000000012004",
            "fsn": {
              "term": "Is a (attribute)",
              "lang": "en"
            },
            "pt": {
              "term": "Is a",
              "lang": "en"
            },
            "id": "116680003"
          },
          "target": {
            "conceptId": "447250001",
            "definitionStatus": "PRIMITIVE",
            "moduleId": "900000000000012004",
            "fsn": {
              "term": "Complex map type reference set (foundation metadata concept)",
              "lang": "en"
            },
            "pt": {
              "term": "Complex map type reference set",
              "lang": "en"
            },
            "id": "447250001"
          },
          "groupId": 0,
          "characteristicType": "INFERRED_RELATIONSHIP",
          "modifier": "EXISTENTIAL",
          "effectiveTime": "20201015",
          "id": "8791000202120"
        },
        {
          "active": true,
          "moduleId": "51000202101",
          "released": true,
          "releasedEffectiveTime": 20201015,
          "relationshipId": "8801000202124",
          "sourceId": "2041000202101",
          "destinationId": "1231000202105",
          "typeId": "116680003",
          "type": {
            "conceptId": "116680003",
            "definitionStatus": "PRIMITIVE",
            "moduleId": "900000000000012004",
            "fsn": {
              "term": "Is a (attribute)",
              "lang": "en"
            },
            "pt": {
              "term": "Is a",
              "lang": "en"
            },
            "id": "116680003"
          },
          "target": {
            "conceptId": "1231000202105",
            "definitionStatus": "PRIMITIVE",
            "moduleId": "51000202101",
            "fsn": {
              "term": "Norwegian national reference set (foundation metadata concept)",
              "lang": "en"
            },
            "pt": {
              "term": "Norske nasjonale referansesett",
              "lang": "no"
            },
            "id": "1231000202105"
          },
          "groupId": 0,
          "characteristicType": "INFERRED_RELATIONSHIP",
          "modifier": "EXISTENTIAL",
          "effectiveTime": "20201015",
          "id": "8801000202124"
        }
      ],
      "validationResults": []
    }

To 'keep it simple' I replicated the same attributes as the ICD-9CMeq refset in application.properties:

refset.types.ATCComplexMap=2041000202101|Map|iisssc|mapGroup,mapPriority,mapRule,mapAdvice,mapTarget,correlationId

(and rebuilt and restarted Snowstorm).

Created a new member in complex map:

{
  "active": true,
  "moduleId": "51000202101",
  "released": false,
  "refsetId": "2041000202101",
  "referencedComponentId": "6910009",
  "additionalFields": {
    "mapRule": "TRUE",
    "mapAdvice": "ALWAYS A01A A01",
    "mapPriority": "1",
    "mapGroup": "1",
    "correlationId": "447557004",
    "mapTarget": "A01A A01"
  }
}

Reading the Release File Spec required me to create members in the Refset Descriptor refset:

id  effectiveTime   active  moduleId    refsetId    referencedComponentId   attributeDescription    attributeType   attributeOrder
aa442a76-3a9c-4a15-9a1d-23392d460064        1   51000202101 900000000000456007  2041000202101   900000000000501005  900000000000478000  1
8560ac73-570d-48d2-a675-1712e8394bc2        1   51000202101 900000000000456007  2041000202101   900000000000502003  900000000000478000  2
70d7ffe7-6c6e-42ae-81b5-006c9092fb49        1   51000202101 900000000000456007  2041000202101   900000000000503008  900000000000465000  3
bff2d231-a69a-4996-aa28-6faf24367490        1   51000202101 900000000000456007  2041000202101   900000000000500006  900000000000461009  0
ee59a20e-8918-427b-8145-194aeff68761        1   51000202101 900000000000456007  2041000202101   900000000000504002  900000000000465000  4
903f1a9e-07cf-49b4-a5d8-e598674ee69c        1   51000202101 900000000000456007  2041000202101   900000000000505001  900000000000465000  5
c07a5097-5ffe-49f2-9bc2-2fda4040ee18        1   51000202101 900000000000456007  2041000202101   447247004   900000000000461009  6

Export params:

{
  "branchPath": "MAIN/SNOMEDCT-NO/MAPS",
  "type": "DELTA",
  "unpromotedChangesOnly": true
}

However, the export doesn't include the refset file as expected... Could use some help here.

Thanks!

kaicode commented 3 years ago

All of this looks good to me. Snowstorm does not currently make use of the Refset Descriptor refset, but good to have that anyway. Please check that the concept which represents the refset 2041000202101 |SNOMED CT to ATC complex map (foundation metadata concept)| is visible on the branch you are exporting from.

hurtigcodes commented 3 years ago

Hi @kaicode, thanks for your advice. I have done some more testing and:

Any thoughts on why this might occur?