MediLink AI โ Real-Time Drug Shortage & Price Intelligence
Stack: Fivetran (Connector SDK) โ Google Cloud (BigQuery, Vertex AI, Cloud Storage) โ Gradio (Python)
Focus: Healthcare access, affordability, and transparency through automated data pipelines + AI.
๐ Inspiration
When essential medicines run low, patients bounce between pharmacies, pay more, or skip treatment. The status quo is opaque. MediLink AI turns scattered inventory/pricing signals into real-time availability, fair prices, and early shortage warnings.
๐ก What it does
- Search availability & prices across pharmacies by medicine/strength/city.
- Shortage Watchlist with 14-day trends (LOW/OUT risk) and live, embedded maps.
- AI Insights: Vertex AI (Gemini) converts raw signals to concise, human-readable guidance.
- Interactive Agent: Natural language agent that interprets queries (e.g., โFind amoxicillin 500mg in Accra under 120 within 5kmโ), calls tools for live inventory/shortage data, and summarizes results with Maps links.
- Open Analytics: A reusable BigQuery view (
v_shortage_signal) powers dashboards and policy briefs.
๐จ Product Design
Principles: Instant clarity, zero-config onboarding, and trust-by-default.
- Gradio UI: Clean search interface with filters, risk chips, and results table.
- Actionable defaults: City prefilled; price caps configurable.
- Spatial sense: Embedded maps and Google Maps deep-links for every result.
- Explainability: Micro-copy shows why an item is flagged low/out of stock.
- Accessibility: Keyboard-first design, high contrast, minimal friction.
- Agent Tab: Dedicated tab where users can โAsk MediLink Agent,โ get immediate โAgent is workingโฆโ feedback, and receive AI-guided answers.
๐งญ Architecture
Pharmacy Systems (POS, CSV, APIs)
โ
โผ
Fivetran Connector SDK
โ
โผ
Google BigQuery
(inventory, price, product,
pharmacy, shortage view)
โ
โผ
Vertex AI (Gemini)
(Summaries & interactive Agent)
โ
โผ
Gradio Frontend
(Search โข Watchlist โข Agent โข Maps)
Vertical Architecture Diagram

๐ Data Flow
- Extract: Fivetran connector pulls data from POS/APIs/CSV/GCS.
- Load: Fivetran auto-synchronizes tables into BigQuery (
medilink_*). - Transform: SQL in BigQuery creates 14-day moving averages and shortage signals.
- Serve: Gradio queries BigQuery with parameters and renders maps.
- Explain: Vertex AI generates concise availability/price summaries.
- Interact: The MediLink Agent interprets natural language, calls functions like
query_inventoryorwatchlist_table, and returns human-readable results. - Feedback loop: Watchlist interactions inform caching and next-gen forecasting.
๐ BigQuery Modeling
pharmacy(pharmacy_id, name, city, lat, lng, โฆ)product(product_id, name, strength, form, โฆ)inventory_snapshot(observed_at, qty_available, min_qty, โฆ)โ partitioned by timeprice_snapshot(observed_at, unit_price, currency, โฆ)โ partitioned by time- View:
v_shortage_signalwith rolling 14-day mean & z-drop. - Optimizations: Partition pruning, clustering, result caching.
๐ง Vertex AI (Gemini)
- Prompts convert BigQuery metrics (availability, price spread, trends) into <100-word summaries.
- Guardrails ensure outputs are factual, non-clinical, and action-oriented.
- Agent function calling: Gemini triggers custom Python tools (
query_inventory,watchlist_table) and then finalizes with a plain text summary. - Provides clarity for pharmacists, NGOs, and policymakers.
๐งฉ Fivetran Deep Dive
- Connector SDK (Python) handles idempotent extraction with
observed_atwatermark. - Auto-schema evolution and retries reduce maintenance overhead.
- BigQuery destination (
medilink_bigquery_medilink) is secured via IAM service accounts. - Zero pipeline ops: pharmacies feed in raw data, pipelines โjust work.โ
๐งช How we built it
- Frontend: Gradio app with tabs for Search, Watchlist, Agent, and embedded maps.
- Backend: BigQuery SQL views, partitioned tables, parameterized queries.
- AI Layer: Vertex AI adds human-readable context and powers the Agent.
- Data ingestion: Fivetran connector continuously updates BigQuery with new snapshots.
๐ Security & Compliance
- IAM roles separate ingestion and app-level queries.
- Data locality enforced.
- PII excluded; only inventory and prices are tracked.
- Auditability: BigQuery logs + Fivetran run history.
๐ง Challenges we ran into
- Designing 14-day trend analysis without expensive windowing.
- De-duplicating multi-source data reliably.
- Making queries performant and low-cost under real-time loads.
- Implementing Vertex AI function-calling and ensuring responses finalize cleanly without looping tool calls.
๐ Accomplishments
- Fully automated pipeline from pharmacy systems โ BigQuery โ AI โ frontend.
- Predictive shortage detection using rolling trends.
- Agent integration: Seamlessly blended natural language interface with structured queries.
- A UX that feels simple while hiding complex pipelines underneath.
- Demonstrated scalable model for health supply-chain transparency.
๐ What we learned
- Fivetran simplifies ingestion more than custom ETL ever could.
- BigQuery partitions + clustering unlock near-instant queries.
- Vertex AI works best when prompts focus on decision support.
- The Agent experience requires careful handling of tool responses vs. text finalization.
- UX matters: maps + risk chips build trust with non-technical users.
๐ฎ Whatโs next
- Forecasting with BigQuery ML/Prophet for 30-day predictions.
- City-level dashboards for ministries and NGOs.
- SMS/WhatsApp integration for low-bandwidth users.
- Open APIs so developers can embed shortage insights in their apps.
- Agent extensions: Adding pharmacy registration and alerts when items go OUT/LOW in specific regions.
๐ Why it matters for the industry
MediLink AI shows how cloud data pipelines + AI can directly improve healthcare supply chains. Pharmacies reduce lost sales, patients gain affordable access, and policymakers gain transparent, real-time visibility into shortages. The new Agent feature further lowers the barrier for non-technical users by allowing natural language queries and instant insights. This model can scale nationwide and globally to strengthen resilience against drug shortages.
๐ฌ Agent Example
User query:
โFind paracetamol 1g in Accra under 50 within 3kmโ
Agent response:
- Paracetamol 1g at CityCare Pharmacy (Accra) โ Qty: 20, Price: 45 GHS. Maps
- Paracetamol 1g at TrustMed Pharmacy (Accra) โ Qty: 10, Price: 47 GHS. Maps
- Paracetamol 1g at GoodHealth Chemist (Accra) โ Qty: 8, Price: 49 GHS. Maps
Built With
- fivetran
- google-cloud
- vertex

Log in or sign up for Devpost to join the conversation.