PublicDataWorks / complaint-manager

Apache License 2.0
5 stars 0 forks source link

Add mass upload section in Admin Portal #655

Open christina-luong opened 4 months ago

christina-luong commented 4 months ago

User Story

As a user of either NO or Hawaii I want to be able to mass upload information about officers or inmates (respectively) So that the database is kept up to date

Business Context:

Occasionally, we are provided by either organization a spreadsheet containing the updated roster of officers or inmates. The uploads have been a manual process (see #592) with some research previously done on mass uploading (see #529). This story will build the functionality needed to accept this information to the system from the client side.

In Scope

  1. Create a mass upload section/button in the Admin Portal.
  2. Display a blank example template with the correct layout for client reference. (see Mockups)
  3. Facilitate an upload of a csv file using a Dropzone component
  4. Once inputted (in the server handler), validate that the csv has the correct headers.

    Out of Scope

  5. Processing the csv past the headers; see #629

Open Questions

Mockups

Draft Template https://docs.google.com/spreadsheets/d/1UD4cuP2LJ160PHak3wpRTLuBgSPg7RI_QTMpcNOUud4/edit?usp=sharing Visual Mockup https://www.figma.com/design/3XcaCKS0xC3U0mo98B8eTV/Features-Complaint-Manager?node-id=971-3861&t=AcLrpZUzwJNA43NU-0

Acceptance Criteria

  1. Scenario: Given that I am in the Admin Portal When I look at the page Then I see a Mass Upload section where I can input my csv file

  2. Scenario: Given that I have entered a csv with incorrect or missing headers When I click Upload Then an error is generated stating that I need to fix errors and resubmit

Notes

Checklist

Kickoff

Deskcheck

paul-thompson1 commented 4 months ago

References: example upload admin portal? dropzone component example dropzone container example file upload example

andrew-rist-tw commented 4 months ago

Once this is implemented, we need to add a wiki page under this page that instructs clients how to upload a roster.

paul-thompson1 commented 4 months ago

Made basic structure of Mass Upload section. Screenshot 2024-07-24 at 10 19 06 AM (2)

paul-thompson1 commented 4 months ago

Made basic header validation during upload for one organization. Was able to display error during header validation on the frontend. Still need to detect organization and then validate the expected headers for that organization against the headers from the uploaded file.

Screenshot 2024-07-25 at 10 08 19 AM (2)

rd-huerta commented 4 months ago

To do:

get the roster template from s3 and display a link to it from the massUpload component

paul-thompson1 commented 4 months ago

Currently working on getting csv file from S3 and linking the file to mass upload section. Need to perform additional tests for header validation in different environments.

paul-thompson1 commented 4 months ago

Was able to download csv file locally via link in the mass upload section. Used getSignedUrl method from s3. Screenshot 2024-07-26 at 3 26 07 PM (2)

Created a handler and an endpoint for get the link to the template.