Commit
·
04edfe7
1
Parent(s):
2fcbf34
Add parametric analysis and dataset improvements with LFS tracking
Browse files- .gitattributes +1 -0
- README.md +45 -50
- parametric-data/decimals/decimal_place_analysis.json +3 -0
- parametric-data/decimals/decimal_place_analysis.md +39 -0
- parametric-data/decimals/decimal_place_summary.csv +6 -0
- parametric-data/geodata_analysis.json +3 -0
- parametric-data/geodata_analysis.md +52 -0
- parametric-data/geodata_summary.csv +5 -0
- processing/geodata_analysis.py +148 -0
- user-guide.pdf +3 -0
.gitattributes
CHANGED
|
@@ -61,3 +61,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 61 |
*.xlsm filter=lfs diff=lfs merge=lfs -text
|
| 62 |
*.xlsx filter=lfs diff=lfs merge=lfs -text
|
| 63 |
*.ods filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 61 |
*.xlsm filter=lfs diff=lfs merge=lfs -text
|
| 62 |
*.xlsx filter=lfs diff=lfs merge=lfs -text
|
| 63 |
*.ods filter=lfs diff=lfs merge=lfs -text
|
| 64 |
+
*.pdf filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -18,7 +18,7 @@ Source data: International Foundation for Valuing Impacts
|
|
| 18 |
|
| 19 |

|
| 20 |
|
| 21 |
-
V2 of a refactoring of the Global Value Factor Database (GVFD) by the International Foundation for Valuing Impacts intended to enhance the original dataset for machine readability and integration into data analysis and visualization workloads.
|
| 22 |
|
| 23 |

|
| 24 |
|
|
@@ -106,60 +106,14 @@ The dataset continues to be governed by IFVI’s terms of use, as set out in the
|
|
| 106 |
|
| 107 |
No substantive changes were made to IFVI’s data values or methodologies. However, I applied several light-touch edits to improve usability and consistency:
|
| 108 |
|
| 109 |
-
### XLSM -> CSV, JSON
|
| 110 |
-
|
| 111 |
-
The original GVFD was released as a single `.xlsm` (macro-enabled Excel) file.
|
| 112 |
-
|
| 113 |
-
My primary aim was to reformat the GVFD for **machine readability** and **workflow compatibility**, especially in contexts requiring:
|
| 114 |
-
|
| 115 |
-
* **Data analysis** (e.g., using R or Python libraries such as pandas or tidyverse).
|
| 116 |
-
* **Visualization** (e.g., dashboards or BI tools).
|
| 117 |
-
* **Interoperability** (integration with geospatial or statistical workflows).
|
| 118 |
-
|
| 119 |
-
To achieve this, the following steps were taken:
|
| 120 |
-
|
| 121 |
-
1. Conversion of the original dataset to **CSV format**.
|
| 122 |
-
2. Splitting of the data into **separate CSV files**, one for each value factor category.
|
| 123 |
-
3. Creation of **structured JSON files**, reflecting the data’s original hierarchical presentation.
|
| 124 |
-
4. Production of **compact Parquet versions**, auto-generated via Hugging Face for efficient querying and storage.
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
### ISO Alpha-2 Mapping For Geographic Entities
|
| 128 |
-
|
| 129 |
-
* Country names as listed in the original dataset were mapped to **ISO Alpha-2 codes**.
|
| 130 |
-
* Both the **original names** and their **ISO equivalents** are retained in the refactored dataset.
|
| 131 |
-
* Non-sovereign entities (e.g., certain territories, U.S. states) without ISO codes were omitted.
|
| 132 |
-
|
| 133 |
-
### Currency Symbol Redaction
|
| 134 |
-
|
| 135 |
-
* The GVFD values are denominated in **U.S. dollars**.
|
| 136 |
-
* To preserve numeric integrity, I removed dollar signs (`$`) from all values.
|
| 137 |
-
* Currency denomination is now recorded in the dataset’s **metadata and documentation** rather than embedded in each cell.
|
| 138 |
-
|
| 139 |
-
Note: some of the value factors are six decimal places. If ingesting this dataset into databases, it is recommended to choose an appropriate decimal type.
|
| 140 |
-
|
| 141 |
-
### Structure and Accessibility
|
| 142 |
-
|
| 143 |
-
* **JSON representations** preserve the original units and structure of the GVFD.
|
| 144 |
-
* **Country-level JSONs** were generated to allow users to focus on all value factors within a single nation.
|
| 145 |
-
* A **combined dataset** was also provided, enabling both broad and granular analysis.
|
| 146 |
-
|
| 147 |
-
---
|
| 148 |
-
|
| 149 |
-
## Outputs
|
| 150 |
-
|
| 151 |
-
The refactored GVFD is now available in the following formats:
|
| 152 |
-
|
| 153 |
-
* **CSV**: Individual files by value factor category.
|
| 154 |
-
* **JSON**: Both full dataset and country-level breakdowns.
|
| 155 |
-
* **Parquet**: Compact, machine-friendly versions auto-generated for efficiency.
|
| 156 |
-
|
| 157 |
-
Each format is accompanied by metadata documenting units, denominations, and data lineage.
|
| 158 |
|
|
|
|
| 159 |
## Dataset Access Links
|
| 160 |
|
| 161 |
These links are to the roots of the refactored dataset on Hugging Face and are provided for ease of navigation and access:
|
| 162 |
|
|
|
|
|
|
|
| 163 |
| Category | Description | Link |
|
| 164 |
|----------|-------------|------|
|
| 165 |
| **Root Directories** | | |
|
|
@@ -201,6 +155,47 @@ For direct access to individual data files:
|
|
| 201 |
| **Water Consumption** | Water consumption value factors | [Download](https://huggingface.co/datasets/danielrosehill/Global-Value-Factor-Database-Refactor-V2/blob/main/refactored/json/individual-vfs/water-consumption.json) |
|
| 202 |
| **Water Pollution** | Water pollution value factors | [Download](https://huggingface.co/datasets/danielrosehill/Global-Value-Factor-Database-Refactor-V2/blob/main/refactored/json/individual-vfs/water-pollution.json) |
|
| 203 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
## Thanks, Credits
|
| 205 |
|
| 206 |
The GVFD represents a milestone in the effort to measure and assign value to non-traditional impacts. My **Data Analysis Refactoring V2** initiative is intended to extend the usability of IFVI’s work by making the dataset friendlier for modern analysis pipelines.
|
|
|
|
| 18 |
|
| 19 |

|
| 20 |
|
| 21 |
+
This dataset provides V2 of a refactoring of the Global Value Factor Database (GVFD) by the International Foundation for Valuing Impacts intended to enhance the original dataset for machine readability and integration into data analysis and visualization workloads.
|
| 22 |
|
| 23 |

|
| 24 |
|
|
|
|
| 106 |
|
| 107 |
No substantive changes were made to IFVI’s data values or methodologies. However, I applied several light-touch edits to improve usability and consistency:
|
| 108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
+
|
| 111 |
## Dataset Access Links
|
| 112 |
|
| 113 |
These links are to the roots of the refactored dataset on Hugging Face and are provided for ease of navigation and access:
|
| 114 |
|
| 115 |
+
**📖 [User Guide (PDF)](user-guide.pdf)** - Guide to using this dataset including potential use cases to explore
|
| 116 |
+
|
| 117 |
| Category | Description | Link |
|
| 118 |
|----------|-------------|------|
|
| 119 |
| **Root Directories** | | |
|
|
|
|
| 155 |
| **Water Consumption** | Water consumption value factors | [Download](https://huggingface.co/datasets/danielrosehill/Global-Value-Factor-Database-Refactor-V2/blob/main/refactored/json/individual-vfs/water-consumption.json) |
|
| 156 |
| **Water Pollution** | Water pollution value factors | [Download](https://huggingface.co/datasets/danielrosehill/Global-Value-Factor-Database-Refactor-V2/blob/main/refactored/json/individual-vfs/water-pollution.json) |
|
| 157 |
|
| 158 |
+
---
|
| 159 |
+
|
| 160 |
+
# Dataset Parameters
|
| 161 |
+
|
| 162 |
+
## Decimal Value Occurrence
|
| 163 |
+
|
| 164 |
+
These parameters are provided to assist with selecting a decimal value for SQL ingestion. A four decimal float is strongly advised (65% of values).
|
| 165 |
+
|
| 166 |
+
| Decimal Places | Count | Percentage |
|
| 167 |
+
|----------------|-------|------------|
|
| 168 |
+
| 0 (Integers) | 10,062 | 9.62% |
|
| 169 |
+
| 1 | 2,055 | 1.97% |
|
| 170 |
+
| 2 | 18,698 | 17.88% |
|
| 171 |
+
| 3 | 6,260 | 5.99% |
|
| 172 |
+
| 4 | 67,489 | 64.54% |
|
| 173 |
+
|
| 174 |
+
## Geoparameters
|
| 175 |
+
|
| 176 |
+
| Metric | Count | Percentage |
|
| 177 |
+
|--------|-------|------------|
|
| 178 |
+
| **Total unique geolocations** | 268 | 100.0% |
|
| 179 |
+
| **Entities with ISO 3166-1 codes** | 195 | 72.8% |
|
| 180 |
+
| **US states (with state codes)** | 50 | 18.7% |
|
| 181 |
+
| **Non-sovereign entities (no ISO)** | 23 | 8.6% |
|
| 182 |
+
|
| 183 |
+
---
|
| 184 |
+
|
| 185 |
+
## Use-Case Suggestions
|
| 186 |
+
|
| 187 |
+
| Use Case | Description |
|
| 188 |
+
|-----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
|
| 189 |
+
| AI Tools | The JSON array is machine-readable and ideal for ingestion into vector databases for RAG and AI use. A chatbot implementation has been validated. |
|
| 190 |
+
| Data Visualisation | The data is suitable for data visualisation and geovisualisation. |
|
| 191 |
+
| Policy Modelling | Pair the value factors with any geo-labelled dataset (e.g., UN Human Development Index) to map potential effects of impact accounting by policy groups. |
|
| 192 |
+
| Hugging Face Projects| The dataset can be directly ingested into Hugging Face Spaces built with Gradio and Streamlit. |
|
| 193 |
+
| Calculators | Can be paired with calculators to provide impact accounting estimates (ensuring consistent units between source data and value factors). |
|
| 194 |
+
| Correlation Analysis | Pair the value factors with current or historical environmental data to identify correlations between financial and environmental performance. |
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
---
|
| 198 |
+
|
| 199 |
## Thanks, Credits
|
| 200 |
|
| 201 |
The GVFD represents a milestone in the effort to measure and assign value to non-traditional impacts. My **Data Analysis Refactoring V2** initiative is intended to extend the usability of IFVI’s work by making the dataset friendlier for modern analysis pipelines.
|
parametric-data/decimals/decimal_place_analysis.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6bea856abb3bd609df713768b74b198bd1c02e4218b5fbcacfe676ef72f9212e
|
| 3 |
+
size 2709
|
parametric-data/decimals/decimal_place_analysis.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# IFVI Global Value Factors Dataset - Decimal Place Analysis
|
| 2 |
+
|
| 3 |
+
**Analysis Date:** 2025-08-21
|
| 4 |
+
**Total Values Analyzed:** 104,564
|
| 5 |
+
**Files Analyzed:** 5
|
| 6 |
+
|
| 7 |
+
## Overall Decimal Place Distribution
|
| 8 |
+
|
| 9 |
+
| Decimal Places | Count | Percentage |
|
| 10 |
+
|----------------|-------|------------|
|
| 11 |
+
| 0 (Integers) | 10,062 | 9.62% |
|
| 12 |
+
| 1 | 2,055 | 1.97% |
|
| 13 |
+
| 2 | 18,698 | 17.88% |
|
| 14 |
+
| 3 | 6,260 | 5.99% |
|
| 15 |
+
| 4 | 67,489 | 64.54% |
|
| 16 |
+
|
| 17 |
+
## Per-File Breakdown
|
| 18 |
+
|
| 19 |
+
| File | Total Values | 0 Decimal | 1 Decimal | 2 Decimal | 3 Decimal | 4 Decimal |
|
| 20 |
+
|------|-------------|-----------|-----------|-----------|-----------|-----------|
|
| 21 |
+
| air-pollution.json | 7,772 | 67 (0.86%) | 750 (9.65%) | 6,955 (89.49%) | - | - |
|
| 22 |
+
| land-use.json | 7,848 | 139 (1.77%) | 792 (10.09%) | 6,917 (88.14%) | - | - |
|
| 23 |
+
| waste.json | 5,232 | 939 (17.95%) | 425 (8.12%) | 3,868 (73.93%) | - | - |
|
| 24 |
+
| water-consumption.json | 872 | 317 (36.35%) | 44 (5.05%) | 511 (58.60%) | - | - |
|
| 25 |
+
| water-pollution.json | 82,840 | 8,600 (10.38%) | 44 (0.05%) | 447 (0.54%) | 6,260 (7.56%) | 67,489 (81.47%) |
|
| 26 |
+
|
| 27 |
+
## Key Findings
|
| 28 |
+
|
| 29 |
+
- **4 decimal places** is the most common precision (64.54% of all values)
|
| 30 |
+
- **water-pollution.json** contains 79% of the total dataset (82,840 values)
|
| 31 |
+
- **water-consumption.json** has the highest proportion of integers (36.35%)
|
| 32 |
+
- **air-pollution.json** and **land-use.json** show similar patterns with ~89% having 2 decimal places
|
| 33 |
+
- No null values were found in any file
|
| 34 |
+
|
| 35 |
+
## Files Generated
|
| 36 |
+
|
| 37 |
+
- `decimal_place_analysis.json` - Complete structured analysis
|
| 38 |
+
- `decimal_place_summary.csv` - Quick reference CSV
|
| 39 |
+
- `decimal_place_analysis.py` - Analysis script
|
parametric-data/decimals/decimal_place_summary.csv
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Decimal_Places,Count,Percentage
|
| 2 |
+
0,10062,9.62
|
| 3 |
+
1,2055,1.97
|
| 4 |
+
2,18698,17.88
|
| 5 |
+
3,6260,5.99
|
| 6 |
+
4,67489,64.54
|
parametric-data/geodata_analysis.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4cdf1446e7db8a978376c1ea5ff679e6191c1b0d151193791591d9ff23324491
|
| 3 |
+
size 1662
|
parametric-data/geodata_analysis.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# IFVI Global Value Factors Dataset - Geographic Entity Analysis
|
| 2 |
+
|
| 3 |
+
**Analysis Date:** 2025-08-21
|
| 4 |
+
**Source:** processing/remapping/geodata.json
|
| 5 |
+
**ISO Standard:** ISO 3166-1 alpha-3
|
| 6 |
+
|
| 7 |
+
## Geographic Entity Statistics
|
| 8 |
+
|
| 9 |
+
| Metric | Count | Percentage |
|
| 10 |
+
|--------|-------|------------|
|
| 11 |
+
| **Total unique geolocations** | 268 | 100.0% |
|
| 12 |
+
| **Entities with ISO 3166-1 codes** | 195 | 72.8% |
|
| 13 |
+
| **US states (with state codes)** | 50 | 18.7% |
|
| 14 |
+
| **Non-sovereign entities (no ISO)** | 23 | 8.6% |
|
| 15 |
+
|
| 16 |
+
## Entity Type Breakdown
|
| 17 |
+
|
| 18 |
+
| Entity Type | Count | Percentage |
|
| 19 |
+
|-------------|-------|------------|
|
| 20 |
+
| Sovereign Country | 196 | 73.1% |
|
| 21 |
+
| US State | 50 | 18.7% |
|
| 22 |
+
| Non Sovereign | 22 | 8.2% |
|
| 23 |
+
|
| 24 |
+
## ISO Code Coverage
|
| 25 |
+
|
| 26 |
+
- **Entities with standardized codes:** 245 (91.4%)
|
| 27 |
+
- **Entities without codes:** 23 (8.6%)
|
| 28 |
+
|
| 29 |
+
## Regional Distribution
|
| 30 |
+
|
| 31 |
+
| Region | Total | With ISO | Without ISO |
|
| 32 |
+
|--------|-------|----------|-------------|
|
| 33 |
+
| Sub-Saharan Africa | 48 | 48 | 0 |
|
| 34 |
+
| Europe & Central Asia | 58 | 53 | 5 |
|
| 35 |
+
| Latin America & Caribbean | 42 | 33 | 9 |
|
| 36 |
+
| East Asia & Pacific | 38 | 31 | 7 |
|
| 37 |
+
| Middle East & North Africa | 21 | 21 | 0 |
|
| 38 |
+
| South Asia | 8 | 8 | 0 |
|
| 39 |
+
| North America | 3 | 2 | 1 |
|
| 40 |
+
|
| 41 |
+
## Key Findings
|
| 42 |
+
|
| 43 |
+
- **91.4% coverage** with standardized geographic codes
|
| 44 |
+
- **Perfect ISO coverage** in Sub-Saharan Africa, Middle East & North Africa, and South Asia
|
| 45 |
+
- **US states** are handled separately with state codes (18.7% of total entities)
|
| 46 |
+
- **Non-sovereign entities** represent 8.6% of the dataset (territories, dependencies, etc.)
|
| 47 |
+
|
| 48 |
+
## Files Generated
|
| 49 |
+
|
| 50 |
+
- `geodata_analysis.json` - Complete structured analysis
|
| 51 |
+
- `geodata_summary.csv` - Quick reference CSV
|
| 52 |
+
- `geodata_analysis.py` - Analysis script
|
parametric-data/geodata_summary.csv
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metric,Count,Percentage
|
| 2 |
+
Total Geolocations,268,100.0
|
| 3 |
+
With ISO Codes,195,72.8
|
| 4 |
+
US States,50,18.7
|
| 5 |
+
Non-Sovereign,23,8.6
|
processing/geodata_analysis.py
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Parametric analysis of geodata mapping in IFVI Global Value Factors Dataset
|
| 4 |
+
Analyzes the geographic entity distribution and ISO code coverage
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import json
|
| 8 |
+
import os
|
| 9 |
+
from collections import Counter
|
| 10 |
+
|
| 11 |
+
def analyze_geodata():
|
| 12 |
+
"""
|
| 13 |
+
Analyze the geodata.json file for geographic statistics
|
| 14 |
+
"""
|
| 15 |
+
geodata_path = "/home/daniel/repos/hugging-face/IFVI-Global-Value-Factors-Dataset-V2/processing/remapping/geodata.json"
|
| 16 |
+
output_dir = "/home/daniel/repos/hugging-face/IFVI-Global-Value-Factors-Dataset-V2/parametric-data"
|
| 17 |
+
|
| 18 |
+
print("IFVI Global Value Factors Dataset - Geographic Entity Analysis")
|
| 19 |
+
print("=" * 65)
|
| 20 |
+
print()
|
| 21 |
+
|
| 22 |
+
try:
|
| 23 |
+
with open(geodata_path, 'r', encoding='utf-8') as f:
|
| 24 |
+
data = json.load(f)
|
| 25 |
+
|
| 26 |
+
metadata = data.get('metadata', {})
|
| 27 |
+
mapping = data.get('mapping', [])
|
| 28 |
+
|
| 29 |
+
# Extract statistics from metadata
|
| 30 |
+
total_entities = metadata.get('total_entities', 0)
|
| 31 |
+
entity_types = metadata.get('entity_types', {})
|
| 32 |
+
entities_with_iso = metadata.get('entities_with_iso', 0)
|
| 33 |
+
us_states_with_codes = metadata.get('us_states_with_codes', 0)
|
| 34 |
+
|
| 35 |
+
# Calculate additional statistics
|
| 36 |
+
entities_without_iso = total_entities - entities_with_iso - us_states_with_codes
|
| 37 |
+
|
| 38 |
+
# Analyze regions
|
| 39 |
+
region_counts = Counter()
|
| 40 |
+
iso_by_region = Counter()
|
| 41 |
+
non_iso_by_region = Counter()
|
| 42 |
+
|
| 43 |
+
for entity in mapping:
|
| 44 |
+
region = entity.get('region', 'Unknown')
|
| 45 |
+
has_iso = entity.get('has_iso', False)
|
| 46 |
+
entity_type = entity.get('entity_type', 'unknown')
|
| 47 |
+
|
| 48 |
+
region_counts[region] += 1
|
| 49 |
+
|
| 50 |
+
if has_iso:
|
| 51 |
+
iso_by_region[region] += 1
|
| 52 |
+
elif entity_type != 'us_state': # Don't count US states as "without ISO"
|
| 53 |
+
non_iso_by_region[region] += 1
|
| 54 |
+
|
| 55 |
+
# Display results
|
| 56 |
+
print("GEOGRAPHIC ENTITY STATISTICS")
|
| 57 |
+
print("-" * 40)
|
| 58 |
+
print(f"Total unique geolocations: {total_entities:,}")
|
| 59 |
+
print(f"Entities with ISO 3166-1 codes: {entities_with_iso:,}")
|
| 60 |
+
print(f"US states (with state codes): {us_states_with_codes:,}")
|
| 61 |
+
print(f"Non-sovereign entities (no ISO): {entities_without_iso:,}")
|
| 62 |
+
print()
|
| 63 |
+
|
| 64 |
+
print("ENTITY TYPE BREAKDOWN")
|
| 65 |
+
print("-" * 25)
|
| 66 |
+
for entity_type, count in entity_types.items():
|
| 67 |
+
percentage = (count / total_entities) * 100
|
| 68 |
+
print(f"{entity_type.replace('_', ' ').title()}: {count:,} ({percentage:.1f}%)")
|
| 69 |
+
print()
|
| 70 |
+
|
| 71 |
+
print("ISO CODE COVERAGE")
|
| 72 |
+
print("-" * 20)
|
| 73 |
+
total_with_codes = entities_with_iso + us_states_with_codes
|
| 74 |
+
coverage_percentage = (total_with_codes / total_entities) * 100
|
| 75 |
+
print(f"Entities with standardized codes: {total_with_codes:,} ({coverage_percentage:.1f}%)")
|
| 76 |
+
print(f"Entities without codes: {entities_without_iso:,} ({(entities_without_iso/total_entities)*100:.1f}%)")
|
| 77 |
+
print()
|
| 78 |
+
|
| 79 |
+
print("REGIONAL DISTRIBUTION")
|
| 80 |
+
print("-" * 22)
|
| 81 |
+
for region in sorted(region_counts.keys()):
|
| 82 |
+
total_in_region = region_counts[region]
|
| 83 |
+
with_iso = iso_by_region.get(region, 0)
|
| 84 |
+
without_iso = non_iso_by_region.get(region, 0)
|
| 85 |
+
|
| 86 |
+
print(f"{region}:")
|
| 87 |
+
print(f" Total entities: {total_in_region}")
|
| 88 |
+
print(f" With ISO codes: {with_iso}")
|
| 89 |
+
print(f" Without ISO codes: {without_iso}")
|
| 90 |
+
print()
|
| 91 |
+
|
| 92 |
+
# Create structured output
|
| 93 |
+
analysis_results = {
|
| 94 |
+
"analysis_metadata": {
|
| 95 |
+
"timestamp": "2025-08-21T21:20:00+03:00",
|
| 96 |
+
"source_file": "processing/remapping/geodata.json",
|
| 97 |
+
"iso_standard": metadata.get('iso_standard', 'ISO 3166-1 alpha-3')
|
| 98 |
+
},
|
| 99 |
+
"geographic_statistics": {
|
| 100 |
+
"total_unique_geolocations": total_entities,
|
| 101 |
+
"entities_with_iso_codes": entities_with_iso,
|
| 102 |
+
"us_states_with_codes": us_states_with_codes,
|
| 103 |
+
"non_sovereign_entities": entities_without_iso,
|
| 104 |
+
"total_with_standardized_codes": total_with_codes,
|
| 105 |
+
"code_coverage_percentage": round(coverage_percentage, 2)
|
| 106 |
+
},
|
| 107 |
+
"entity_type_breakdown": {
|
| 108 |
+
entity_type: {
|
| 109 |
+
"count": count,
|
| 110 |
+
"percentage": round((count / total_entities) * 100, 2)
|
| 111 |
+
}
|
| 112 |
+
for entity_type, count in entity_types.items()
|
| 113 |
+
},
|
| 114 |
+
"regional_distribution": {
|
| 115 |
+
region: {
|
| 116 |
+
"total_entities": region_counts[region],
|
| 117 |
+
"with_iso_codes": iso_by_region.get(region, 0),
|
| 118 |
+
"without_iso_codes": non_iso_by_region.get(region, 0)
|
| 119 |
+
}
|
| 120 |
+
for region in sorted(region_counts.keys())
|
| 121 |
+
}
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
# Save to JSON
|
| 125 |
+
output_file = os.path.join(output_dir, "geodata_analysis.json")
|
| 126 |
+
with open(output_file, 'w', encoding='utf-8') as f:
|
| 127 |
+
json.dump(analysis_results, f, indent=2, ensure_ascii=False)
|
| 128 |
+
|
| 129 |
+
print(f"Results saved to: {output_file}")
|
| 130 |
+
|
| 131 |
+
# Save summary CSV
|
| 132 |
+
import csv
|
| 133 |
+
csv_file = os.path.join(output_dir, "geodata_summary.csv")
|
| 134 |
+
with open(csv_file, 'w', newline='', encoding='utf-8') as f:
|
| 135 |
+
writer = csv.writer(f)
|
| 136 |
+
writer.writerow(["Metric", "Count", "Percentage"])
|
| 137 |
+
writer.writerow(["Total Geolocations", total_entities, "100.0"])
|
| 138 |
+
writer.writerow(["With ISO Codes", entities_with_iso, f"{(entities_with_iso/total_entities)*100:.1f}"])
|
| 139 |
+
writer.writerow(["US States", us_states_with_codes, f"{(us_states_with_codes/total_entities)*100:.1f}"])
|
| 140 |
+
writer.writerow(["Non-Sovereign", entities_without_iso, f"{(entities_without_iso/total_entities)*100:.1f}"])
|
| 141 |
+
|
| 142 |
+
print(f"Summary CSV saved to: {csv_file}")
|
| 143 |
+
|
| 144 |
+
except Exception as e:
|
| 145 |
+
print(f"Error analyzing geodata: {e}")
|
| 146 |
+
|
| 147 |
+
if __name__ == "__main__":
|
| 148 |
+
analyze_geodata()
|
user-guide.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c775e11d5c4e2c7f528b8923bf5233f4744ba4bb8590ae53ec4bb1b7ee2019b8
|
| 3 |
+
size 168120
|