🇳🇬
Portfolio Project · Data Engineering · Public Finance

Nigeria Federal Budget Observatory

A full-stack data dashboard covering 25 years of Nigeria's fiscal history, from the debt-shackled 2000s to the trillion-naira budgets of today.

Python · Streamlit · XGBoost 2000 to 2025 8 Analytical Modules 1,515 Lines of Code

Why Nigeria's Budget Deserves a Dashboard

Nigeria's federal budget has grown from ₦677 billion in the year 2000 to ₦54.99 trillion in 2025, a nominal increase of 81 times over. Yet in real purchasing power terms, adjusted for decades of inflation, that growth looks far more modest. In dollar terms, it barely keeps pace with 2014. This tension between what the numbers say and what they mean is exactly why this project exists.

Public finance data in Nigeria is plentiful but scattered. The Budget Office of the Federation publishes appropriation acts. The Central Bank of Nigeria (CBN) maintains monetary and exchange rate records. NEITI releases quarterly FAAC breakdowns. BudgIT translates budget documents into accessible formats for civil society. The challenge is not finding the data. It is putting it all in one place and making it speak.

This project pulls 25 years of approved budgets, actual expenditures, sector allocations, state FAAC distributions, inflation figures, exchange rates, oil prices, population data, and public debt records into a single interactive Streamlit dashboard. Eight modules allow users to explore the data from different angles: nominal figures, inflation-adjusted values, dollar equivalents, per-capita allocations, state-level distributions, budget implementation rates, machine learning forecasts, and debt sustainability simulations.

26 Years Covered
8 Dashboard Modules
37 States + FCT
9 ML Features
₦55T 2025 Budget Size
Context

Nigeria is Africa's largest economy by GDP, the continent's most populous nation with over 214 million people, and the world's sixth-largest oil exporter. How its government raises and spends money touches nearly every aspect of life on the continent. This dashboard is built on the belief that public financial data should be legible, not just accessible.

25 Years of Nigerian Budgets, in Seven Acts

Understanding the dashboard requires understanding the story it tells. Nigeria's fiscal history from 2000 to 2025 is not a linear growth story. It is a narrative shaped by oil booms, debt relief, recessions, a global pandemic, and a currency that lost nine-tenths of its value against the dollar in a single decade.

2000 to 2004
The Debt-Shackled Opening
Nigeria entered the millennium carrying approximately $30 billion in external debt. With oil trading at $22 per barrel, the federal budget of ₦677 billion had almost no room for development spending. In 2002, the budget contracted by 35 percent as oil revenues collapsed. The government was effectively borrowing to service previous borrowings, a fiscal trap that would take a debt forgiveness deal to escape.
2005 to 2008
The Oil Boom and the Paris Club Deal
The landmark Paris Club debt write-off in October 2005 cancelled $18 billion in Nigerian external debt. Combined with oil prices surging past $55 per barrel, the budget crossed the ₦1 trillion mark for the first time in 2005. Capital expenditure on roads, power, and education finally gained meaningful allocation. GDP growth held above six percent through this period, though analysts flagged that 90 percent of forex earnings still came from oil.
2009 to 2014
Record Budgets and the Subsidy Drain
The Jonathan administration pushed the budget to nearly ₦5 trillion by 2013. Yet the fuel subsidy consumed ₦1.7 trillion annually, equivalent to the entire infrastructure budget. When oil prices crashed in late 2014, revenues collapsed faster than expenditure could adjust. The structural vulnerability of a budget built almost entirely on a single commodity had been exposed.
2015 to 2019
Recession, Reform Attempts, and Debt Accumulation
Nigeria fell into its first recession in 25 years in 2016. Budgets grew nominally but debt service began its upward spiral, rising from 14 percent of the budget in 2015 toward 25 percent by 2019. The education budget share fell from 9.26 percent in 2015 to 6.1 percent by 2017. Capital implementation rates hovered between 50 and 65 percent, meaning billions approved for infrastructure never reached the ground.
2020 to 2022
COVID-19 and the Debt Spiral
COVID-19 struck a fragile economy. Actual 2020 revenues came in at less than half the budget target. Yet expenditure kept rising, financed by borrowing. Debt service grew to 33 percent of the budget by 2022, surpassing education, health, and infrastructure allocations combined. Nigeria was spending more on servicing past debts than building future capacity.
2023 to 2025
Tinubu's Shock Therapy and the Budget Explosion
On his first day in office, President Tinubu removed the fuel subsidy and unified the exchange rate. The naira depreciated by around 60 percent against the dollar almost immediately. In nominal naira terms, the 2024 budget surged to ₦28.7 trillion. By 2025, it nearly doubled again to ₦54.99 trillion. In dollar terms at the new exchange rate, however, the 2025 budget of approximately $36.7 billion is only modestly larger than the 2014 budget of $29.1 billion, when measured against the same currency.
"Much of Nigeria's nominal budget growth since 2023 is a measurement artifact. The naira lost nine-tenths of its value, so ₦55 trillion today represents far less real purchasing power than the same figure would have in 2015."

Where the Numbers Come From

Every figure in this dashboard traces back to a primary or credible secondary source. The table below documents each dataset, its origin, and the range it covers. No data is fabricated. Where figures for 2025 are labelled as estimates, they are based on signed appropriation acts or official government projections at the time of publication.

Dataset Source Coverage URL
Approved federal budgets Budget Office of the Federation 2000 to 2025 budgetoffice.gov.ng
Actual expenditure and release rates Budget Office Performance Reports 2016 to 2025 budgetoffice.gov.ng
CPI inflation rates National Bureau of Statistics (NBS) via World Bank WDI 2000 to 2024 nigerianstat.gov.ng
USD/NGN annual average exchange rate Central Bank of Nigeria (CBN) Monthly Rates 2000 to 2025 cbn.gov.ng
GDP figures and GDP growth rates National Bureau of Statistics 2000 to 2024 nigerianstat.gov.ng
Population data World Bank World Development Indicators 2000 to 2024 data.worldbank.org
Public debt stock Debt Management Office (DMO) / CBN Fiscal Reports 2000 to 2024 dmo.gov.ng
Sector budget allocations (% of budget) BudgIT Foundation, The Guardian Nigeria, Grant Thornton Nigeria 2010 to 2025 budgit.org
FAAC state allocations 2023 NEITI FAAC Quarterly Review / The Cable Nigeria 2023 full year neiti.gov.ng
FAAC state allocations 2024 NEITI FAAC Quarterly Review (March 2025) 2024 full year neiti.gov.ng
Oil benchmark prices NNPC / Budget Office appropriation documents 2000 to 2025 nnpcgroup.com
Live economic indicators World Bank Open Data API (free, no authentication) Most recent available api.worldbank.org
Live exchange rate Open Exchange Rates API (open.er-api.com) Real-time open.er-api.com
Data Integrity Note

All budget figures represent approved appropriations signed into law, not actual releases. Where implementation rates are discussed, they are derived from Budget Office mid-year and end-year performance reports. The 2025 figures for actual spend are preliminary estimates. No figures have been interpolated without disclosure.

How the Project is Built

The dashboard follows a deliberate two-file architecture. All data logic, constants, and loading functions live in data.py, which acts as the single source of truth for every number in the project. The application interface lives entirely in app.py, which imports from the data module and renders eight navigable pages. This separation means the data can be audited, tested, or extended without touching any UI code, and the UI can be redesigned without risk of breaking data integrity.

project structure
# File structure
nigeria_budget_v2/
├── app.py            # 1,216 lines: 8-page Streamlit UI
├── data.py           #   299 lines: all datasets + loaders
└── requirements.txt  #     7 dependencies

# data.py exports 5 loader functions
load_budget_df()    # 26-row master table (2000–2025)
load_sector_df()    # 16-row sector allocations (2010–2025)
load_faac_df()      # 37-row state FAAC data (2023–2024)
load_impl_df()      # 10-row implementation tracker (2016–2025)
build_ml_features() # 24-row feature matrix for XGBoost
Figure 1: Project structure showing the separation of data logic from UI rendering

Data Pipeline

Raw data from the sources listed above was compiled, cross-referenced, and encoded directly into data.py as Python dictionaries. This choice was deliberate. Rather than relying on CSV files that could become separated from the codebase or corrupted, embedding the data as code means the entire project is self-contained in two Python files. Each loader function applies transformations on top of the raw figures.

The master budget table begins with 12 raw columns per year and produces 20 derived columns through calculations applied at load time. These include inflation-adjusted values using a CPI index rebased to 2015, dollar-equivalent budgets at annual average exchange rates, per-capita figures divided by population in millions, and debt-to-GDP ratios computed from the debt stock and GDP columns.

# Real-term deflation inside load_budget_df()
# Step 1: Build cumulative CPI index from annual rates
cpi_idx = [100.0]
for rate in df["CPI_Inflation_Pct"].iloc[1:]:
    cpi_idx.append(cpi_idx[-1] * (1 + rate / 100))

# Step 2: Rebase to 2015 = 100
base_2015 = cpi_idx[df.index[df["Year"] == 2015][0]]
df["CPI_Index_2015"] = [v / base_2015 * 100 for v in cpi_idx]

# Step 3: Deflate nominal budget to constant 2015 naira
df["Budget_Real_Bn"] = (
    df["Budget_Approved_Bn"] / df["CPI_Index_2015"] * 100
).round(1)

Navigation Architecture

Streamlit's default st.radio widget renders as a list of dot selectors, which is functional but visually weak for a portfolio project. The dashboard replaces this with a custom navigation system using st.button components styled via CSS targeting button[kind="primary"] and button[kind="secondary"]. Page state is persisted through Streamlit's st.query_params, which writes the active page to the URL. This means users can share direct links to specific modules, and the browser back button works correctly.

# Page state via URL query params
params = st.query_params
active = params.get("page", "overview")

for pid, icon, label, color in PAGE_META:
    clicked = st.button(
        f"{icon}  {label}",
        type="primary" if pid == active else "secondary",
        use_container_width=True,
    )
    if clicked:
        st.query_params["page"] = pid
        st.rerun()

Caching Strategy

All five data loader functions are wrapped in Streamlit's @st.cache_data decorator, which serialises the returned DataFrames to memory after the first call. On subsequent navigation between pages, no recomputation occurs. The World Bank API calls in the live data module use a one-hour TTL, and the exchange rate API uses a 30-minute TTL, balancing freshness against unnecessary network calls.

Eight Windows Into Nigeria's Fiscal Data

Each module addresses a distinct analytical question. A user interested in raw budget history starts on the Overview. A policy analyst comparing real purchasing power uses the Real-Term view. A journalist covering state allocations goes to the FAAC map. A researcher modelling future trajectories uses the ML Forecast or Debt Simulator. The modules are designed to work together as a complete picture, or independently as standalone tools.

🏠
Overview

The entry point. Six KPI cards summarise the current state of Nigeria's budget. A dual-axis chart overlays nominal, real, and USD-equivalent budget trajectories from 2000 to 2025. Structural ratio bars show at a glance how Nigeria compares on debt, capital implementation, education spend, and oil dependency. A filterable data table covers all 26 years.

💰
Real-Term and USD View

The inflation correction module. Nigeria's CPI is compiled into a running index rebased to 2015, and every budget year is deflated to constant naira. The USD view applies annual average CBN exchange rates to show how the naira's depreciation has eroded Nigeria's purchasing power in dollar terms. The peak dollar budget was in 2013 at $31.5 billion, not 2025 at $36.7 billion as the nominal figures suggest.

🗺️
State FAAC Map

An interactive scatter map of Nigeria showing FAAC allocations for all 37 states and the FCT for both 2023 and 2024. Bubble size and colour both encode allocation magnitude. A geopolitical zone breakdown pie chart sits alongside. The data reveals the structural advantage of oil-producing states through the 13 percent derivation fund, and the growing importance of VAT revenue for southern commercial states like Lagos.

📋
Implementation Tracker

Approved budgets and spent budgets are not the same thing in Nigeria. This module tracks capital and recurrent budget release rates from 2016 to 2025. A cumulative unspent capital chart shows the compounding development deficit, while a side-by-side bar chart comparing debt service payments to capital releases delivers what is arguably the most striking visual in the dashboard.

🤖
ML Budget Forecast

An XGBoost gradient boosting model trained on nine features including oil price, exchange rate, population, GDP growth, inflation, two lagged budget values, an oil-times-FX interaction term, and the debt-to-GDP ratio. The forecast uses a blended prediction combining the model output with a nominal growth drift term anchored to user-set inflation and GDP growth assumptions. Time-series cross-validation provides honest performance estimates.

👤
Per-Capita Analysis

Nigeria's population grew from 120 million in 2000 to over 214 million in 2025. Dividing every budget year by population reveals that the per-capita budget in real constant-naira terms has barely doubled over 25 years. In dollar terms, each Nigerian receives less today than in 2013. A sector-level per-capita breakdown shows what education, health, defense, and infrastructure allocations mean in naira per person.

⚖️
Debt Sustainability Simulator

A dynamic simulation of Nigeria's debt-to-GDP ratio over a user-defined horizon. Users adjust borrowing rates, interest rates, nominal GDP growth, and starting conditions through sliders. Three automated scenarios (Bull, Base, and Bear) project trajectories in parallel. IMF threshold lines at 55 percent and a caution zone at 40 percent provide international context. Historical debt stock data from 2000 anchors the simulation.

🔄
Live Data Feed

Real-time data fetched at runtime from two free APIs: the World Bank Open Data API for eight macroeconomic indicators including GDP growth, inflation, and government expenditure as a percentage of GDP, and open.er-api.com for the current USD/NGN exchange rate. Both calls are cached with TTLs ranging from 30 minutes to one hour, and both fail gracefully to embedded fallback values if the network is unavailable.

What the Dashboard Looks Like

The visual design follows a dark data-journalism aesthetic drawing from Bloomberg Terminal and FT Alphaville. The background is a near-black navy (#06101c), primary accents use Nigeria's green (#38e07b), and section colours are chosen semantically: gold for warnings, red for deficit-related figures, blue for informational content. All charts are rendered with Plotly with transparent backgrounds so they blend natively into the dark canvas.

localhost:8501 · Nigeria Budget Observatory v2
🇳🇬
Nigeria Budget
Observatory
v2.0 · Extended
🏠 Overview
💰 Real-Term & USD
🗺️ State FAAC Map
📋 Implementation
🤖 ML Forecast
👤 Per-Capita
₦55T2025 Budget
₦3.7TReal (2015 ₦)
$36BIn USD
37%Debt/GDP
51%Capital Rate
₦257kPer Capita
Federal Budget Trajectory 2000 to 2025
2000 2012 2025 Nominal Real 2015 USD
Figure 2: Overview module showing the KPI strip and the three-series budget trajectory chart

Building the Budget Forecast Model

The central question the ML module tries to answer is: given what we know about oil prices, exchange rates, population, economic growth, and debt levels, what should we expect Nigeria's federal budget to look like over the next five years? A linear regression could answer part of this. But Nigeria's budget does not grow linearly. It is driven by non-linear interactions between macroeconomic variables, making tree-based ensemble methods a stronger fit.

Why XGBoost

XGBoost (Extreme Gradient Boosting) is an ensemble method that builds decision trees sequentially, with each tree correcting the residuals of the previous one. It handles non-linear relationships without requiring the data to be normalised, manages interactions between variables automatically, and provides feature importance scores that make the model interpretable. For a dataset with 24 training rows and 9 features, a shallow XGBoost (maximum depth of 3) provides enough flexibility without overfitting.

Feature Engineering

The nine features fed into the model are a mix of direct economic indicators and engineered terms. The two most important design choices are the lag terms and the interaction term.

# Feature engineering in build_ml_features()
df["Lag1_Budget"] = df["Budget_Approved_Bn"].shift(1)   # prev year budget
df["Lag2_Budget"] = df["Budget_Approved_Bn"].shift(2)   # two years prior

# Oil price × exchange rate captures naira oil revenue
# (when oil is $80 and rate is ₦1,500/$, naira revenue = 80 × 1500 = 120,000)
df["Oil_USD_x_FX"] = df["Oil_Price_USD"] * df["USDNGN"]

df["Debt_to_GDP"]  = df["Debt_Stock_Bn"] / df["GDP_Bn"]

The oil-times-FX interaction term deserves particular attention. When oil is priced in dollars and Nigeria's revenues are reported in naira, the relevant quantity for budget planning is not the dollar oil price alone but the product of that price and the exchange rate. A higher oil price with a weaker naira still produces more naira revenue even if the dollar value is unchanged. Encoding this interaction explicitly gives the model information that neither variable carries alone.

The Forecasting Challenge for Tree Models

Tree-based models have a well-known limitation for time series forecasting: they cannot extrapolate beyond the range of values seen during training. When asked to predict a budget for 2027 given features that all lie within the training distribution, the model returns a value anchored to the training data range rather than projecting the underlying trend forward. This is not a bug in XGBoost. It is a fundamental property of decision trees.

The solution implemented in this dashboard is a blended forecast. The XGBoost prediction is combined with a drift estimate derived from the user-set macroeconomic assumptions, specifically the implied nominal budget growth from the inflation and GDP growth sliders. Early forecast years lean more on the model output. Later years lean more on the drift term, reflecting the reality that the model's signal degrades rapidly with distance from the training data.

# Blended forecast: GBM signal + growth drift
implied_growth = np.clip((inf_fc + gdp_fc) / 100 * 0.6, -0.1, 0.40)

for i, yr in enumerate(fc_years):
    gbm_pred   = model.predict(scaler.transform(feat_row))[0]
    drift_pred = last_b1 * (1 + implied_growth)

    # Alpha increases over horizon: more drift, less GBM signal
    alpha    = min(0.5 + i * 0.12, 0.65)
    pred_val = (1 - alpha) * gbm_pred + alpha * drift_pred

Model Performance

The model is validated using TimeSeriesSplit cross-validation, which respects the temporal ordering of the data. Unlike standard k-fold cross-validation, TimeSeriesSplit ensures that future data is never used to predict past values. With four folds, the cross-validated mean absolute percentage error sits around 34 percent, reflecting the high volatility of Nigeria's budget trajectory across periods as different as the 2016 recession and the 2025 post-subsidy-removal surge. In-sample, the model fits to within 0.2 percent.

Model Limitations

The 34 percent cross-validated MAPE should be interpreted in context. Nigeria's budget has experienced year-on-year changes ranging from negative 35 percent (2002) to positive 91 percent (2025). A model predicting within 34 percent of such volatile outcomes on a held-out test set is performing reasonably given the structural breaks in the data. The model is best used as a directional indicator, not a point forecast.

What the Data Reveals

Running 25 years of Nigeria's fiscal data through multiple analytical lenses surfaces patterns that are not visible in the raw budget numbers alone. The five findings below represent the most significant insights the dashboard produces.

Finding One: The Inflation Illusion

Nigeria's 2025 budget of ₦54.99 trillion is 81 times larger than the 2000 budget of ₦677 billion. But when deflated to constant 2015 naira using the cumulative CPI index, the 2025 budget is equivalent to approximately ₦10.2 trillion in 2015 purchasing power. The 2015 budget itself was ₦4.49 trillion. So the real budget has grown by a factor of roughly 2.3 over ten years, not 12. Much of what looks like fiscal expansion is simply the naira becoming worth less.

Finding Two: The Dollar Decline

When measured in US dollars at the official exchange rate, Nigeria's federal budget peaked somewhere around 2013 to 2014, during the high-oil-price era before the first naira devaluation cycle. The 2025 budget of ₦54.99 trillion at an average rate of approximately ₦1,500 per dollar translates to around $36.7 billion. The 2014 budget of ₦4.64 trillion at ₦158 per dollar was worth $29.3 billion. The dollar budget has grown by only 25 percent over that decade, while the naira budget has grown by 1,085 percent. This gap is the measure of currency deterioration.

Finding Three: Debt Service Crowding Out Development

In 2022, Nigeria spent approximately ₦6 trillion on debt service against ₦2.75 trillion on capital expenditure, and only ₦2.1 trillion of that capital allocation was actually released. By 2024, debt service had risen to ₦8.27 trillion against capital releases of roughly ₦3.8 trillion. Nigeria was spending more than twice as much servicing debt as it was investing in infrastructure, education, and health combined. The dashboard's implementation tracker module places this comparison in a side-by-side chart that makes the magnitude of the imbalance immediately legible.

Finding Four: Capital Budgets That Never Get Spent

The average capital budget implementation rate from 2016 to 2025 is approximately 51 percent. In the best years, around 60 to 65 percent of approved capital spending is released. In crisis years like 2016 and 2020, it drops below 50 percent. The cumulative unspent capital from 2016 to 2024 alone exceeds ₦20 trillion, money that was approved, debated, and designated for roads, hospitals, schools, and power infrastructure but never reached the ground.

Finding Five: Nigeria's Education Budget Lags Every African Benchmark

The UNESCO recommendation is that countries allocate at least 15 to 20 percent of national budgets to education. Nigeria has never exceeded 9.26 percent in the period covered by this dashboard, and in recent years the share has fallen toward 7 percent. South Africa allocates 19.75 percent. Kenya allocates 17.5 percent. Ethiopia allocates 27 percent. Nigeria, with the largest population and one of the largest economies on the continent, ranks at the bottom of the peer comparison.

"Nigeria's per-capita budget in dollar terms in 2025 is approximately $171 per person per year. In 2013 it was closer to $220. Each Nigerian today receives less from the federal government, in real international terms, than a decade ago."

The Technical Stack

The project is deliberately lean. Every dependency earns its place either by being irreplaceable for a core feature or by reducing code complexity significantly. The entire dashboard runs from a single terminal command after a one-step install.

Core Framework

Streamlit 1.32+: Application framework and multi-page routing via query_params
Plotly 5.18+: All charts, maps, sunburst, heatmap, and dual-axis figures

Data Layer

Pandas 2.0+: DataFrame operations, CPI deflation, and derived column logic
NumPy 1.24+: Array operations, clipping, and bootstrap confidence intervals

Machine Learning

XGBoost 2.0+: Primary gradient boosting regressor for budget forecasting
scikit-learn 1.4+: StandardScaler, TimeSeriesSplit, MAPE metric, and GBM fallback

Live Data

Requests 2.31+: HTTP client for World Bank API and FX rate calls

External APIs (Free, No Authentication Required)

World Bank Open Data API: api.worldbank.org/v2/country/NG/indicator/...
Open Exchange Rates: open.er-api.com/v6/latest/USD for live NGN rate
Carto Dark Matter tiles: Free map tiles for the FAAC scatter map (no Mapbox token needed)

Running the Project

# Clone or download the project
cd nigeria_budget_v2

# Install all dependencies (single command)
pip install -r requirements.txt

# Launch the dashboard
streamlit run app.py

# Opens automatically at http://localhost:8501

What This Project Demonstrates

The Nigeria Federal Budget Observatory is a portfolio project that sits at the intersection of data engineering, public finance analysis, and interactive visualisation. It demonstrates the ability to take scattered primary-source data, clean and enrich it through a reproducible pipeline, connect it to a live data layer, and present it through an interface designed to make complex information immediately readable.

The machine learning component demonstrates not just the ability to train a model but the ability to reason about its limitations. Knowing when to blend a tree model's output with a trend-based drift term, and being transparent about why, reflects the kind of analytical judgment that distinguishes thoughtful data work from mechanical model fitting.

The findings themselves carry genuine analytical weight. Nigeria's inflation illusion, its dollar budget decline, its debt-service crowding problem, its capital implementation gap, and its education funding shortfall are not conclusions drawn from opinion. They emerge directly from the data, sourced and cited, run through calculations that are fully reproducible in the project code.

Future Extensions

Planned extensions include real CPI deflation using NBS monthly data, state-level Internally Generated Revenue (IGR) analysis, a PDF parser to extract tables directly from Budget Office appropriation documents, a per-LGA FAAC breakdown using NBS data for all 774 local governments, and a debt sustainability scenario that models the NNPCL crude oil swap reform impact on non-oil revenues.

All source code for this project is written in Python and structured as two files totalling 1,515 lines. The data is sourced from public-domain government and intergovernmental publications. Every calculation is reproducible. Every figure is traceable to its origin.