Closed Wambere closed 6 months ago
FHIR version
{
"resourceType": "Practitioner",
"id": "7449181a-9472-eeaa-9b3c-e76d3de32d24",
"identifier": [
{
"use": "official",
"value": "7449181a-9472-eeaa-9b3c-e76d3de32d24"
},
{
"use": "secondary",
"type": {
"coding": [
{
"system": "http://hl7.org/fhir/identifier-type",
"code": "KUID",
"display": "Keycloak user ID"
}
],
"text": "Keycloak user ID"
},
"value": "2d43b35e-cece-4c81-a5f4-3132a808463d"
}
],
"active": true,
"name": [
{
"use": "official",
"family": "Doe",
"given": [
"John",
"N"
]
}
],
"telecom": [
{
"system": "phone",
"value": "800-651-2242",
"use": "home"
},
{
"system": "email",
"value": "john.doe@example.com"
}
],
"address": [
{
"use": "home",
"line": [
"27 South Ave"
],
"city": "Tulsa",
"state": "OK",
"postalCode": "74126",
"country": "USA"
}
],
"gender": "male"
}
{
"resource": {
"resourceType": "PractitionerRole",
"id": "430",
"active": true,
"practitioner": {
"reference": "Practitioner/7449181a-9472-eeaa-9b3c-e76d3de32d24",
"display": "John Doe"
},
"organization": {
"reference": "Organization/578c4814-ca77-4e1a-b8a1-b734e0b8c3ed",
"display": "Team A"
},
"code": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/practitioner-role",
"display": "Community Health Worker"
}
]
}
]
}
}
@dubdabasoduba please assist with filling in the above
After a meeting discussion we realized that we do not need to do this any more, we can just map the opensrp 1.0 data into the already existing user creation csv here
Re-opening this to track the mapping of values from opensrp 1 to the current existing csv
Mapping to current location csv json payload this maps to for context
Column | Source |
---|---|
FirstName | split_part(name,' ',1) |
LastName | split_part(name,' ',2) + split_part(name,' ',3) |
Username | username |
?? | |
id | user_id |
UserType | ?? |
EnableUser | active |
KeycloakGroupID | ?? |
KeycloakGroupName | ?? |
ApplicationID | ?? |
Password | ?? |
Leaving these all empty because I think it makes sense to pull from the users endpoint instead of the practitioners if this information is available there. So pending until we can get data from there
cc @dubdabasoduba @ageryck @AnnieMungai
current fhir resource generated from web;
{
"resourceType": "Practitioner",
"id": "8d9a8364-2dfd-4f30-bdd2-c47e2d821a0a",
"meta": {
"versionId": "1",
"lastUpdated": "2024-03-06T06:57:39.798+00:00",
"source": "#c67c16120b33e790"
},
"identifier": [
{
"use": "official",
"value": "8d9a8364-2dfd-4f30-bdd2-c47e2d821a0a"
},
{
"use": "secondary",
"value": "e15ee5c5-871a-4043-996a-bc3eeefe019a"
}
],
"active": true,
"name": [
{
"use": "official",
"family": "Practitioner",
"given": [
"Importer"
]
}
],
"telecom": [
{
"system": "email",
"value": "test@importer.org"
}
]
}
Sample CSV Export Query from team.practitioner
COPY (SELECT split_part(name,' ',1) AS FirstName, split_part(name,' ',2) || ' ' || split_part(name,' ',3) AS LastName, username,
null as Email, user_id as id, null as UserType, active as EnableUser, null as KeycloakGroupID, null as KeycloakGroupName, 'eusm' as ApplicationID, null as Password
FROM team.practitioner; ) To 'PATH/test.csv' With CSV DELIMITER ',' HEADER
team.practitioner does not have email
Sample CSV Export Query from team.organization
COPY (SELECT name, active, 'update' as method, identifier as id, identifier, 'Health Org' as alias FROM team.organization) To 'PATH/test.csv' With CSV DELIMITER ',' HEADER
sample CSV Export Query from core.location_metadata
SELECT 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,
null as Type, null as TypeCode, null as physicalType, null as physicalTypeCode from core.location_metadata a
Org to Location Sample Query
SELECT b.name, b.identifier, c.name, c.geojson_id
FROM team.organization_location a INNER JOIN team.organization b ON a.organization_id=b.id INNER JOIN core.location_metadata c ON a.location_id=c.id
Mapping to current location csv json payload this maps to for context
Column Source FirstName
split_part(name,' ',1)
LastNamesplit_part(name,' ',2)
+split_part(name,' ',3)
Username username Email ?? id user_id UserType ?? EnableUser active KeycloakGroupID ?? KeycloakGroupName ?? ApplicationID ?? Password ?? Leaving these all empty because I think it makes sense to pull from the users endpoint instead of the practitioners if this information is available there. So pending until we can get data from therecc @dubdabasoduba @ageryck @AnnieMungai
@Wambere we may need to update the payload to read values for "active": true
since there could exists some users that are false intentionally
@ageryck good catch 👍🏾
Where should we apply this change? Practitioner, Practitioner Role, Group, or all three?
@ageryck good catch 👍🏾
Where should we apply this change? Practitioner, Practitioner Role, Group, or all three?
I want to say all three however I need @peterMuriuki to confirm web client behavior that will be used to manage these after import if re-activating the practitioner re-activates all of the other resources.
a change in the active status of a keycloak user is synced to the associated fhir resources: Group, practitioner, and practitionerRole.
tested ok
Current structure from opensrp 1.0
From https://example.smartregister.org/opensrp/rest/practitioner
From https://example.smartregister.org/opensrp/rest/practitionerRole
I couldn't get any users from https://example.smartregister.org/opensrp/rest/user?page_size=10&source=OpenMRS&start_index=0