-
Notifications
You must be signed in to change notification settings - Fork 146
Eurostat Data Import - Death by week and sex & Divorce indicators #2039
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
Open
pravnkumar-cloudsufi
wants to merge
13
commits into
datacommonsorg:master
Choose a base branch
from
pravnkumar-cloudsufi:eurostat_data_death_divorce
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
2f00a9e
Eurostat_Data_Death_by_week_and_sex_and_Divorce_indicators_data
pravnkumar-code c443648
EurostatData_Deaths_by_week_and_sex_&_Divorce_indicators
pravnkumar-code 88b77cf
Eurostat Data Import Resolution of Gemini Checks
pravnkumar-code 1fd838b
Eurostat Data Import - Death by week and sex & Divorce indicators aft…
pravnkumar-code 9dd23a0
Eurostat Death by week and sex data import
pravnkumar-code ed0f470
Eurostat Death by week and sex data import
pravnkumar-code 399096e
Divorce Indicator Data Import and Modifed README file of Deaths by we…
pravnkumar-code edb6391
Divorce Indicator RUN.sh script corrected
pravnkumar-code 4dc0247
Fix path for places_resolved_csv in run.sh
pravnkumar-cloudsufi 63197a5
Eurostat Data Import Deaths by week and sex
pravnkumar-code f09004b
Eurostat Data Import Divorce Indicators
pravnkumar-code 400b96d
Eurostat Data Marriage by sex and previous marital status and Populat…
pravnkumar-code 5568a59
Merge branch 'master' into eurostat_data_death_divorce
pravnkumar-cloudsufi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
20,603 changes: 20,603 additions & 0 deletions
20,603
statvar_imports/eurostat/deaths_by_week_and_sex/Deaths_by_week_and_sex_metadata.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # Eurostat Deaths By Week And Sex Import | ||
|
|
||
| ## Overview | ||
| This dataset contains weekly death indicators at national and regional levels, sourced from Eurostat. The data tracks the total number of deaths broken down by sex and week across various European countries and regions. | ||
|
|
||
| **type of place:** Country, NUTS Regions (Level 0-3) | ||
| **years:** Historical data to present (2000-present, recorded weekly e.g., 2000-W01) | ||
| **place_resolution:** Resolved to DCIDs (e.g., dcid:country/FRA, dcid:nuts/AT113) | ||
|
|
||
| ## Data Source | ||
| **Source URL:** | ||
| https://ec.europa.eu/eurostat/databrowser/view/demo_r_mwk_ts/default/table?lang=en | ||
|
|
||
| **Provenance Description:** | ||
| The data is provided by Eurostat, the statistical office of the European Union. It belongs to the "Demography, population stock and balance" database under the "Deaths by week - special data collection" statistical theme, specifically the "Deaths by week and sex" (DEMO_R_MWK_TS) dataset. | ||
|
|
||
| ## Refresh Type | ||
| Automatic Refresh | ||
|
|
||
| The refresh is automated using the provided `run.sh` script, which handles both data download and processing. | ||
|
|
||
| ## How To Run Import | ||
| To execute the complete import process (download and processing), run: | ||
| ```bash | ||
| ./run.sh | ||
|
|
||
|
|
||
| ### Script Details: | ||
| - **Download**: Uses `curl` to fetch the latest SDMX-CSV data from Eurostat's dissemination API. | ||
| - **Processing**: Uses `stat_var_processor.py` to map raw data to Data Commons StatVarObservations using the PV map and metadata configuration. | ||
|
|
||
| ## Key Files | ||
| - `run.sh`: Main execution script for download and processing. | ||
| - `deaths_by_week_and_sex_pvmap.csv`: Property-Value mapping for StatVar definitions and dimensions. | ||
| - `deaths_by_week_and_sex_metadata.csv`: Configuration parameters for the processor. | ||
| - `places_resolved.csv`: Mapping of place codes to Data Commons DCIDs. | ||
| - `deaths_by_week_and_sex_output.csv`: Processed statistical observations. | ||
| - `deaths_by_week_and_sex_output.tmcf`: Template MCF mapping the CSV columns to Data Commons schema. | ||
|
|
||
| ## Validation | ||
| To validate the generated data, use the Data Commons import tool (lint mode): | ||
| ```bash | ||
| java -jar datacommons-import-tool.jar lint deaths_by_week_and_sex_output.csv deaths_by_week_and_sex_output.tmcf | ||
| ``` | ||
| The resulting reports (`report.json`, `summary_report.html`) in `dc_generated/` provide detailed insights into data quality and validation status. | ||
|
|
||
| ## Testing | ||
| Testing is performed using the `test_data` directory: | ||
| - Raw Input: `test_data/deaths_by_week_and_sex_data_raw.csv` | ||
| - Expected Output: `test_data/deaths_by_week_and_sex_output.csv` | ||
| - Expected TMCF: `test_data/deaths_by_week_and_sex_output.tmcf` | ||
2 changes: 2 additions & 0 deletions
2
statvar_imports/eurostat/deaths_by_week_and_sex/deaths_by_week_and_sex_metadata.csv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| parameter,value | ||
| header_rows,1 |
35 changes: 35 additions & 0 deletions
35
statvar_imports/eurostat/deaths_by_week_and_sex/deaths_by_week_and_sex_pvmap.csv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| key,property1,value1,property2,value2,property3,value3,property4,value4 | ||
| # Dataflow mapping | ||
| DATAFLOW,measuredProperty,dcs:count,populationType,dcs:Person,mortalityStatus,dcs:Deceased,statType,dcs:measuredValue | ||
|
|
||
| # --- AUTOMATED CLEANUP: Ignored Columns --- | ||
| LAST UPDATE,#ignore,"",,,,,, | ||
| CONF_STATUS,#ignore,"",,,,,, | ||
|
|
||
| # --- AUTOMATED CLEANUP: Global Geo Logic & Ignores --- | ||
| geo:DE_TOT,#ignore,"",,,,,, | ||
| geo:EA19,#ignore,"",,,,,, | ||
| geo:EA20,#ignore,"",,,,,, | ||
| geo:EA21,#ignore,"",,,,,, | ||
| geo:EEA30_2007,#ignore,"",,,,,, | ||
| geo:EEA31,#ignore,"",,,,,, | ||
| geo:EFTA,#ignore,"",,,,,, | ||
| geo:EU27_2007,#ignore,"",,,,,, | ||
| geo:EU27_2020,#ignore,"",,,,,, | ||
| geo:EU28,#ignore,"",,,,,, | ||
| # Frequency dimension | ||
| freq:W,observationPeriod,P1W,,,,,, | ||
| # Sex dimension | ||
| sex:T,gender,"",,,,,, | ||
| sex:M,gender,dcs:Male,,,,,, | ||
| sex:F,gender,dcs:Female,,,,,, | ||
| # Unit dimension | ||
| unit:NR,unit,dcs:Number,,,,,, | ||
| # Geography dimension | ||
| geo,observationAbout,{Data},,,,,, | ||
| # Time Period - Using #Regex to match every cell value | ||
| TIME_PERIOD,#Regex,"(?P<Year>[0-9]{4})-W(?P<Week>[0-9]{2})",observationDate,{Year},measurementMethod,dcs:EurostatWeekly_Week{Week} | ||
|
pravnkumar-cloudsufi marked this conversation as resolved.
Outdated
|
||
| # Observation Value | ||
| OBS_VALUE,value,{Number},,,,,, | ||
| # Observation Flag (Status) | ||
| OBS_FLAG:p,observationStatus,dcs:Provisional,,,,,, | ||
26 changes: 26 additions & 0 deletions
26
statvar_imports/eurostat/deaths_by_week_and_sex/manifest.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "import_specifications": [ | ||
| { | ||
| "import_name": "EuroStat_Deaths_by_week_and_sex", | ||
| "curator_emails": [ | ||
| "support@datacommons.org" | ||
| ], | ||
| "provenance_url": "https://ec.europa.eu/eurostat/databrowser/view/demo_r_mwk_ts/default/table?lang=en", | ||
| "provenance_description": "This data is a voluntary, granular collection of weekly deaths by sex, age, and region across European countries from 2000 onward, established by Eurostat to monitor mortality trends during and after the COVID-19 pandemic.", | ||
| "scripts": [ | ||
| "run.sh" | ||
| ], | ||
| "import_inputs": [ | ||
| { | ||
| "template_mcf": "deaths_by_week_and_sex_output.tmcf", | ||
| "cleaned_csv": "deaths_by_week_and_sex_output.csv" | ||
| } | ||
| ], | ||
| "source_files": [ | ||
| "input_files/*.csv" | ||
| ], | ||
| "cron_schedule": "5 1 1,15 * *", | ||
| "resource_limits": {"cpu": 4, "memory": 8, "disk":100} | ||
| } | ||
| ] | ||
| } |
51 changes: 51 additions & 0 deletions
51
statvar_imports/eurostat/deaths_by_week_and_sex/places_resolved.csv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| "place_name","dcid","placeId","wikidataId","name","alternateName","typeOf","containedInPlace" | ||
| "AD","country/AND","","","","","","" | ||
| "AL","country/ALB","","","","","","" | ||
| "AM","country/ARM","","","","","","" | ||
| "AT","country/AUT","","","","","","" | ||
| "AZ","country/AZE","","","","","","" | ||
| "BA","country/BIH","","","","","","" | ||
| "BE","country/BEL","","","","","","" | ||
| "BG","country/BGR","","","","","","" | ||
| "BY","country/BLR","","","","","","" | ||
| "CH","country/CHE","","","","","","" | ||
| "CY","country/CYP","","","","","","" | ||
| "CZ","country/CZE","","","","","","" | ||
| "DE","country/DEU","","","","","","" | ||
| "DK","country/DNK","","","","","","" | ||
| "EE","country/EST","","","","","","" | ||
| "EL","country/GRC","","","","","","" | ||
| "ES","country/ESP","","","","","","" | ||
| "FI","country/FIN","","","","","","" | ||
| "FR","country/FRA","","","","","","" | ||
| "FX","country/FXX","","","","","","" | ||
| "GE","country/GEO","","","","","","" | ||
| "HR","country/HRV","","","","","","" | ||
| "HU","country/HUN","","","","","","" | ||
| "IE","country/IRL","","","","","","" | ||
| "IS","country/ISL","","","","","","" | ||
| "IT","country/ITA","","","","","","" | ||
| "LI","country/LIE","","","","","","" | ||
| "LT","country/LTU","","","","","","" | ||
| "LU","country/LUX","","","","","","" | ||
| "LV","country/LVA","","","","","","" | ||
| "MC","country/MCO","","","","","","" | ||
| "MD","country/MDA","","","","","","" | ||
| "ME","country/MNE","","","","","","" | ||
| "MK","country/MKD","","","","","","" | ||
| "MT","country/MLT","","","","","","" | ||
| "NL","country/NLD","","","","","","" | ||
| "NO","country/NOR","","","","","","" | ||
| "PL","country/POL","","","","","","" | ||
| "PT","country/PRT","","","","","","" | ||
| "RO","country/ROU","","","","","","" | ||
| "RS","country/SRB","","","","","","" | ||
| "RU","country/RUS","","","","","","" | ||
| "SE","country/SWE","","","","","","" | ||
| "SI","country/SVN","","","","","","" | ||
| "SK","country/SVK","","","","","","" | ||
| "SM","country/SMR","","","","","","" | ||
| "TR","country/TUR","","","","","","" | ||
| "UA","country/UKR","","","","","","" | ||
| "UK","country/GBR","","","","","","" | ||
| "XK","country/XKX","","","","","","" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Step 1: Data Download | ||
| mkdir -p input_files | ||
| curl -L --retry 3 "https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/DEMO_R_MWK_TS/?format=SDMX-CSV&compressed=false" -o sdmx/Deaths_by_week_and_sex/deaths_by_week_and_sex_data_raw.csv | ||
|
pravnkumar-cloudsufi marked this conversation as resolved.
Outdated
|
||
|
|
||
| # Step 2: Data Processing | ||
| python3 ../../../tools/statvar_importer/stat_var_processor.py \ | ||
| "--input_data=./input_files/*.csv" \ | ||
| "--pv_map=./deaths_by_week_and_sex_pvmap.csv" \ | ||
| "--config_file=./deaths_by_week_and_sex_metadata.csv" \ | ||
| "--generate_statvar_name=True" \ | ||
| "--skip_constant_csv_columns=False" \ | ||
| "--output_columns=observationDate,observationAbout,variableMeasured,value,observationPeriod,unit" \ | ||
|
pravnkumar-cloudsufi marked this conversation as resolved.
Outdated
|
||
| "--output_path=./deaths_by_week_and_sex_output" \ | ||
| "--places_resolved_csv=./places_resolved.csv" \ | ||
| "--existing_statvar_mcf=gs://unresolved_mcf/scripts/statvar/stat_vars.mcf" \ | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.