-
Notifications
You must be signed in to change notification settings - Fork 130
Norway Demographic Census #1857
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
base: master
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @abhishekjaisw, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new data import pipeline for Norwegian demographic census data. It includes the necessary scripts and configurations to download data from Statistics Norway, transform it into the Data Commons format, and validate the import process through testing. This addition enhances the Data Commons knowledge graph with detailed demographic information for Norway. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds scripts and data for importing Norway's demographic census data. The changes are generally good, but I have a few suggestions. In data_download.py, the logic for filtering out regions can be simplified for better readability and maintainability. More importantly, there are inconsistencies and omissions in the generated test files. The statistical variable DCIDs in Norway_output.csv and Norway_output_stat_vars.mcf are not consistently named for all age groups. Additionally, Norway_output_stat_vars.mcf is missing definitions for some age groups that are present in the data. Correcting these test files is crucial for ensuring the data import is working as expected.
| 2023,nuts/NO033,19227,dcid:Count_Person_30To39Years_Female | ||
| 2024,nuts/NO033,19531,dcid:Count_Person_30To39Years_Female | ||
| 2025,nuts/NO033,19698,dcid:Count_Person_30To39Years_Female | ||
| 2023,nuts/NO033,19771,dcid:Count_Person_40To49Years_Female | ||
| 2024,nuts/NO033,19816,dcid:Count_Person_40To49Years_Female | ||
| 2025,nuts/NO033,19786,dcid:Count_Person_40To49Years_Female | ||
| 2023,nuts/NO033,22125,dcid:Count_Person_50To59Years_Female | ||
| 2024,nuts/NO033,22378,dcid:Count_Person_50To59Years_Female | ||
| 2025,nuts/NO033,22527,dcid:Count_Person_50To59Years_Female |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variableMeasured dcids for some age ranges are inconsistent with others. For age ranges 30-39, 40-49, and 50-59, the Years prefix is missing in the age part of the dcid (e.g., 30To39Years instead of Years30To39). This should be corrected for consistency across all age-related statistical variables in this file.
2023,nuts/NO033,19227,dcid:Count_Person_Years30To39_Female
2024,nuts/NO033,19531,dcid:Count_Person_Years30To39_Female
2025,nuts/NO033,19698,dcid:Count_Person_Years30To39_Female
2023,nuts/NO033,19771,dcid:Count_Person_Years40To49_Female
2024,nuts/NO033,19816,dcid:Count_Person_Years40To49_Female
2025,nuts/NO033,19786,dcid:Count_Person_Years40To49_Female
2023,nuts/NO033,22125,dcid:Count_Person_Years50To59_Female
2024,nuts/NO033,22378,dcid:Count_Person_Years50To59_Female
2025,nuts/NO033,22527,dcid:Count_Person_Years50To59_Female
| @@ -0,0 +1,123 @@ | |||
| # Auto generated using command: "tools/statvar_importer/stat_var_processor.py --input_data=statvar_imports/norway_census/test/Norway_input.csv --pv_map=statvar_imports/norway_census/Norway_pvmap.csv --output_path=statvar_imports/norway_census/test/Norway_output --config_file=statvar_imports/norway_census/Norway_metadata.csv --existing_statvar_mcf=gs://unresolved_mcf/scripts/statvar/stat_vars.mcf" on 2026-01-30 16:18:27.430545 | |||
|
|
|||
| Node: dcid:Count_Person_50To59Years_Male | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The statvar dcid is inconsistent with its age property and other statvars. The Years prefix is missing from the age part of the dcid. This inconsistency is present for other age ranges (30-39, 40-49) in this file as well and should be corrected for all of them.
Node: dcid:Count_Person_Years50To59_Male
| statType: dcid:measuredValue | ||
| age: dcid:Years90To99 | ||
| gender: dcid:Male | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| df = df[~df['Region'].isin(EXCLUDE_REGIONS)] | ||
| df = df[~df['Region'].str.contains('shelf|Unknown|Svalbard', case=False, na=False)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The two filtering steps for excluding regions are partially redundant and can be simplified into a single, more robust step. Using str.contains with a regex pattern built from EXCLUDE_REGIONS will handle all cases in a case-insensitive manner, making the code cleaner and less prone to errors if the source data casing changes.
| df = df[~df['Region'].isin(EXCLUDE_REGIONS)] | |
| df = df[~df['Region'].str.contains('shelf|Unknown|Svalbard', case=False, na=False)] | |
| df = df[~df['Region'].str.contains('|'.join(EXCLUDE_REGIONS), case=False, na=False)] |
No description provided.