coforma / acme-tech-challenge

For Phase 3 of the ACME Tech Challenge
3 stars 1 forks source link

Batch multiple patient status updates #21

Open malak-coforma opened 2 years ago

malak-coforma commented 2 years ago

Description

Endpoint acme/patientStatus/batch
Method POST
Roles EHR Maintainer

This endpoint should be identical in utility to #20, except for allowing multiple patients to be updated in one go.

allow us to get the most recent patient status from PatientDisasterUpdate using facilityNpi + patientIdFromFacility.

This allows us to show some "innovation" in how we think about mass amounts of records being updated... for instance: if they are batch updating less than X records we perform the operation in one way, otherwise if it's more then we might need a more sophisticated method (such as batching/queueing).

This depends on #20 being complete to implement.

Request Body

{
  "facilityNpi": int,
  "disasterId": int,
  "date": datetime,
  "patients": [
    {
      "patientIdFromFacility": string,
      "statusId": int,
    },
    {
      "patientIdFromFacility": string,
      "statusId": int,
    },
    {
      "patientIdFromFacility": string,
      "statusId": int,
    },
    {
      "patientIdFromFacility": string,
      "statusId": int,
    },
    ...
  ],
}

Response Body

201

TBD? Perhaps number of rows successfully updated/created?

400

If request body sent is syntactically invalid.

403

This endpoint is not authorized for roles who are not EHR maintainers or Government Systems Coordinators.

422

If request body sent is not processable (missing or malformed data).

Acceptance Criteria

  1. Returns 201 with response body when well-formatted data is sent by an EHR Maintainer.
  2. Returns 400 if request body is malformed.
  3. Returns 403 if request is made by a role other than EHR Maintainer.
  4. Returns 422 if request body is missing required data.
  5. Returns 422 if the request body contains data that doesn't make sense.

Tech Notes

Overall schema plan (Lucidchart)

Image

TheDanMiller commented 2 years ago

@malak-coforma same comments on 422 / 500

which ids would we return patient or patientdisastersupdates?

If we are doing an async call we would have just a queue to pass

malak-coforma commented 2 years ago

@TheDanMiller I was thinking similar to other batch processes I've run before, I usually just get a response back like "589037 row successfully updated" -- probably a simple enough place to start? Then we don't need to worry about sending back large amounts of data unless we're asked to.

malak-coforma commented 2 years ago

After getting some feedback via the Q&A items such as:

The solicitation states, “The system will support millions of patients and staff, and can anticipate occasional, sudden rapid updates when hospitals identify patients under disaster conditions and need to update patient status en masse.” Do you want an endpoint to batch update data files? Or an interface to do this?

The Government is uncertain why this question is being asked as it is not a current requirement. Refer to the instructions for API requirements.

We are de-prioritizing this from current sprint and moving this to the Future Sprint planning backlog for research.