Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Server Side] Add the Practitioner Details Fetch endpoint #853

Closed
6 tasks done
dubdabasoduba opened this issue Dec 8, 2021 · 9 comments · Fixed by opensrp/hapi-fhir-opensrp-extensions#24 or opensrp/hapi-fhir-jpaserver-starter#40

Comments

@dubdabasoduba
Copy link
Member

dubdabasoduba commented Dec 8, 2021

Is your feature request related to a problem? Please describe.

  • We would like to be able to get all the practitioners' details which include things like ROLEs, Demographic information & any FHIR resources (e.g teams, care teams e.t.c) associated with the logged-in user.

Describe the solution you'd like

  • Add a practitioner details fetch endpoint. The endpoint is to be named /practitioner-details/{keycloak-uuid} , the method is aGET
  • The following items should be returned by the endpoint response.
    • Practitioner ROLEs & Practitioner demographics from keycloak.
      • Currently you could get the keycloak id by checking the secondary identifier in the Practitioner object.
{
	"resourceType": "Practitioner",
	"identifier": [
	  	{
			"use": "official",
			"value": "ce2e430b-64be-477e-9d86-b36c666c0211" --- Auto generated same as the uuid
		},
		{
			"use": "secondary",
			"value": "287aff05-ff9b-4b07-b525-8860c70377d0" --- User id from keycloak
		}
	],
	"active": true, --- use the enabled values. true for yes & false for no
	"name": [
		{
			"use": "official", -- use as is
			"family": "Williams", --- last name
			"given": [
				"Ward", --- middle name
				"N" -- last name
			]
		}
	],
	"telecom": [
		{
			"system": "email", --- use as is 
			"value": "[email protected]" --- email collected 
		}
	]
}
  • FHIR related data points
    • Fetch all the care teams a practitioner is added to.
    • Fetch all the organizations a practitioner is assigned to this is using the practitioner roles.
    • Using the Organisation affiliation get the locations a practitioner is assigned to.
    • The location hierarchy for the location the practitioner is assigned to.

Sample endpoint calls to fetch the data.

Additional context

@dubdabasoduba dubdabasoduba changed the title [Server Side] Add the Practitioner Fetch endpoint [Server Side] Add the Practitioner Details Fetch endpoint Dec 8, 2021
@pld
Copy link
Member

pld commented Dec 13, 2021

Suppose I'm a supervisor app and I need the details on the HCWs I'm managing to show them in a list, see their assigned tasks, maybe modify assignments or details.

How would I get the details for a set of practitioners?

@rehammuzzamil
Copy link

As per our discussion @dubdabasoduba , a practitioner can be assigned to several organizations/teams at a time, which in return can cause a practitioner to be tied up to numerous locations. Therefore, we will keep the provision of multiple location hierarchies in the response payload.
cc : @f-odhiambo @RaaziaTarique

@pld
Copy link
Member

pld commented Jan 7, 2022

Suppose I'm a supervisor app and I need the details on the HCWs I'm managing to show them in a list, see their assigned tasks, maybe modify assignments or details.

How would I get the details for a set of practitioners?

any comment on this?

@rehammuzzamil
Copy link

Suppose I'm a supervisor app and I need the details on the HCWs I'm managing to show them in a list, see their assigned tasks, maybe modify assignments or details.
How would I get the details for a set of practitioners?

any comment on this?

Apologies @pld for missing your prior comment.
Yes, I believe that in this instance, we need to update API to return a list of practitioners (together with their assigned tasks) that the supervisor is in charge of. Currently, the scope of the practitioner-details end-point does not contain this, but we can perform some research and development on it.
We can also change the API contract (signature) to only deliver a set of practitioner details if the request parameters specify that the user is a "supervisor."

Wrt the modification of assignments and details, this would require a separate POST end-point.
cc : @dubdabasoduba Please share your thoughts.

@pld
Copy link
Member

pld commented Jan 7, 2022

No worries, ok that sounds good! As you've explained, based on the way the APIs are scoped this is not relevant to the work we're doing towards this specific issue, that makes sense to me, thanks!

@f-odhiambo
Copy link
Contributor

@rehammuzzamil Do we have a PR for this work ? What's the status?

@rehammuzzamil
Copy link

@rehammuzzamil Do we have a PR for this work ? What's the status?

Yes @f-odhiambo , the following three PRs are for the practitioner details end-point.

  1. https://github.com/opensrp/fhir-common-utils/pull/1/files
  2. 853 : Expose Practitioners Detail Endpoint hapi-fhir-opensrp-extensions#12
  3. https://github.com/opensrp/hapi-fhir-jpaserver-starter/pull/24/files

There is one pre-requisite PR on JPA Server to bump up HAPI FHIR Versions to mitigate log4j vulnerabilities. It is failing CI as there were a few changes done on the HAPI version >= 5.6.0 and refactoring were not done on the JPA project. Therefore, it is a kind of a blocker (from the HAPI side) to merge this opened PR.

As per my suggestion shared with @dubdabasoduba , we can merge our Practitioner Details end-point opened PRs and let the version upgrade one in the backlog to fix it later.
cc : @dubdabasoduba

@f-odhiambo
Copy link
Contributor

Updated by @rehammuzzamil on Mar 22nd

Practitioner Details End-point:

  • I have re-tested the flow on my local, and it works completely fine.
  • To further debug the API, I have pointed Keycloak configurations to the Stage Keycloak server and it worked fine.
  • I also requested Ben to share Stage HAPI DB Creds but I am unable to access the stage database from my machine. Tried connecting via IDE/SSH both does not work, also tried to make a connection directly via code, but it also fails.
    psql: error: connection to server at "postgres.opensrp-shared-stage.smartregister.org" (34.251.85.94), port 5432 failed: Connection timed out
    Is the server running on that host and accepting TCP/IP connections?
    and
    org.postgresql.util.PSQLException: The connection attempt failed.
  • As per discussion with Ben, it's because I am not authorized to access ONA servers. Shared IP for whitelisting

@rehammuzzamil
Copy link

Brief Updates as of 13th July, 2022:

  • Testing out by pointing my local server to the FHIR Stage DB (IP got whitelisted earlier)
  • Explored high-level advanced search features.
  • Implemented advanced search to fetch OrganizationAffiliation and Locations within a single search call, this helped us to reduce the count of searches in our Rest API by 1.
  • Observed that one more search call can be reduced by implementing advanced search on fetching of Practitioner Roles and Organizations in a single call (Under development/testing)
  • Fetching of care teams takes quite a long to complete (Bottleneck)
  • Raw/Draft PR link https://github.com/opensrp/hapi-fhir-opensrp-extensions/pull/24/files (will update)

cc : @f-odhiambo @dubdabasoduba @ageryck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment