Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • health_ids and last_updated timeuuids are selected from pending_approval_mapping CF for a given catchment and gte timeuuid. The results are ordered by last_updates asc.
  • For each health_id, patient CF is queried for given_name and surname. 
  • Sample JSON response: 

...

  • Pending approvals for a particular patient is stored in the patient CF. When pending approval for a particular patient (by HID) is queried, the result is served from patient CF.
  • The field is 'pending_approvals.' The pending approvals are stored as a JSON string. Class PendingApproval is used to serialize/deserialize the JSON. Updates are grouped by fields.
  • The pending approvals are ordered by field name (lexicographically), then timeuuid in desc order. For each update the timeuuid is captured. See 'field_details' in the JSON below.
  • TODO: Spike user defined types in Cassandra
  • Sample JSON response:

...

  • 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 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 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 run in a batch.