π‘ Executive Summary: South America's maritime logistics landscape is undergoing an epochal transformation. The commissioning of the Megapuerto de Chancay (Terminal Portuario MultipropΓ³sito de Chancay) establishes the first direct deepwater maritime corridor between South America and Asia-Pacific. By circumventing traditional transshipment detours through North America (Manzanillo and Long Beach), Chancay slashes ocean transit times from 35β42 days down to 22β28 days. In this article, we explain how we engineered an interactive Business Intelligence and Maritime Operations Dashboard in pure Python using Streamlit, Plotly, and Seaborn, backed by 2,400 validated container shipments from APN & Drewry, an automated GitHub Actions CI/CD GitOps pipeline, and continuous cloud deployment.
Project Links:
π Live Cloud Dashboard Β· π¦ GitHub Repository Β· π§ͺ Automated CI Pipeline Β· π APN & Terminal Metadata
π’ The Maritime Logistics Challenge: Chancay vs. Callao
The efficiency of international trade corridors depends directly on maritime routing, port infrastructure, and terminal handling speed. For supply chain planners, shipping lines, and export executives, traditional operational questions are inherently multi-variable:
- How do trans-Pacific ocean transit times and freight tariffs ($/TEU) differ across commercial merchandise types (e.g., cold-chain agroexport reefers vs. bulk mineral concentrates)?
- What is the impact of yard congestion and dwell times on container detention penalties (demurrage)?
- How many millions of dollars can exporters recover in in-transit inventory working capital by migrating cargo from feeder transshipment routes to direct express services?
- What quantifiable carbon footprint ($CO_2$) reduction is achieved by eliminating vessel detour legs through Central and North America?
For more than a century, the Puerto del Callao (operated by APM Terminals and DP World) has concentrated over 70% of Peru's containerized international commerce. Despite continuous investments, Callao faces immutable structural constraints:
- Urban Congestion & Gate Dwell Times: Access to Callao is constricted by the dense Lima-Callao metropolitan road grid, generating terminal dwell times of 30 to 48 hours and severe demurrage expenses.
- Draft Limitations & Transshipment Detours: With drafts capped at 16.0 meters, Callao cannot accommodate fully laden Ultra Large Container Vessels (ULCVs up to 24,000 TEUs). Cargo bound for Shanghai, Ningbo, or Qingdao must transship via Manzanillo (Mexico) or Long Beach (USA), extending ocean voyages to 34β45 days.
- The Chancay Deepwater Revolution: Situated 80 km north of Lima, the Megapuerto de Chancay (Cosco Shipping Ports) features an exceptional natural draft of 17.8 meters, automated rail-mounted gantry cranes (ARMG), and a 1.8 km dedicated subterranean tunnel isolating freight traffic from urban congestion. The result is the first direct maritime express corridor between South America and Asia, completing voyages in 22β28 days.
Static PDF reports and spreadsheet exports cannot answer dynamic what-if engineering scenarios: What happens to total supply chain expenditure if 45% of Callao's container volume migrates to Chancay? What are the net savings in vessel bunker fuel and $CO_2$ emissions?
To answer these questions, we designed an interactive web dashboard that transforms raw maritime operations data into an accessible, real-time exploratory decision tool.
π οΈ Selecting the Toolchain: The Case for Streamlit + Plotly
When developing analytical platforms for supply chain intelligence, visualization frameworks present distinct architectural tradeoffs:
| Visualization Framework | Primary Strength | Architectural Consideration | Fit for this Project |
|---|---|---|---|
| Seaborn / Matplotlib | In-depth statistical plotting in Jupyter notebooks | Static bitmaps, lacks interactive UI controls | Integrated specifically for terminal dwell boxplot analysis |
| PowerBI / Tableau | Established proprietary enterprise BI | High per-seat licensing, vendor lock-in, limited custom financial simulation algorithms | Unsuitable for open GitOps workflows |
| Dash (Plotly) | Enterprise full-stack reactive applications | Demands explicit Flask boilerplate, CSS layouts, and callback decorators | Powerful, but slower iteration velocity for rapid prototyping |
| Streamlit | Converts Python scripts into reactive web applications with zero HTML/JS | Executes top-to-bottom; relies on @st.cache_data for high performance |
Chosen tool: Fast declarative UI, seamless Plotly integration, pure Python ecosystem |
Combining Streamlit for application layout and Plotly for hardware-accelerated interactive visualizations allowed us to build an executive-grade analytics platform with sub-second filter response times.
β The Maritime Data Layer: APN & Drewry Benchmarks (2023β2025)
Rather than simulating synthetic dummy variables, the dashboard is anchored by 2,400 validated container consignments modeled on official benchmarks from the Autoridad Portuaria Nacional del PerΓΊ (APN) and the Drewry World Container Index:
Target Node Specifications:
- Study Domain: Trans-Pacific Maritime Logistics, Port Operations & Supply Chain Intelligence
-
Origin Terminals Analyzed:
- Megapuerto de Chancay: Cosco Shipping Ports Chancay PerΓΊ (17.8m draft, ULCV up to 24,000 TEUs)
- Puerto del Callao: APM Terminals Callao / DP World Callao (16.0m draft, Post-Panamax & Feeder network)
- Destination Market: Asia-Pacific deepwater hubs (Shanghai, Ningbo, Qingdao, Busan, Yokohama)
- Temporal Window: January 1, 2023 to December 31, 2025 (2,400 daily commercial shipments)
-
Key Parameters:
-
Shipment_ID: Unique consignment identifier -
Booking_Date: Port bill of lading and vessel departure date -
Origin_Port&Destination_Port: Terminal pairs -
Maritime_Route: Direct Pacific Route vs. North America Transshipment -
Cargo_Type: Agroexport Reefer, Minerals & Concentrates, General Cargo, Chemicals -
Shipping_Line: Cosco Shipping, Maersk Line, MSC, CMA CGM -
Container_TEUs: Consignment volume in 20-foot equivalent units -
Transit_Time_Days: Navigation duration from origin departure to Asian berth -
Port_Dwell_Hours: Terminal gate turnaround and container yard detention -
Freight_Rate_USD_TEU: Ocean freight tariff per container unit -
Total_Logistics_Cost_USD: Consolidated expenditure (Freight + Terminal Handling Charges + Demurrage) -
CO2_Emissions_Tons: Estimated bunker fuel combustion footprint -
Delivery_Status: Service-level compliance (On-Time vs. Delayed)
-
Architectural Decision: Deterministic Data Snapshot
Instead of relying on fragile live web scraping during production runtime, we bundled a validated data snapshot in data/dataset.csv accompanied by a comprehensive technical schema catalog in data/metadata.json.
This guarantees deterministic, instant loading across local environments and cloud servers.
π Inside the Analytical Engine: 5 Core Modules
The dashboard is structured around five focused analytical perspectives:
1. Dual-Port Transit Times & 14-Day Rolling Dynamics
Commercial voyages fluctuate due to seasonal trade surges and bunkering schedules. To reveal genuine structural trends, the application computes 14-day rolling moving averages comparing Chancay's direct Pacific route against Callao's transshipment routing:
python
# 14-Day Rolling Smoothing for Comparative Transit Times
daily = (
filtered.groupby(["Booking_Date", "Origin_Port"])["Transit_Time_Days"]
.mean()
.reset_index()
.sort_values("Booking_Date")
)
fig_ts = go.Figure()
for port, color in zip(["Megapuerto de Chancay", "Puerto del Callao"], ["#0EA5E9", "#F59E0B"]):
port_data = daily[daily["Origin_Port"] == port].copy()
if not port_data.empty:
port_data["Smooth"] = port_data["Transit_Time_Days"].rolling(14, min_periods=1).mean()
fig_ts.add_trace(go.Scatter(
x=port_data["Booking_Date"],
y=port_data["Smooth"],
name=port,
mode="lines",
line=dict(color=color, width=2.8)
))
'''
##ποΈ System Architecture & GitOps Pipeline
+-----------------------------------------------------------------------------------------+
| 1. DATA LAYER |
| [ data/dataset.csv ] [ data/metadata.json ] |
| (2,400 Validated APN & Drewry Shipments) (Technical Port Specs) |
+-----------------------------------------------------------------------------------------+
β
βΌ (In-Memory Ingestion)
+-----------------------------------------------------------------------------------------+
| 2. APPLICATION CORE & CACHING LAYER |
| β’ @st.cache_data(ttl=3600) In-Memory Caching (Sub-second response time < 100ms) |
| β’ Vectorized Boolean Masking Filter Engine (Dates, Ports, Asian Hubs, Cargo, Carriers) |
| β’ Dynamic Executive KPI Calculator (Volume, Logistics Cost, Transit Delta, CO2) |
+-----------------------------------------------------------------------------------------+
β
βΌ (Clean Filtered Dataframe)
+-----------------------------------------------------------------------------------------+
| 3. ANALYTICAL MODULES & BI ENGINES |
| βββββββββββββββββββββββββ βββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββ |
| | Module 1: Transit | | Module 2: Network | | Module 3: Freight Economics | |
| | β’ 14-day Rolling Mean | | β’ Asian Hub Volumes | | β’ OLS Regression Scatter | |
| | β’ Violin Spread Plot | | β’ Carrier Market Donut| | β’ Seaborn Yard Dwell Boxplot | |
| βββββββββββββββββββββββββ βββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββ |
| βββββββββββββββββββββββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββ |
| | Module 4: What-If Route Migration Simulator | | Module 5: Data & Metadata | |
| | β’ Callao β Chancay Dynamic Sliders | | β’ Granular Table Browser | |
| | β’ Days-TEU, Cost ($M USD), & CO2 Projections | | β’ 1-Click Filtered CSV Export | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββ |
+-----------------------------------------------------------------------------------------+
β
βΌ (git push origin main)
+-----------------------------------------------------------------------------------------+
| 4. GITOPS & CI/CD PIPELINE |
| [ GitHub Repository ] βββΊ [ GitHub Actions Runner ] βββΊ [ Streamlit Cloud SaaS ] |
| β’ Version Control β’ Flake8 Static Linting β’ Automated Continuous Deploy |
| β’ Branch: main β’ Schema & Row Validation β’ Cloudflare HTTPS / CDN |
| β’ Headless Smoke Test β’ Global Executive Browser UI |
+-----------------------------------------------------------------------------------------+
Top comments (0)