Spaces:
Sleeping
Sleeping
Dhruva P Gowda commited on
Commit ·
c496840
1
Parent(s): 8971bb8
scaffold
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .env.example +5 -0
- .gitignore +17 -0
- README.md +7 -0
- backend/Dockerfile +8 -0
- backend/app/__init__.py +3 -0
- backend/app/api/__init__.py +3 -0
- backend/app/api/alerts.py +3 -0
- backend/app/api/drugs.py +3 -0
- backend/app/api/graph.py +3 -0
- backend/app/api/query.py +3 -0
- backend/app/api/simulate.py +3 -0
- backend/app/config.py +3 -0
- backend/app/data_loader.py +3 -0
- backend/app/deps.py +3 -0
- backend/app/main.py +3 -0
- backend/app/models/__init__.py +3 -0
- backend/app/models/alert.py +3 -0
- backend/app/models/drug.py +3 -0
- backend/app/models/graph.py +3 -0
- backend/app/services/__init__.py +3 -0
- backend/app/services/criticality.py +3 -0
- backend/app/services/gemini_analyst.py +3 -0
- backend/app/services/graph_service.py +3 -0
- backend/app/services/retriever.py +3 -0
- backend/app/services/shock_propagation.py +3 -0
- backend/render.yaml +14 -0
- backend/requirements.txt +17 -0
- data/seed/.gitkeep +1 -0
- deck/.gitkeep +1 -0
- demo/script.md +4 -0
- docs/ARCHITECTURE.md +1 -0
- docs/DATA_SOURCES.md +1 -0
- docs/PHASE2_ROADMAP.md +1 -0
- frontend/.firebaserc +1 -0
- frontend/analysis_options.yaml +1 -0
- frontend/firebase.json +1 -0
- frontend/lib/app/router.dart +4 -0
- frontend/lib/app/theme.dart +4 -0
- frontend/lib/main.dart +4 -0
- frontend/lib/models/alert.dart +4 -0
- frontend/lib/models/drug.dart +4 -0
- frontend/lib/models/graph_node.dart +4 -0
- frontend/lib/screens/alerts_screen.dart +4 -0
- frontend/lib/screens/dashboard_screen.dart +4 -0
- frontend/lib/screens/drug_detail_screen.dart +4 -0
- frontend/lib/screens/query_screen.dart +4 -0
- frontend/lib/services/api_client.dart +4 -0
- frontend/lib/widgets/alert_card.dart +4 -0
- frontend/lib/widgets/india_map.dart +4 -0
- frontend/lib/widgets/nl_query_bar.dart +4 -0
.env.example
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
GEMINI_API_KEY=
|
| 2 |
+
QDRANT_URL=
|
| 3 |
+
QDRANT_API_KEY=
|
| 4 |
+
FIREBASE_PROJECT_ID=
|
| 5 |
+
BACKEND_URL=http://localhost:8080
|
.gitignore
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Python
|
| 2 |
+
.env
|
| 3 |
+
__pycache__/
|
| 4 |
+
*.pyc
|
| 5 |
+
venv/
|
| 6 |
+
|
| 7 |
+
# Flutter
|
| 8 |
+
build/
|
| 9 |
+
.dart_tool/
|
| 10 |
+
|
| 11 |
+
# Data
|
| 12 |
+
data/raw/*
|
| 13 |
+
data/processed/*
|
| 14 |
+
|
| 15 |
+
# ML
|
| 16 |
+
*.pt
|
| 17 |
+
!ml/weights/
|
README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PharmaShield
|
| 2 |
+
|
| 3 |
+
India's pharmaceutical import dependency mapping and early-warning alert system.
|
| 4 |
+
|
| 5 |
+

|
| 6 |
+
|
| 7 |
+
This project is licensed under the MIT License.
|
backend/Dockerfile
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11-slim
|
| 2 |
+
WORKDIR /app
|
| 3 |
+
RUN apt-get update && apt-get install -y gcc g++ && rm -rf /var/lib/apt/lists/*
|
| 4 |
+
COPY requirements.txt .
|
| 5 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 6 |
+
COPY . .
|
| 7 |
+
ENV PORT=8080
|
| 8 |
+
CMD uvicorn app.main:app --host 0.0.0.0 --port ${PORT}
|
backend/app/__init__.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
App initialization module.
|
| 3 |
+
"""
|
backend/app/api/__init__.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
API router registration.
|
| 3 |
+
"""
|
backend/app/api/alerts.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Endpoints for early-warning alerts.
|
| 3 |
+
"""
|
backend/app/api/drugs.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Endpoints for drug dependency data.
|
| 3 |
+
"""
|
backend/app/api/graph.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Endpoints for supply chain graph visualization.
|
| 3 |
+
"""
|
backend/app/api/query.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Endpoints for natural language queries.
|
| 3 |
+
"""
|
backend/app/api/simulate.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Endpoints for shock simulation scenarios.
|
| 3 |
+
"""
|
backend/app/config.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Configuration management using Pydantic Settings.
|
| 3 |
+
"""
|
backend/app/data_loader.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Initial data loading and bootstrapping.
|
| 3 |
+
"""
|
backend/app/deps.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Dependency injection for FastAPI.
|
| 3 |
+
"""
|
backend/app/main.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Main FastAPI application entry point.
|
| 3 |
+
"""
|
backend/app/models/__init__.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Pydantic and Database models.
|
| 3 |
+
"""
|
backend/app/models/alert.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Alert notification model.
|
| 3 |
+
"""
|
backend/app/models/drug.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Drug dependency model.
|
| 3 |
+
"""
|
backend/app/models/graph.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Graph node and edge models.
|
| 3 |
+
"""
|
backend/app/services/__init__.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Business logic services.
|
| 3 |
+
"""
|
backend/app/services/criticality.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Logic for calculating drug criticality.
|
| 3 |
+
"""
|
backend/app/services/gemini_analyst.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Integration with Gemini for analysis.
|
| 3 |
+
"""
|
backend/app/services/graph_service.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Service for graph operations.
|
| 3 |
+
"""
|
backend/app/services/retriever.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Vector retrieval from Qdrant.
|
| 3 |
+
"""
|
backend/app/services/shock_propagation.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Modeling shock propagation in networks.
|
| 3 |
+
"""
|
backend/render.yaml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
- type: web
|
| 3 |
+
name: pharmashield-api
|
| 4 |
+
env: docker
|
| 5 |
+
region: singapore
|
| 6 |
+
plan: free
|
| 7 |
+
healthCheckPath: /healthz
|
| 8 |
+
envVars:
|
| 9 |
+
- key: GEMINI_API_KEY
|
| 10 |
+
sync: false
|
| 11 |
+
- key: QDRANT_URL
|
| 12 |
+
sync: false
|
| 13 |
+
- key: QDRANT_API_KEY
|
| 14 |
+
sync: false
|
backend/requirements.txt
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastapi==0.115.0
|
| 2 |
+
uvicorn[standard]==0.32.0
|
| 3 |
+
pydantic==2.9.0
|
| 4 |
+
pydantic-settings==2.5.2
|
| 5 |
+
google-generativeai==0.8.3
|
| 6 |
+
qdrant-client==1.12.0
|
| 7 |
+
torch==2.4.1
|
| 8 |
+
torch-geometric==2.6.1
|
| 9 |
+
networkx==3.3
|
| 10 |
+
pandas==2.2.3
|
| 11 |
+
numpy==1.26.4
|
| 12 |
+
python-dotenv==1.0.1
|
| 13 |
+
httpx==0.27.2
|
| 14 |
+
tenacity==9.0.0
|
| 15 |
+
beautifulsoup4==4.12.3
|
| 16 |
+
lxml==5.3.0
|
| 17 |
+
playwright==1.48.0
|
data/seed/.gitkeep
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
deck/.gitkeep
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
demo/script.md
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Demo Script
|
| 2 |
+
1. Dashboard Overview
|
| 3 |
+
2. Alert Detection
|
| 4 |
+
3. NL Query Example
|
docs/ARCHITECTURE.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
# Architecture Overview
|
docs/DATA_SOURCES.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
# Data Sources Reference
|
docs/PHASE2_ROADMAP.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
# Phase 2 Roadmap
|
frontend/.firebaserc
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{}
|
frontend/analysis_options.yaml
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
include: package:flutter_lints/rules.yaml
|
frontend/firebase.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{}
|
frontend/lib/app/router.dart
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// TODO: Implement AppRouter
|
| 2 |
+
class AppRouter {
|
| 3 |
+
// Add implementation here
|
| 4 |
+
}
|
frontend/lib/app/theme.dart
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// TODO: Implement AppTheme
|
| 2 |
+
class AppTheme {
|
| 3 |
+
// Add implementation here
|
| 4 |
+
}
|
frontend/lib/main.dart
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// TODO: Entry point
|
| 2 |
+
void main() {
|
| 3 |
+
// Entry point
|
| 4 |
+
}
|
frontend/lib/models/alert.dart
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// TODO: Implement Alert
|
| 2 |
+
class Alert {
|
| 3 |
+
// Add implementation here
|
| 4 |
+
}
|
frontend/lib/models/drug.dart
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// TODO: Implement Drug
|
| 2 |
+
class Drug {
|
| 3 |
+
// Add implementation here
|
| 4 |
+
}
|
frontend/lib/models/graph_node.dart
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// TODO: Implement GraphNode
|
| 2 |
+
class GraphNode {
|
| 3 |
+
// Add implementation here
|
| 4 |
+
}
|
frontend/lib/screens/alerts_screen.dart
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// TODO: Implement AlertsScreen
|
| 2 |
+
class AlertsScreen {
|
| 3 |
+
// Add implementation here
|
| 4 |
+
}
|
frontend/lib/screens/dashboard_screen.dart
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// TODO: Implement DashboardScreen
|
| 2 |
+
class DashboardScreen {
|
| 3 |
+
// Add implementation here
|
| 4 |
+
}
|
frontend/lib/screens/drug_detail_screen.dart
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// TODO: Implement DrugDetailScreen
|
| 2 |
+
class DrugDetailScreen {
|
| 3 |
+
// Add implementation here
|
| 4 |
+
}
|
frontend/lib/screens/query_screen.dart
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// TODO: Implement QueryScreen
|
| 2 |
+
class QueryScreen {
|
| 3 |
+
// Add implementation here
|
| 4 |
+
}
|
frontend/lib/services/api_client.dart
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// TODO: Implement ApiClient
|
| 2 |
+
class ApiClient {
|
| 3 |
+
// Add implementation here
|
| 4 |
+
}
|
frontend/lib/widgets/alert_card.dart
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// TODO: Implement AlertCard
|
| 2 |
+
class AlertCard {
|
| 3 |
+
// Add implementation here
|
| 4 |
+
}
|
frontend/lib/widgets/india_map.dart
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// TODO: Implement IndiaMap
|
| 2 |
+
class IndiaMap {
|
| 3 |
+
// Add implementation here
|
| 4 |
+
}
|
frontend/lib/widgets/nl_query_bar.dart
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// TODO: Implement NLQueryBar
|
| 2 |
+
class NLQueryBar {
|
| 3 |
+
// Add implementation here
|
| 4 |
+
}
|