Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix KeyError parsing for Cuba #2778

Merged
merged 4 commits into from
Aug 16, 2022
Merged

Fix KeyError parsing for Cuba #2778

merged 4 commits into from
Aug 16, 2022

Conversation

rbevansp
Copy link
Collaborator

@rbevansp rbevansp commented Jul 21, 2022

The split of the data into covid19-cuba-{1,2,...}.json, as described in issue #2233 is not addressed by the changes here. Any of the covid19-cuba-{1,2,...}.json files can be parsed by the changes, as well as covid19-cuba-old.json.

@rbevansp rbevansp requested a review from abhidg July 21, 2022 10:55
for centre in json_data[centre_type]:
hospital_map[centre] = json_data[centre_type][centre]['nombre'] + \
", " + json_data[centre_type][centre]['provincia']
except:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use except KeyError here - in case some other exception is raised. Also good to use logging.info to print a message saying that key was not found

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New commit [6c96b56] deals with this.

if schema_version != 7:
logger.warning(
f'Schema version has been updated from 7 to {schema_version}')
try:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was schema-version removed? A change in schema-version should break the script, as we might not be capturing the correct fields.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

schema-version was removed. There is no mention of schema-version in covid19-cuba-1.json.

@abhidg abhidg merged commit f72c52b into main Aug 16, 2022
@abhidg abhidg deleted the 2233_cuba_parser branch August 16, 2022 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants