opensrp / fhircore

FHIR Core / OpenSRP 2 is a Kotlin application for delivering offline-capable, mobile-first healthcare project implementations from local community to national and international scale using FHIR and WHO Smart Guidelines on Android.
https://smartregister.org
Apache License 2.0
53 stars 41 forks source link

[Sync Enhancement | Data Access Checker] Data filtering based on the Related Entity Location #3052

Closed dubdabasoduba closed 5 months ago

dubdabasoduba commented 6 months ago

Keyword Definition

Context

Technical Description of enhancement

Acceptance Criteria

Depends On https://github.com/opensrp/fhircore/issues/3053

More information on why we need to make this change

pld commented 6 months ago

I don't think the client should be responsible for constructing the location list, I think the gateway should, that way we reduce the round trips and we have that business logic on the server side, so we can better control it. I.e. the flow is

The logic in the gateway endpoint converts the locations array into a set of locations

dubdabasoduba commented 6 months ago

I don't think the client should be responsible for constructing the location list, I think the gateway should, that way we reduce the round trips and we have that business logic on the server side, so we can better control it. I.e. the flow is

  • Fetch sync locations from the syncLocations param
  • Send sync request to a new gateway endpoint with

    • syncLocations array
    • metaTag to sync on (e.g. practioner-location-at-write-time entity-location-at-write-time)
    • pagination

The logic in the gateway endpoint converts the locations array into a set of locations

@pld that's the idea

The client will only be responsible for sending the syncLocations param. The syncLocation are the locations selected by the user on the app, for microplanning apps or the logged in user assigned location for health workflow apps

The gateway will then be responsible for fetching the other child locations internally

pld commented 6 months ago

OK, that's not clear to me from the technical description in this issue, this reads like the client is doing that, can we move that part of this issue out to an issue in the info gateway repo

ndegwamartin commented 6 months ago

Looks good, a few thoughts

pld commented 6 months ago

Cool I like the exact grant idea, it's unclear what the options are, it seems like they're just

b/c we're not saying anything specific about the sync strategy in the grant, only whether the user has access to all or only their assigned locations and sub-nodes.

dubdabasoduba commented 6 months ago

@pld @ndegwamartin we can use ROLE_ASSIGNED_LOCATIONS

ndegwamartin commented 6 months ago

@pld @dubdabasoduba yeah since the two will be mutually exclusive, we should only pick one of the roles .

For the two options above, I'd go with ROLE_ALL_LOCATIONS because IMO it authorises ability to view all locations (in line with my understanding of roles) rather than ROLE_ASSIGNED_LOCATIONS which acts more as a flag

pld commented 6 months ago

I'm good with that, makes sense