b2ihealthcare / snow-owl

:owl: Snow Owl Terminology Server - a production-ready, scalable, FHIR Terminology Service compliant termserver that supports SNOMED CT International and Extensions, LOINC, RxNorm, UMLS, ICD-10, custom code systems and many others
https://docs.b2ihealthcare.com/snow-owl/
Apache License 2.0
256 stars 32 forks source link

Showing the name of a reference set #502

Closed RichardChappell closed 4 years ago

RichardChappell commented 4 years ago

Is it possible to do something like the following to get the name when querying reference sets?

http://localhost:8000/snowowl/snomed-ct/v3/MAIN/refsets?limit=10&refSetTypes=SIMPLE&expand=id(expand(pt()))

The "expand=id(expand(pt()))" follows the model given for getting descriptions for referenced components of refset members

cmark commented 4 years ago

Hi @RichardChappell,

This is not supported at the moment but it would be a great addition to the Refsets API feature set.

In the current version of the API, you can use the Concepts API to get all possible reference sets under the Simple type reference set concept using the ancestor filter or ECL, and get the labels and the refset properties via the expand parameter:

Request:

curl "http://localhost:8080/snowowl/snomed-ct/v3/MAIN/concepts?ecl=%3C446609009&expand=referenceSet()%2Cpt()&limit=50" -H "accept: application/json;charset=UTF-8" -H "Accept-Language: en-US;q=0.8,en-GB;q=0.6"

Response:

   {
      "id": "723264001",
      "released": true,
      "active": true,
      "effectiveTime": "20170131",
      "moduleId": "900000000000012004",
      "iconId": "900000000000455006",
      "definitionStatus": {
        "id": "900000000000074008"
      },
      "subclassDefinitionStatus": "NON_DISJOINT_SUBCLASSES",
      "pt": {
        "id": "3335273019",
        "term": "Lateralizable body structure reference set",
        "concept": {
          "id": "723264001"
        },
        "type": {
          "id": "900000000000013009"
        },
        "typeId": "900000000000013009",
        "conceptId": "723264001",
        "acceptability": {
          "900000000000509007": "PREFERRED"
        }
      },
      "ancestorIds": [
        "138875005",
        "-1",
        "900000000000441003",
        "900000000000455006",
        "900000000000454005"
      ],
      "parentIds": [
        "446609009"
      ],
      "statedAncestorIds": [
        "138875005",
        "-1",
        "900000000000441003",
        "900000000000455006",
        "900000000000454005"
      ],
      "statedParentIds": [
        "446609009"
      ],
      "referenceSet": {
        "id": "723264001",
        "released": true,
        "active": true,
        "effectiveTime": "20170131",
        "moduleId": "900000000000012004",
        "iconId": "900000000000455006",
        "type": "SIMPLE",
        "referencedComponentType": "com.b2international.snowowl.terminology.snomed.concept"
      },
      "definitionStatusId": "900000000000074008"
    },
    ...

This will return all concepts, not just the ones that actually represent a reference set in the current system (have at least one member). You can filter the response by checking the existence of the referenceSet property in the returned concept JSON nodes.

I hope this helps.

Cheers, Mark

RichardChappell commented 4 years ago

Thanks, Mark. I will give it a try