chicommons / maps

MIT License
7 stars 18 forks source link

Backend: Add county to data generated by python seed script #96

Open laredotornado opened 3 years ago

laredotornado commented 3 years ago

Currently data is generated from a CSV file containing coop data to a file that Python can ingest using the following commands

cd web
. venv/bin/activate
python manage.py parse_coop_csv directory/fixtures/chicommons_prep.xlsx\ -\ Mapping\ Sheet.csv > directory/fixtures/seed_data.yaml

The CSV has rows that look like this

ID,ent-name,ent-adrs,ent-adrs-pub,ent-zip,ent-city,ent-cnty,ent-st,ent-cntry,website,ent-cnct,ent-cnct-pub,ent-email,ent-email-pub,ent-phone,ent-phone-pub,ent-type,ent-include,disp-adrs-zip,disp-output,geo-scope,ent-tags,ent-desc-eng,ent-desc-loglang,ent-img-link,ent-img-lic,ent-img-crdt,lon,lat,rec-src,rec-udt-by,rec-updt-date
1,1335 ASTOR CO-OP BUILDING,1335 N ASTOR ST,yes,60610,Chicago,,IL,USA,https://www.dkcondo.com/managed-associations/1335-astor-co-op/,,,,,312-943-7500,yes,Housing Coop,yes,address,both,local,,,,,,,-87.6271603,41.9069583,SEWG,DC,2020-12-26
2,1530 N STATE PKWY CO-OP,1530 N STATE PKWY,yes,60610,Chicago,,IL,USA,https://mce.uwcc.wisc.edu/Cooperatives_map/,,,,,"312.944.8945,312.751.0900",yes,Housing Coop,yes,address,both,local,,,,,,,-87.6291461,41.9105834,SEWG,DC,2020-12-26
3,1800 South Troy Block Club Garden,1842 S Troy St,yes,60623,Chicago,,IL,USA,http://neighbor-space.org/2012/04/21/1800-south-troy-block-club-garden/,,,,,,,Community Garden,yes,address,both,local,,,,,,,-87.70425024,41.85595552,Neighborspace,SE,2020-12-26

We need to take the data in the column with the header "ent-cnty" (county) and add it to the output that is produced for locality. The final result should have the format

- model: address.locality
  pk: 1
  fields:
    name: "Chicago"
    county: Cook
    postal_code: "60632"
    state: ['IL', 'United States']
maxgraziano commented 6 months ago

Fixed in '3.1-model-refactor'.