Whenever a new patient is created via a POST request to the /patients endpoint, we would send a request to AWS to encode the face provided in the request. AWS then replies with a face_encoding, which is a hexadecimal string that acts as an ID to the picture. On the backend, AWS stores a table (referred to as collection) of face vectors (think face features) and its associated face_encoding. If AWS determines that the current face has not been seen before, it creates a new entry and assigns a new face_encoding. Otherwise, it returns the face_encoding of the matching face. This encoding is then stored together with the patient's details in the database.
Whenever a post request is recieved to the search_face endpoint, we would send a request to AWS to see if there is a matching face. AWS replies with a few features, of which we are concerned with the face_encodings and the confidence level. We then search the database for matching patients and return this list of patients and the confidence level of the scan.
Things to note:
New feature flag added to control this feature ENABLE_FACIAL_RECOGNITION
This flag is separate from the OFFLINE flag to allow for finer control, in case we still have marginal internet bandwidth that could be used for small API calls.
This PR adds the new facial recognition feature.
Flow:
Whenever a new patient is created via a POST request to the
/patients
endpoint, we would send a request to AWS to encode the face provided in the request. AWS then replies with aface_encoding
, which is a hexadecimal string that acts as an ID to the picture. On the backend, AWS stores a table (referred to as collection) of face vectors (think face features) and its associated face_encoding. If AWS determines that the current face has not been seen before, it creates a new entry and assigns a new face_encoding. Otherwise, it returns the face_encoding of the matching face. This encoding is then stored together with the patient's details in the database.Whenever a post request is recieved to the
search_face
endpoint, we would send a request to AWS to see if there is a matching face. AWS replies with a few features, of which we are concerned with the face_encodings and the confidence level. We then search the database for matching patients and return this list of patients and the confidence level of the scan.Things to note:
New feature flag added to control this feature
ENABLE_FACIAL_RECOGNITION
This flag is separate from theOFFLINE
flag to allow for finer control, in case we still have marginal internet bandwidth that could be used for small API calls.