Biophics Team Assignment for generated plans
Biophics Team Assignment
Background
The Biophics holding tables are where the link between a focus and the team (organization in Reveal) that should investigate. When plans (and tasks) are created, the Nifi flow queries the foci_team VIEW and then assigns the plans to the correct organisations
NiFi Workflow
Get the externalID from /location?[jurisdiction id]?is_jurisdiction=true
Get the team name from foci_team table using this query SELECT team_name FROM db_mhealth.dbo.foci_team WHERE ou5_eid = '[ExternalID]'
From organizations endpoint, get the team name and organization ID from /organization
Filter the ones with the same team names as those in foci_team table
Replace this JSON with those values
Post the JSON to /organization/assignLocationsAndPlans endpoint
Teams
The Teams (e.g. Team 1) are actually a group of organizations, each with a list of users assigned. This mapping is defined in the dbo.group_team. The users are mapped within Reveal in the practitionerRole resource. Team 0 is for testing in the test foci and is hardcoded into the dbo.group_teamname view (i.e. does not appear in the dbo.group_team table
Assignment
Assignment to team groups is done at subdistrict level in the dbo.subdistrict_team table
Foci
There is a masterlist of foci ids - dbo.focus_masterlist. New foci will need to be added to this. It currently has the full list as supplied by Eli, Thursday 28th November
Organisations are mapped to subdistricts in the view dbo.foci_team, with the string array needed by Reveal generated in the dbo.group_teamname view
create view [dbo].[foci_team] as
select f.ou5_eid, gt.team_name from focus_masterlist f
left join subdistrict_team st on st.subdistrict_id = left(f.ou5_eid,6)
left join group_teamname gt on gt.group_name = st.group_name
This site is no longer maintained. Please visit docs.opensrp.io for current documentation.