opensandiego / sdvv-frontend

Frontend for the Campaign Finance Transparency Dashboard
https://followthemoneysandiego.org/
MIT License
5 stars 12 forks source link

Generate candidates.json from candidate_information Google Sheet #206

Closed robertgz closed 3 years ago

robertgz commented 3 years ago

Transfer the mostly static candidate data from the Google Sheet to a candidates.json.

The rational is to read the Google Sheet once then use the candidates.json file to read the static data by later scripts, rather than having multiple scripts read the Google Sheet directly. The contents of the individual candidate json files will be limited to storing the calculated amounts.

Complete the changes in a branch from dev.

candidate_information Google Sheet: https://docs.google.com/spreadsheets/d/1mENueYg0PhXE_MA9AypWWBJvBLdY03b8H_N_aIW-Ohw

The proposed structure of candidates.json:

{
  offices: [
    "Mayor",
    "City Attorney",
    "City Council"
  ],
  candidates: [
    {
      "candidate name": "Todd Gloria",
      "committee name": "Todd Gloria for Mayor 2020",
      "office": "Mayor",
      "district": "0",
      "year": "2000",
      "website": "https://toddgloria.com/",
      "description": "Assemblymember",
      "in general": true,
      "calculations": "assets/candidates/2020/mayor/barbara_bry/barbara_bry.json",
      "image": "assets/candidates/2020/mayor/barbara_bry/barbara_bry.png"
    },
    ...
    {
      "candidate name": "Joe LaCava",
      "committee name": "Joe LaCava for City Council 2020",
      "office": "City Council",
      "district": "1",
      "year": "2000",
      "website": "https://www.joelacava.com/",
      "description": "Civil Engineer/ Business Owner",
      "in general": true,
      "calculations": "",
      "image": ""
    },
    ...
  ]
}

The calculations property name can be changed if needed. The calculations will have an empty value "" when the candidates.json file is generated. A later script will add the file path.

How the image path will be added has not been determined.

robertgz commented 3 years ago

This is partially superseded by #252.