Global Earthquake Monitor
A daily, fully automated Bronze → Silver → Gold pipeline that pulls seismic events from the USGS API, geo-enriches them with PySpark and maps them in Power BI.
2,059
earthquakes mapped in a week
Daily
automated refresh
3
medallion layers
Platform
Microsoft Fabric
Stack
- Microsoft Fabric
- PySpark
- Delta Lake
- Data Factory
- REST API
- Power BI
Context
In this project I built an end-to-end pipeline that processes seismic events from the United States Geological Survey (USGS) API. The goal was to extract, transform and analyse this data to produce an interactive Power BI report visualising earthquake activity worldwide.
I implemented the Medallion architecture: raw data lands in the Bronze layer for traceability, the Silver layer cleans, transforms and validates it, and the Gold layer refines it into a business-ready format optimised for reporting.
Storage and processing run on the Spark engine, while Azure Data Factory automates the orchestration of ingestion and transformation. The final dataset feeds a Power BI dashboard with insights on magnitude, location and frequency.
Solution architecture
- USGS API
- Bronze
- Silver
- Gold
- Power BI
- Step 01Source
Data collection — USGS API
I first set up a lakehouse named
earthquakes_lakehouseto store raw seismic data from the USGS API. It is the foundation for structuring the data with the Medallion architecture. Ingestion is done from a notebook in the lakehouse, using Python to call:HTTPGET https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=2014-01-01&endtime=2014-01-02The data is then stored as Delta Lake tables, which bring ACID transactions, schema enforcement and time travel — a reliable, scalable format for the next stages.
- Step 02Bronze
Bronze layer — raw storage
A Python script retrieves earthquake events from the API and stores them in the Bronze layer, over a rolling 7-day window so the dataset stays current.
- 01Dynamic dates —
start_dateis seven days ago andend_dateis yesterday; both are later parameterised from Data Factory. - 02API request — the script builds the URL with these dates, requests GeoJSON and keeps only the
featuresfield, which holds the events. - 03Lakehouse storage — on success, the events are saved as JSON in
/lakehouse/default/Files/with a dated filename (YYYY-MM-DD_earthquake_data.json).
The JSON file is then loaded into a Spark DataFrame so the data can be progressively refined through the Medallion layers.
- 01Dynamic dates —
- Step 03Silver
Silver layer — transformation
In the Silver layer the raw events are cleaned and structured: relevant attributes are extracted and meaningful transformations applied.
- 01Extracting fields — nested JSON is flattened and renamed, focusing on location (latitude, longitude, elevation), magnitude, significance, timestamps and descriptions.
- 02Reshaping —
geometry.coordinatesis split into longitude, latitude and elevation;propertiesprovides title, place, significance (sig), magnitude (mag), magnitude type (magType) and timestamps.
- 01Readable timestamps —
timeandupdatedare stored as Unix epoch milliseconds and converted to standard timestamps. - 02Silver table — the cleaned data is persisted to
earthquake_events_silverin append mode, so new events are added without overwriting history. - 03Querying — the Silver table can be explored with SQL directly in the lakehouse.
- Step 04Gold
Gold layer — enrichment
- →Only recent events (after
start_date) are read from Silver for processing. - →The country code is derived from latitude and longitude with the
reverse_geocoderlibrary. - →Because Spark works on distributed data,
get_country_codeis registered as a UDF to be used in transformations.
- 01Country code —
get_country_code_udfadds acountry_codecolumn for geographic analysis. - 02Significance classes — events are classified as Low (
sig < 100), Moderate (100 ≤ sig < 500) or High (sig ≥ 500). - 03Gold table — the refined DataFrame is appended to
earthquake_events_gold.
- →Only recent events (after
- Step 05Orchestration
Orchestration — Data Factory pipeline
A Data Factory pipeline runs the three notebooks every day, in order:
- 01Bronze Notebook — runs the raw ingestion with dynamic parameters:
start_date→ yesterday,end_date→ today. - 02Silver Notebook — chained on success, receives
start_date. - 03Gold Notebook — chained on success, receives
start_date.
The whole workflow is now automated: Bronze, Silver and Gold run sequentially on a schedule, so fresh earthquake data is available every day without manual intervention.
- 01Bronze Notebook — runs the raw ingestion with dynamic parameters:
- Step 06Gold
Semantic modelling
On top of the Gold layer, a semantic model defines relationships and calculated measures so that analysis and visualisation in Power BI are efficient.
- Step 07Serving
Power BI report
The final report visualises global seismic activity. Users filter by date range and significance (High, Moderate, Low); the map sizes each bubble by significance, and KPIs show the total number of earthquakes and the maximum significance.
Summary
This project automates the ingestion, transformation and visualisation of earthquake data on a lakehouse architecture. Data Factory pulls daily data from the USGS API, processes it through Bronze, Silver and Gold, and enriches it with geolocation before it reaches a semantic model and Power BI.
The diagram below summarises the full flow, from raw ingestion to the automatically refreshed report.
Next project · 03
Real-Time Weather Stream
Streaming · Spark Structured Streaming