Search

Find by NID

CREATE TABLE IF NOT EXISTS nid_mapping (
   national_id varchar,
   health_id varchar,
  PRIMARY KEY (national_id, health_id)
);

  • When patient is created or updated this mapping CF is updated (if NID is present/updated).
  • When queried by NID, all HIDs are retrieved from this table.
  • For each HID patient CF is queried for other patient details and the result it returned.
  • Separate mappings tables (brn_mapping, uid_mapping, phone_number_mapping) exist for BRN, UID, and phone number. 
  • That implies patient can be searched by any of these params (nid, uid, brn, phone no) separately.

Find by Name & Location

CREATE TABLE IF NOT EXISTS name_mapping (
   division_id varchar,
   district_id varchar,
   upazila_id varchar,
   given_name varchar,
   sur_name varchar,
   health_id varchar,
   PRIMARY KEY ((division_id, district_id, upazila_id), given_name, sur_name, health_id)
);

  • Patient cannot be searched by given_name only. At least address (division, district and upazila) along with given_name have to be provided. Surname is optional.
  • When patient is created or updated this mapping CF is updated (given_name, division_id, district_id, upazila_id are mandatory for create).
  • When queried by address and given_name, all HIDs are retrieved from this table.
  • For each HID patient CF is queried for other patient details and the result it returned.
  • On each of these patient details, other filters (city corp id, union id, rural ward id) are applied in memory.

Find by multiple parameters

  • Example, search by nid + brn + given_name.
  • When multiple parameters are sent, one of the mapping tables is queried and other parameters are used to filter the patients in memory.
  • The order in which mapping tables are queried is as follows (only one is queried): NID, BRN, UID, Phone No, Name + Address.