Using the bulk upload feature¶
To facilitate adding rosters of new departments or updating existing departments there is a flask command that gives system administrators the ability to load the data from a csv file directly into the database.
Warning This process is not very robust at this point and there is risk of leaving the database in an inconsistent state. It is strongly recommended to back up the database before starting this operation and to run the command on a development server first and see if the results are as expected.
Preparation steps¶
- Create department if it does not exist
- Add ranks in hierarchical order, make sure all the ranks present in the csv are added
Layout of the csv file¶
The csv file can have the following fields:
department_id
unique_internal_identifier
first_name
last_name
middle_initial
suffix
gender
race
employment_date
birth_year
star_no
job_title
unit_id
star_date
resign_date
salary
salary_year
salary_is_fiscal_year
overtime_pay
Explanation of the individual fields¶
General information:¶
department_idid of department in the server database, for example1for Chicago Police Department can be found in url for that department: https://openoversight.com/department/1unique_internal_identifiera string or number that can be used to uniquely identify the officer, in departments in which the badge number stays with the officer using that number is fine, otherwise it is recommended to leave this blank and provide thestar_noinstead.first_name&last_name&middle_initialsuffixone ofJr, Sr, II, III, IV, Vgenderone ofM,F,OtherorNot Sureraceone ofBLACK,WHITE,ASIAN,HISPANIC,NATIVE AMERICAN,PACIFIC ISLANDER,Other,Not Sureemployment_datestart of employment with this departmentbirth_year
Current Employment information:¶
star_nostar or badge number, might be related to current rankjob_titlerank or title, needs to be added to this department verbatim orNot Sureunit_idid of unit within the departmentstar_date(sic) start date of this assignmentresign_dateresignation date of this assignment
Salary information:¶
salary_yearyear of which the salary information is providedsalary_is_fiscal_year‘true’ or ‘false’, salary information is on fiscal year basis vs. calendar yearsalarysalary in given yearovertime_payovertime received in given year
Required fields¶
department_id,first_name,last_name,job_titleand eitherstar_noorunique_internal_identifierare required.employment_date,star_dateandresign_datecan be either inyyyy-mm-ddormm/dd/yyyyformat - if the column is present the field cannot be left blank
Command-line options¶
--no-create- For each line in the CSV, update an existing officer if one exists, but do not create any new officers. If an officer in the CSV is not already in OpenOversight, the line will be ignored.--update-by-name- Update officers byfirst_nameandlast_name. Useful whenunique_internal_identifierandstar_noare not available.--update-static-fields- Allow modifications to normally-static fields likerace,birth_year, etc, which OpenOversight normally prevents from being modified. Values in the database will be overwritten with values in the CSV.
The command to run on the server¶
/usr/src/app/OpenOversight$ flask bulk-add-officers [/path/to/csv_file.csv]