lucyparsons / OpenOversight

Police oversight and accountability through public data 👮
https://openoversight.com
GNU General Public License v3.0
237 stars 79 forks source link

bulk upload: units #734

Open redshiftzero opened 4 years ago

redshiftzero commented 4 years ago

Allow bulk unit creation via the CLI. CSV has fields unit_name, department_id.

Import should print unit_id (primary key when created), unit_name, department_id of successfully imported fields to stdout.

This should go in: https://github.com/lucyparsons/OpenOversight/blob/develop/OpenOversight/app/commands.py

brianmwaters commented 4 years ago

I have (a) solution for this in https://github.com/lucyparsons/OpenOversight/pull/703. I have some time tonight and will try to get those unit tests written.

brianmwaters commented 4 years ago

Actually, I misspoke. What I have is a scriptable way to add new departments, and to add new ranks to departments. Not anything to do with units.

brrusselburg commented 1 year ago

If this still needs attention, I can take a look

abandoned-prototype commented 1 year ago

Hi @brrusselburg! Yes, this would still be a useful cli command to have I think. However, contrary to the description it should not have anything to do with csv files. Ideally it would be something like the job name import cli: https://github.com/lucyparsons/OpenOversight/blob/32df01195e4adc9fcc81a93c585b8cfe687f0143/OpenOversight/app/commands.py#L552 Except that the parameters would just be department_name (not id) and unit_name. Hope that makes sense. Please let me know if you run into any issues