onaio / fhir-tooling

A command line utility to support FHIR Core content authoring
Other
1 stars 1 forks source link

EUSM - Add support for importing jurisdictions #155

Closed Wambere closed 3 months ago

Wambere commented 4 months ago

Current jurisdiction structure from opensrp 1.0

From https://example.smartregister.org/opensrp/rest/location/getAll?includeInactive=true&is_jurisdiction=true&limit=10&return_geometry=true&serverVersion=100

{
    "type": "Feature",
    "id": "5fa61353-bbbb-4107-8c5f-79ce95839018",
    "properties": {
        "status": "Active",
        "parentId": "1fec2789-77aa-499d-a28f-fc9e6c354ea5",
        "name": "Sarobaratra Ifanja",
        "geographicLevel": 3,
        "version": 0
    },
    "serverVersion": 17964,
    "locationTags": [
        {
            "id": 4,
            "active": true,
            "name": "Commune",
            "description": "Commune Location Tag"
        }
    ]
}
Wambere commented 4 months ago

FHIR version

{
  "resourceType": "Location",
  "id": "5fa61353-bbbb-4107-8c5f-79ce95839018",
  "identifier": [
    {"use": "official", "value": "5fa61353-bbbb-4107-8c5f-79ce95839018"}
  ],
  "type": {
    "coding": [
      {
        "system" : "http://terminology.hl7.org/CodeSystem/v3-RoleCode",
        "code"   : "??"                                             ,
        "display": "??"
      }
    ]
  },
  "status": "active",
  "name": "Commune",
  "alias": ["??"],
  "description": "Commune Location Tag",
  "physicalType": {
    "coding": [
      {
        "system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
        "code": "jdn",
        "display": "Jurisdiction"
      }
    ]
  },
  "partOf": {
    "reference": "Location/1fec2789-77aa-499d-a28f-fc9e6c354ea5",
    "display": "Sarobaratra Ifanja"
},
  "position": { ?? }
}

@dubdabasoduba please assist in filling in the above

Wambere commented 4 months ago

Mapping to current location csv json payload this maps to for context

Column Source
name properties -> name
status properties -> status
method "create"
id id
parentName ??
parentID properties -> parentId
type "Jurisdiction"
typeCode "jdn"
physicalType ??
physicalTypeCode ??

Still missing = location tags

cc @dubdabasoduba @ageryck @AnnieMungai

ageryck commented 4 months ago

For location tags previously used for identifying location hierarchy are not a requirement in fhircore since we use the parent partOf, do we need import this or leave it out?

ageryck commented 3 months ago
SELECT DISTINCT a.name, a.status, 'udpate' as method, a.geojson_id as id, (select b.name from core.location_metadata b where b.geojson_id=a.parent_id) as parentName, a.parent_id,
'Jurisdiction' as Type, 'jdn' as TypeCode, null as physicalType, null as physicalTypeCode, null as longitude, null as latitude from core.location_metadata a
ageryck commented 3 months ago

tested okay