Datasets:
Formats:
parquet
Languages:
English
Size:
100K - 1M
Tags:
isora
international-survey-on-revenue-administration
tax-administration
revenue-administration
tax-authority
taxation
License:
File size: 4,434 Bytes
cbd273f 9f0fcd7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | """Constants shared by the pipeline: API endpoints, dataflows, rounds, sentinel codes, paths."""
from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
PROJECT_ROOT = Path(__file__).resolve().parents[2]
RAW_DIR = PROJECT_ROOT / "raw"
RAW_DATA_DIR = RAW_DIR / "data"
RAW_STRUCTURES_DIR = RAW_DIR / "structures"
OUT_DIR = PROJECT_ROOT / "hf_dataset"
SDMX3_BASE = "https://api.imf.org/external/sdmx/3.0"
SDMX21_BASE = "https://api.imf.org/external/sdmx/2.1"
AGENCY = "ISORA"
USER_AGENT = "isora-hf/0.1 (+https://huggingface.co; data pipeline; contact via dataset card)"
ISORA_PORTAL_URL = "https://data.imf.org/en/datasets/ISORA:ISORA_LATEST_DATA_PUB"
TERMS_URL = "https://data.imf.org/en/Datasets/RAFIT-Consolidated/Terms-and-Conditions"
DISCLAIMER_URL = "https://data.imf.org/en/Datasets/RAFIT-Consolidated/Disclaimer"
ABOUT_URL = "https://data.imf.org/en/Datasets/RAFIT-Consolidated/About-RA-FIT"
@dataclass(frozen=True)
class Dataflow:
"""One published ISORA dataflow (a questionnaire generation)."""
id: str
version: str
dsd_version: str
generation: str # human-readable questionnaire generation
fiscal_years: tuple[int, ...]
geo_dimension: str # COUNTRY (numeric IMF codes) or JURISDICTION (alpha-3)
indicator_codelist: str
form_status_attr: str
DATAFLOWS: tuple[Dataflow, ...] = (
Dataflow(
id="ISORA_2016_DATA_PUB",
version="2.0.0",
dsd_version="1.0.0",
generation="ISORA 2016",
fiscal_years=(2014, 2015),
geo_dimension="COUNTRY",
indicator_codelist="CL_INDICATOR",
form_status_attr="FORM_STATUS",
),
Dataflow(
id="ISORA_2018_DATA_PUB",
version="2.0.0",
dsd_version="2.0.0",
generation="ISORA 2018",
fiscal_years=(2016, 2017),
geo_dimension="JURISDICTION",
indicator_codelist="CL_ISORA_TAX",
form_status_attr="FORMSTATUS",
),
Dataflow(
id="ISORA_LATEST_DATA_PUB",
version="5.0.0",
dsd_version="6.0.0",
generation="ISORA 2020+",
fiscal_years=(2018, 2019, 2020, 2021, 2022, 2023, 2024),
geo_dimension="JURISDICTION",
indicator_codelist="CL_ISORA_TAX",
form_status_attr="FORMSTATUS",
),
)
# Older published versions of the consolidated dataflow, still served by the API.
# They are earlier release vintages of the same FY2018+ series and let us track revisions.
VINTAGES: tuple[tuple[str, str, str], ...] = (
# (dataflow version, release label, fiscal years covered)
("2.0.0", "ISORA 2023 release (FY2018-FY2022)", "2018-2022"),
("4.0.0", "ISORA 2024 release (FY2018-FY2023)", "2018-2023"),
("5.0.0", "ISORA 2025 release (FY2018-FY2024)", "2018-2024"),
)
# Fiscal year -> survey round in which that fiscal year was first collected.
FISCAL_YEAR_TO_ROUND: dict[int, str] = {
2014: "ISORA 2016",
2015: "ISORA 2016",
2016: "ISORA 2018",
2017: "ISORA 2018",
2018: "ISORA 2020",
2019: "ISORA 2020",
2020: "ISORA 2021",
2021: "ISORA 2022",
2022: "ISORA 2023",
2023: "ISORA 2024",
2024: "ISORA 2025",
}
# Published participation counts (About ISORA page + ISORA 2025 news item), for the card.
ROUND_PARTICIPATION: dict[str, int] = {
"ISORA 2016": 135,
"ISORA 2018": 159,
"ISORA 2020": 156,
"ISORA 2021": 156,
"ISORA 2022": 165,
"ISORA 2023": 166,
"ISORA 2024": 164,
"ISORA 2025": 166,
}
# Sentinel strings found in the OBSERVATION column.
NOT_AVAILABLE_CODES = frozenset({"D"})
NOT_APPLICABLE_STRINGS = frozenset({"not applicable", "n/a", "na"})
UNRECOGNIZED_CODES = frozenset({"P"}) # ISORA 2016 only; not documented in surviving material
# DissemScale annotation -> normalized indicator type
INDICATOR_TYPE_MAP: dict[str, str] = {
"binary": "binary",
"counting": "count",
"currency": "currency",
"percent": "percent",
"nominal": "nominal",
"ordinal": "ordinal",
"text": "text",
"date": "date",
"na": "unspecified",
"": "unspecified",
}
# Derived level aggregates in the consolidated dataflow that are published in thousands of local
# currency with SCALE=0 (verified: they equal ~1/1000 of net revenue x cost-of-collection ratio),
# unlike the raw money questions which carry SCALE=3 and are already in base units.
LATEST_THOUSANDS_CODES = frozenset({"337_176", "337_177", "337_178", "337_179"})
|