Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

FHIR R4 Resource - Location

OpenIMIS openIMIS tables - tblHF, tblLocations

Mapping Overview Table

FHIR R4 field

OpenIMIS

openIMIS field

notes

Notes

mapping status

Identifier

identifier

tblHF

tblLocations.

HfId

LocationId /

tblHF.HFCode /

tblLocations.

LocationId

LocationCode / tblLocations.

LocationCodeHfId and HFCode

LocationUUID

FHIR location.mode field is used to switch between mapping from tblHF and tblLocations fields
HfId / LocationId is used as DB Primary Key, while mapping is being done to HFCode / LocationCode by

Reference to FHIR Location from other resources is done through UUID field

mapped

name

tblHF.HFName /

tblLocatons.LocationName

FHIR location.mode field is used to switch between mapping from tblHF and tblLocations fields

HFName mapped

type

tblHF.HFLevel / tblLocations.LocationType

FHIR location.mode field is used to switch between mapping from tblHF and tblLocations fields

changed cardinality from 1 to *

HFLevel mapped

Address

tblHF.HFAddress

mapped

partOfReference

tblHF.LocationId / tblLocations.ParentLocationId

FHIR location.mode field is used to switch between mapping from tblHF and tblLocations fields

not mapped

telecom

tblHF.Phone / tblHF.Fax / tblHF.eMail

telecom field contains values that are being mapped for Phone, Fax and Email fields

mapped

mapped

physicalType

tblLocations.LocationType

type.coding contains one of ['R', ‘D', ‘W’, ‘V’]

type.text is one of ['region', ‘district’, ‘ward’, ‘village’]

mapped

partOf

tblLocations.ParentLocationId → tblLocations.LocationUUID

Reference to the parent location. Regions don’t have a parent.
Composite structure: Region → District → Ward → Village

mapped

Search capabilities

Search by Location/HF Code

You can search a Location on code by using the identifier query parameter:

Code Block
http://localhost:8000/api_fhir_r4/Location?identifier=[LocationCode]

Search by Location Level

You can search all the Locations on level by using the physicaltype query parameter:

Code Block
http://localhost:8000/api_fhir_r4/Location?physicaltype=[R|D|W|V]

Search all the children of a Location

You can search all the Locations based on the parent location by using the partof query parameter:

Code Block
http://localhost:8000/api_fhir_r4/Location?partof=[LocationUUID]

Endpoint specification:

Example of endpoint URL:

http://localhost:8000/api_fhir_R4r4/Location/

Supported HTTP operation:

  • CREATE - used to create new FHIR Location (HF). List of supported fields can be found in the table which shows the mapping between OpenIMIS openIMIS and FHIR. Should be used the POST HTTP method and the body as JSON representation (example can be found below).

    Note:

    • the `offline` model attribute isn't currently covered by the current API. By the default value is False (can be modified by the module configuration).

    • the `care_type` model attribute isn't currently covered by the current API. By the default value is "B" - both (can be modified by the module configuration).

    • the `validity_from` attribute is set as the current value of date when the object is created

    • the `audit_user_id` - the user which interact with the FHIR API is the `TechnicalUser` (Backend security - Models and Concepts) which hasn't representation in tblUsers. That's why the value of the `audit_user_id` attribute is set based on the following algorithm:
      1) Try to get that value from the 'auditUserId' query parameter

      2) If missing get that value then use the value from the module configuration (by default 1)

  • READ - by default return list of all available resources. To fetch information about a specific object you should add the primary key to URL for instance:

    Code Block
    http://localhost:8000/api_fhir_
    R4
    r4/Location/
    1
    [UUID]

    , where "1UUID" is the value of the primary keyLocation UUID field. Should be used the GET HTTP method.

  • UPDATE - update the value of the specific object. List of supported fields can be found in the table which shows the mapping between OpenIMIS openIMIS and FHIR. Should be used the PUT HTTP method and the body as JSON representation (example can be found below). The requested URL needs to point to a specific object to do that you should add the primary key to URL for instance:

    Code Block
    http://localhost:8000/api_fhir_
    R4
    r4/Location/
    1
    [UUID]

    , where "1UUID" is the value of the primary keyLocation UUID field.
    Note:

    • the `offline` model attribute isn't updated

    • the `care_type` model attribute isn't updated

    • the UPDATE operation will update the specific row of the database and doesn't create the history of changes (like in the legacy OpenIMISopenIMIS)

  • DELETE - the operation can be used to remove the specific object from the database. Should be used the DELETE HTTP method. The requested URL needs to point to a specific object to do that you should add the primary key to URL for instance:

    Code Block
    http://localhost:8000/api_fhir_
    R4
    r4/Location/
    1
    [UUID]

    , where "1UUID" is the value of the primary keyLocation UUID field.
    Note:
    - the DELETE operation will permanently remove the row from the database

Module configuration used by the endpoint:

Configuration key

Description

Default value

default_audit_user_id

default value which will be used for 'audit_user_id' field

"default_audit_user_id": 1,

R4_fhir_identifier_type_config

configuration of system and codes used to represent the specific types of identifiers

"R4_fhir_identifier_type_config":{
"system":"https://hl7.org/fhir/valueset-identifier-type.html",
"fhir_code_for_imis_db_uuid_type":"UUID",
"fhir_code_for_imis_db_id_type":"ACSN",
"fhir_code_for_imis_chfid_type":"SB",
"fhir_code_for_imis_passport_type":"PPN",
"fhir_code_for_imis_facility_id_type":"FI",
"fhir_code_for_imis_claim_admin_code_type":"FILL",
"fhir_code_for_imis_claim_code_type":"MR",
"fhir_code_for_imis_location_code_type":"LC",
"fhir_code_for_imis_diagnosis_code_type":"DC",
"fhir_code_for_imis_item_code_type":"IC",
"fhir_code_for_imis_service_code_type":"SC",
},

R4_fhir_location_role_type

configuration of system and codes used to represent the specific types of location role

"R4_fhir_location_role_type":{
"system":"https://hl7.org/fhir/v3/ServiceDeliveryLocationRoleType/vs.html",
"fhir_code_for_hospital":"HOSP",
"fhir_code_for_dispensary":"CSC",
"fhir_code_for_health_center":"PC",
},

R4_fhir_location_physical_type

configurations of system and codes used to represent the specific types of location physical types

"R4_fhir_location_physical_type":{
"system":"https://terminology.hl7.org/CodeSystem/location-physical-type.html",
"fhir_code_for_region":"R",
"fhir_code_for_district":”D",
"fhir_code_for_ward":"W”,
"fhir_code_for_village":"V"
},

default_value_of_location_offline_attribute

default value for 'offline' attribute used for creating new HF object

"default_value_of_location_offline_attribute": False,

default_value_of_location_care_type

default value for 'care_type' attribute used for creating new HF object

"default_value_of_location_care_type": "B"

Example JSON representation of content:

Code Block
languagejson
{

    "resourceType": "Location",
    "
address
id":
{
 "356E8BB4-46C5-4431-8A4B-2DEA60A88282",
    
"
text
identifier":
"HfAddress",
 [
      
"type":"physical",
  {
    
"use":"home"
    
},
    "
identifier
type":
[
 
{
    
{
            "
type
coding":
{
 [
             
"coding":[
       {
          
{
              "code": "UUID",
     
"code":"ACSN",
                   "system": "https://hl7.org/fhir/valueset-identifier-type.html"
                    }
                ]
            },
            "use": "usual",
            "value":
"11"
 "356E8BB4-46C5-4431-8A4B-2DEA60A88282"
        },
        {
            "type": {
                "coding": [
                    {
                        "code": "
FI
LC",
                        "system": "https://hl7.org/fhir/valueset-identifier-type.html"
                    }
            
]
    ]
     
},
       },
  
"use":"usual",
          "
value
use": "
hfcode
usual",
      
}
    
],
  
"
name
value":
"hfName",
 
"
telecom
R1D1"
:[

        
{
}
    ],
    
"
system
name": "
phone
Rapta",

    
"
use
partOf":
"home",
 {
        "
value
reference":
"hfPhone"
 "Location/8ACF51CF-EB6D-44DB-AED5-75412408E791"
    },
{

    
"system
"physicalType":
"fax",
 {
        "
use
coding":
"home",
 [
   
"value":"hfFax"
       
},
  {
    
{
            "
system
code": "
email
D",

      
"use":"home",
          "
value
system":
"hfMail"
 
} ], "type":{
"http://terminology.hl7.org/CodeSystem/location-physical-type.html"
        
"coding":[
    }
       
{
 
],
        
"
code
text":
"PC",
 
"system":"https://hl7.org/fhir/v3/ServiceDeliveryLocationRoleType/vs.html" } ]
"district"
    }
}