Skip to content

Commit

Permalink
Merge pull request #345 from devinit/hotfix/dac-sector-recode
Browse files Browse the repository at this point in the history
Dual defaults for x_sector_vocabulary
  • Loading branch information
akmiller01 committed Oct 1, 2020
2 parents 9c1cf29 + 3710562 commit 4048971
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
17 changes: 8 additions & 9 deletions data_updates/Python/iati_transaction_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,8 +734,11 @@ def flatten_activities(self, root):
percentage = percentage.replace("%", "")
if percentage is None:
percentage = ""
vocab = attribs['vocabulary'] if 'vocabulary' in attrib_keys else "99"
code = attribs['code'] if 'code' in attrib_keys else ""
if len(code) == 5:
vocab = attribs['vocabulary'] if 'vocabulary' in attrib_keys else "1"
else:
vocab = attribs['vocabulary'] if 'vocabulary' in attrib_keys else "99"
sector_code_list.append(code)
sector_percentage_list.append(percentage)
sector_vocabulary_list.append(vocab)
Expand Down Expand Up @@ -835,8 +838,11 @@ def flatten_activities(self, root):
percentage = percentage.replace("%", "")
if percentage is None:
percentage = ""
vocab = attribs['vocabulary'] if 'vocabulary' in attrib_keys else "99"
code = attribs['code'] if 'code' in attrib_keys else ""
if len(code) == 5:
vocab = attribs['vocabulary'] if 'vocabulary' in attrib_keys else "1"
else:
vocab = attribs['vocabulary'] if 'vocabulary' in attrib_keys else "99"
transaction_sector_code_list.append(code)
transaction_sector_percentage_list.append(percentage)
transaction_sector_vocabulary_list.append(vocab)
Expand All @@ -848,13 +854,6 @@ def flatten_activities(self, root):
x_sector_code_list = sector_code_list.copy()
x_sector_percentage_list = sector_percentage_list.copy()
x_sector_vocabulary_list = sector_vocabulary_list.copy()
for j in range(0, len(x_sector_code_list)):
x_sector_code = x_sector_code_list[j]
x_sector_vocabulary = x_sector_vocabulary_list[j]
if x_sector_vocabulary == "" and len(x_sector_code) == 5:
x_sector_vocabulary_list[j] = "1"
elif x_sector_vocabulary == "":
x_sector_vocabulary_list[j] = "97"

transaction_type_code = default_first(transaction.xpath("transaction-type/@code"))
transaction_date_iso_date = default_first(transaction.xpath("transaction-date/@iso-date"))
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ services:
- FTSPASS
- DJANGO_DEV
- DJANGO_SECRET_KEY
- EMAIL_HOST_PASSWORD
- CELERY_BROKER_URL=amqp://admin:ddw_analyst_ui@rabbitmq:5672/myvhost
nginx:
image: nginx:latest
Expand Down

0 comments on commit 4048971

Please sign in to comment.