Skip to content

Commit

Permalink
🐛 fix non-humanitarian aid aggregation
Browse files Browse the repository at this point in the history
  • Loading branch information
paarriagadap committed Oct 7, 2024
1 parent 7a3fdc6 commit e243cae
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
INDEX_SECTORS = ["donor_name", "recipient_name", "year", "sector_name"]
INDEX_CHANNELS = ["donor_name", "recipient_name", "year", "channel_name"]

# Define mapping for sectors, including new names, sub-sectors, and sectors.
SECTORS_MAPPING = {
"I.1.a. Education, Level Unspecified": {
"new_name": "I.1.a. Education, level unspecified",
Expand Down Expand Up @@ -231,6 +232,20 @@
},
}

# Define main categories for sectors
SECTORS_MAIN_CATEGORIES = [
"I. Social infrastructure and services",
"II. Economic infrastructure and services",
"III. Production sectors",
"IV. Multisector/cross-cutting",
"VI. Commodity aid / General programme assistance",
"VII. Action relating to debt",
"VIII. Humanitarian aid",
"IX. Unallocated / unspecified",
"Administrative costs of donors",
"Refugees in donor countries",
]

# Define channel categories coming from ONE
CHANNEL_CATEGORIES = {
"1": "Public sector",
Expand Down Expand Up @@ -405,6 +420,9 @@ def add_non_humanitarian_aid_and_total(tb: Table) -> Table:
tb_total = tb.copy()
tb_humanitarian = tb.copy()

# Filter tb_total by SECTORS_MAIN_CATEGORIES
tb_total = tb_total[tb_total["sector_name"].isin(SECTORS_MAIN_CATEGORIES)].reset_index(drop=True)

# Define INDEX_SECTORS without sector_name
INDEX_WITHOUT_SECTOR_NAME = [col for col in INDEX_SECTORS if col != "sector_name"]

Expand Down

0 comments on commit e243cae

Please sign in to comment.