...
- When a particular patient field that is marked for approval is updated, patient CF and pending_approval_mapping CF are updated.
- patient CF - new field details added to the pending_approvals JSON.
- pending_approval_mapping CF -
- Search by health_id (secondary index) and delete the records.
- Create new records for each possible catchment (see explanation below). last_updated is set as the latest timeuuid of the pending_approvals in patient CF.
- Possible catchments - If catchment is 10203040, the possible catchments are 1020, 102030, 10203040. Catchments should have always division and district.
- All queries are run in a batch.
Approve Request
- The field(s) is updated in patient CF.
- When a field that is pending for approval is approved, all the updates for that field are removed from the pending_approvals in patient CF.
- If there is no other pending_approvals in the patient CF, all pending_approval_mapping CF records for that health_id is deleted.
- Else, pending_approval_mapping CF is updated as mentioned above.
- All queries are run in a batch.
Reject Request
- The field(s) is NOT updated in patient CF.
- When a field that is pending for approval is rejected, only that particular updates for that field is removed from the pending_approvals in patient CF.
- If there is no other pending_approvals in the patient CF, all pending_approval_mapping CF records for that health_id is deleted.
- Else, pending_approval_mapping CF is updated as mentioned above.
- All queries are run in a batch.