Skip to content

Commit

Permalink
Remove State Code -> Foreign Province mapping
Browse files Browse the repository at this point in the history
Removes State Code -> Foreign Province mapping from the submission
loader, and the relevant text from `data_reformatting.md`
  • Loading branch information
afrasier committed May 11, 2017
1 parent 0a3be64 commit bb57af5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
8 changes: 0 additions & 8 deletions data_reformatting.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ Generally, data will be imported as-is. In some cases, however, we reformat the

Making sure our location-related fields are as robust and accurate as possible powers the geographic filters used by our website and API.

### State Code and Foreign Province

**Data Source:** USAspending history and DATA Broker
**Code:** `submissions/management/commands/load_submission.py`

When loading information from the DATA Act broker, if the data has a state code but does not have a country code of `USA`, we load the state code as a foreign province.


### State, County, and City

**Data Source:** USAspending history and DATA Broker
Expand Down
10 changes: 2 additions & 8 deletions usaspending_api/etl/management/commands/load_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,16 +400,10 @@ def get_or_create_location(location_map, row, location_value_map={}):
location_country = RefCountryCode.objects.filter(
country_code=row[location_map.get('location_country_code')]).first()

# temporary fix until broker is patched: remove later
state_code = row.get(location_map.get('state_code'))
if state_code is not None:
# Fix for procurement data foreign provinces stored as state_code
if location_country and location_country.country_code != "USA":
location_value_map.update({'foreign_province': state_code})
location_value_map.update({'state_code': None})
else:
location_value_map.update({'state_code': state_code.replace('.', '')})
# end of temporary fix
# Remove . in state names (i.e. D.C.)
location_value_map.update({'state_code': state_code.replace('.', '')})

if location_country:
location_value_map.update({
Expand Down

0 comments on commit bb57af5

Please sign in to comment.