Skip to content

Commit

Permalink
Vaccines supplied by manufacturer: add support for R = 5 (#43)
Browse files Browse the repository at this point in the history
* test: adjust vaccination by day assertion data

* test: adjust vacs date range assertion data

* feat(vaccines_supplied_by_manufacturer): handle ...

...response data item if R == 5
same date, same value, different manufacturer
  • Loading branch information
jalezi authored Sep 6, 2021
1 parent 46a84f1 commit eaf0757
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cepimose/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,16 @@ def get_manufacturer(num):
date = parse_date(C[0])
manufacturer = get_manufacturer((C[1]))
setattr(manu_row, "date", date)
setattr(manu_row, manufacturer, value) # reuse value from previous iteration
setattr(
manu_row, manufacturer, value
) # reuse value from previous iteration

if R == 5:
# same value, same date, but different manufacturer
manufacturer = get_manufacturer((C[0]))
setattr(
parsed_data[-1], manufacturer, value
) # reuse value from previous iteration

if R == 6:
# same manufacturer and value as previous
Expand Down
3 changes: 3 additions & 0 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ def assertRow(row, expected_date, expected):
assertRow(
data[65], datetime.datetime(2021, 7, 12), [72540, None, -250000, None]
) # Negative
assertRow(
data[73], datetime.datetime(2021, 7, 30), [None, 12000, None, 12000]
) # R = 5, combined: two response data items with same, date, same value, different manufacturer

self.assertDatesIncreaseSince(data, datetime.datetime(2020, 12, 26))

Expand Down

0 comments on commit eaf0757

Please sign in to comment.