diff --git a/.firebase/hosting.YnVpbGQvd2Vi.cache b/.firebase/hosting.YnVpbGQvd2Vi.cache new file mode 100644 index 0000000..9b9a26d --- /dev/null +++ b/.firebase/hosting.YnVpbGQvd2Vi.cache @@ -0,0 +1,35 @@ +manifest.json,1776881986339,17bb2936710fe4ce4b061d545b155fab06343a1fc409299b54461a6f1eff7fd8 +flutter.js,1776307746000,b42e549a02f5c1428b0ad85dbdc663d400a6d2db10cb8aefcc0fddd592fd6ceb +favicon.png,1776881986335,fcc7c4545d5b62ad01682589e6fdc7ea03d0a3b42069963c815c344b632eb5cf +icons/Icon-maskable-512.png,1776881986337,e7983524dc70254adc61764657d7e03d19284de8da586b5818d737bc08c6d14e +icons/Icon-maskable-192.png,1776881986337,dd96c123fdf6817cdf7e63d9693bcc246bac2e3782a41a6952fa41c0617c5573 +icons/Icon-512.png,1776881986336,7a31ce91e554f1941158ca46f31c7f3f2b7c8c129229ea74a8fae1affe335033 +icons/Icon-192.png,1776881986335,d2e0131bb7851eb9d98f7885edb5ae4b4d6b7a6c7addf8a25b9b712b39274c0f +canvaskit/wimp.wasm,1776308360000,d91529b29892ded91161c8bfcd7ba397a7bc25616ec39b2c8e550c9c82844e69 +canvaskit/wimp.js.symbols,1776308360000,d503a0521fcb00d9dec064dabaccb9ead8b10d311f9f36141fb5b7997b201846 +canvaskit/wimp.js,1776308360000,63f0487b1033146fc2ed7b394420b036c99cf198b857dfd3cea92227f84a2310 +canvaskit/skwasm_heavy.wasm,1776308418000,c02f715939724f1c936cef6b5d787489451b1a1a24dadf86f667d71f0e21cc09 +canvaskit/skwasm_heavy.js.symbols,1776308418000,625fb4cc0f491b80d66e20251521bc90dd7ad83ad06b242e9762916aaaccada6 +canvaskit/skwasm_heavy.js,1776308418000,1a694c23c937503283d38d24f75d03e432093e0cc9488c38910b482751263fad +canvaskit/skwasm.wasm,1776308312000,0e0c782588b556af14cad090d959344b705131d299fa76ebfddf97180853b1ab +canvaskit/skwasm.js.symbols,1776308312000,320b80390e4e3234f1c216c90a01028f17fd39220817c7837d8126133366f313 +canvaskit/skwasm.js,1776308312000,40f0e36b14ede08584d4f4cbfbcaf55642e04f81498364e975b55cec7b95ba20 +canvaskit/canvaskit.wasm,1776307904000,4b911a495801f229a19e536df7e52a9943a549bf4c213583f081ea2a3d3c12b2 +canvaskit/canvaskit.js.symbols,1776307904000,52d20fad5abef4f488c2b92aec7181e65997b8a22de54cc976b4bd4555401723 +canvaskit/canvaskit.js,1776307904000,df5aa63d90b0491908ad19d64fd18f29db1dc416548f6c73179d962eaae694e7 +canvaskit/chromium/canvaskit.wasm,1776307992000,44d29356b9e2c903751a8aa583716275e165d1fb56eea46963c95c7c43f7ca34 +canvaskit/chromium/canvaskit.js.symbols,1776307992000,60722421e56edacbeb674cc3ef0f6152969067e74b51a960c80cd36e75b75a54 +canvaskit/chromium/canvaskit.js,1776307992000,10ea3badcf26e29aba851699c03e09bc35fea65cdc440a035bac263d6d02d665 +assets/packages/flutter_map/lib/assets/flutter_map_logo.png,1777380078238,dede46459c3408bb8c14a250aae76690bcd2f671c5f047025330833b96769140 +flutter_service_worker.js,1777380603264,baeeaf9f4b8e6f40d3b0549429ceb70ca01f120db6a7ef2f60d5809233dc2205 +index.html,1777380557174,6d5542127534ccc84d97f63cf54ecbae08b50d9df132041160a21e7a731c0f21 +version.json,1777380601244,977041fbfcd8d353d795d7b211c514cc0026cca48392fbe4d5fadb83dbb5993e +assets/AssetManifest.bin.json,1777380601403,f7fcfda73d42d4b6c8271bb95b6954fecf830e17c393d9802e1d6f87d1aabf71 +assets/FontManifest.json,1777380601403,2a26cf55926df210ccb9d713372cb114e0a12bf97104f6833e382566e2e7b16e +assets/AssetManifest.bin,1777380601403,291e63d8caead3f957f86760d15b45edb892ad67fee88cb5d6e2f233a9daa50b +flutter_bootstrap.js,1777380557156,f73203de8e7a9cf4470eb3d70ff4402a83b29e2fb63ee3986b80951f6f1b71db +assets/shaders/ink_sparkle.frag,1777380601533,1c8e222328206d1e06754f76fb53947aad38d62180aafad5298a3c6f510b173d +assets/shaders/stretch_effect.frag,1777380601533,1a7d4ac2be40cf0a459dfb390ef08bcd740f37913ffdee8de3c2ea836a18410e +assets/fonts/MaterialIcons-Regular.otf,1777380603147,f7f367df43ad0f1407b46212586e0e28b08c61d6678bf6e121a7c14694ba0586 +assets/NOTICES,1777380601404,34d4ba469f977dd724cbfa4ba34690c43c43c31ff0b9474e2b8b25207afc8ffd +main.dart.js,1777380586509,9ba81f76a0c72805c30b23b1c1d64b0a558beee5eabca337613a34d46a9f660d diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..1aca87a --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,44 @@ +name: Deploy to Firebase Hosting + +on: + push: + branches: + - "Aarush;)" # Ya jo bhi aapki main branch hai + - "main" + +jobs: + build_and_deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: '3.41.7' + + - name: Install Dependencies + run: flutter pub get + + - name: Create .env file for AI Service + run: | + echo "GEMINI_API_KEY=${{ secrets.GEMINI_API_KEY }}" > .env + echo "FIREBASE_API_KEY=${{ secrets.FIREBASE_API_KEY }}" >> .env + echo "FIREBASE_PROJECT_ID=mediflow-92e6f" >> .env + echo "FIREBASE_AUTH_DOMAIN=mediflow-92e6f.firebaseapp.com" >> .env + echo "FIREBASE_STORAGE_BUCKET=mediflow-92e6f.firebasestorage.app" >> .env + echo "FIREBASE_MESSAGING_SENDER_ID=71200393927" >> .env + echo "FIREBASE_APP_ID=1:71200393927:web:346d720af6b9cf11898ce2" >> .env + + - name: Build Web App + run: flutter build web --release --base-href / + + - name: Install Firebase CLI + run: npm install -g firebase-tools + + - name: Deploy to Firebase Hosting + env: + FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} + run: firebase deploy --only hosting --project mediflow-92e6f diff --git a/README.md b/README.md index 995129f..4822807 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,175 @@ -# med_supply_prototype +

+ Google Solution Challenge 2026 +

-A new Flutter project. +

MediFlow

+

AI-powered medical logistics platform focused on smart resource allocation

-## Getting Started +

+ Flutter + Firebase + Gemini AI + ORS +

-This project is a starting point for a Flutter application. +--- -A few resources to get you started if this is your first Flutter project: +## Table of Contents +- [Project Overview](#project-overview) +- [The Problem & Solution](#the-problem--the-solution) +- [Core Feature Set](#core-feature-set) + - [Hospital / Facility Module](#hospital--facility-module) + - [Central Administration Module](#central-administration-module) +- [Technical Architecture](#technical-architecture) +- [Project Structure](#project-structure) +- [Data & Schema](#data--schema) +- [Development & Setup](#development--setup) +- [Roadmap](#roadmap) -- [Learn Flutter](https://docs.flutter.dev/get-started/learn-flutter) -- [Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) -- [Flutter learning resources](https://docs.flutter.dev/reference/learning-resources) +--- -For help getting started with Flutter development, view the -[online documentation](https://docs.flutter.dev/), which offers tutorials, -samples, guidance on mobile development, and a full API reference. +## Project Overview +**MediFlow** is an enterprise-grade medical logistics platform engineered to solve the "Last Mile" medical supply crisis. By combining **Generative AI** for demand forecasting with **Heuristic Optimization** for redistribution, MediFlow transforms a fragmented, reactive supply chain into a proactive, life-saving ecosystem, specifically targeting cold-chain pharmaceutical integrity. + +## The Problem | The Solution +**The Crisis:** Rural clinics often face 30% higher stockout rates for essential antibiotics, while urban hospitals simultaneously dispose of expired stock due to over-purchasing. This inequality is compounded by the lack of intelligent monitoring for cold-chain medicines (vaccines, insulin). + +**The MediFlow Solution:** We don't just track inventory; we **predict** shortages before they happen and **automate** the movement of medicine from surplus hospitals to deficit clinics using road-accurate route optimization, ensuring that every life-saving resource is allocated where it’s needed most. + +--- + +## Core Feature Set + +### Hospital / Facility Module + +| Feature | Detailed Description | +| :--- | :--- | +| **Smart Logging Engine** | Atomically track daily usage while the system computes burn rates in real-time, ensuring zero data loss even in low-connectivity areas. | +| **AI Forecasting (30-Day)** | Powered by **Gemini-1.5-Flash**, predicting seasonal spikes based on historical usage trends (e.g., ORS demand for summer) with a transparency-first "AI Reasoning" component. | +| **Automated Request Drafting** | Intelligent auto-population of restock indents and redistribution offers based on AI predictions, reducing administrative overhead for clinic managers. | +| **AI Chat Assistant** | A 24/7 logistics expert that facility managers can query for stock status, expiry alerts, or burn-rate insights using natural language. | + +### Central Administration Module + +| Feature | Detailed Description | +| :--- | :--- | +| **Global Command Center** | Real-time regional oversight with deep-dive analytics into every facility's stock health, parity, and regional logistics KPIs. | +| **Approval Pipeline** | A secure hub for regional admins to review, edit, and prioritize redistribution plans proposed by the optimization engine. | +| **Interactive Logistics Map** | High-visibility markers distinguishing surplus sites from deficit clinics with integrated OSRM/ORS paths that calculate real-world travel time and distance. | +| **Global Optimization** | A "Global Redistribution Plan" that matches thousands of shortage items to local surpluses in seconds using our proprietary matching logic. | + +--- + +## Technical Architecture + +| Component | Description | +| :--- | :--- | +| **1. AI Engine (Gemini 1.5 Flash)** | We leverage Gemini's large context window to process months of anonymized usage logs. The model acts as a **Predictive Reasoning Layer**, identifying non-obvious patterns like demographic-based medicine consumption surges. | +| **2. Optimization Heuristic (OTS)** | Our proprietary **Optimal Transfer Score** ensures that redistribution is both efficient and equitable:

$$OTS = (w_{dist} \cdot Proximity) + (w_{prior} \cdot RuralPriority) + (w_{qty} \cdot QtyMatch)$$

• **Proximity**: Minimizes logistics cost and time.
• **Rural Priority**: A weight multiplier ensuring that remote facilities are never "starved" by the algorithm. | +| **3. Geospatial Routing System** | Integrated with **flutter_map** and **OSRM/OpenRouteService**, our routing engine decodes complex polylines to provide precise, road-accurate delivery paths, factoring in real-world geography. | + +--- + +## Project Structure + +```bash +lib/ +├── constants/ +│ └── colors.dart # Project-wide design tokens & premium palette +│ +├── models/ # Immutable Data Domain +│ ├── daily_usage_log.dart # Atomic snapshots of medicine consumption +│ ├── facility.dart # Metadata & Geospatial profiles for nodes +│ ├── inventory_item.dart # Stock tracking & expiry metadata +│ ├── request.dart # Ledger for redistribution & restock flows +│ └── usage_log.dart # Helper models for analytics visualization +│ +├── services/ # Business Logic & Intelligence Layer +│ ├── ai_service.dart # Gemini-1.5-Flash forecasting & reasoning +│ ├── chat_service.dart # NLP pipeline for the AI Assistant +│ ├── firebase_service.dart # Firestore infrastructure & transactions +│ ├── optimization_service.dart # OTS heuristic & matching algorithm +│ ├── routing_service.dart # Geospatial OSRM/ORS pathfinding logic +│ ├── simulation_service.dart # Real-time demo data generation engine +│ └── tool_dispatcher.dart # AI tool-calling & data registry +│ +├── views/ # Presentation Layer (UI) +│ ├── admin/ # Central Command Module +│ │ ├── admin_indent_approval_page.dart +│ │ ├── admin_indent_status_page.dart +│ │ ├── admin_overview.dart +│ │ └── route_optimization_map.dart +│ │ +│ ├── auth/ # Security & Role Gatekeeping +│ │ ├── login_screen.dart +│ │ └── role_selection_screen.dart +│ │ +│ ├── facility/ # Local Management Module +│ │ ├── active_indents_page.dart +│ │ ├── ai_forecast_page.dart +│ │ ├── alerts_page.dart +│ │ ├── daily_logging_page.dart +│ │ ├── facility_overview.dart +│ │ └── indent_creation_page.dart +│ │ +│ └── shared/ # Common & Reusable Components +│ ├── ai_chat_page.dart +│ ├── help_page.dart +│ └── sidebar_layout.dart +│ +├── firebase_options.dart # Cross-platform Firebase configuration +└── main.dart # Application entry & Router configuration +``` + +--- + +## Data & Schema +MediFlow utilizes a hierarchical Firestore schema designed for high-concurrency performance: +* **`/facilities`**: Metadata, type (urban/rural), and geospatial coordinates. +* **`/inventory/{fac_id}/medicines`**: Sub-collection tracking individual batches and live stock levels. +* **`/requests`**: Global collection for tracking movement, status (Pending/Approved/Fulfilled), and manifest details. + +--- + +## Development & Setup + +### Prerequisites +- Flutter SDK (>=3.0.0) +- Firebase Project +- Google AI Studio API Key (Gemini) +- OpenRouteService API Key + +### Quick Start +```bash +# 1. Clone & Install +git clone https://github.com/pavsoss/MediFlow.git && cd MediFlow +flutter pub get + +# 2. Configure Environment +# Create .env and add: +# GEMINI_API_KEY=your_key +# ORS_API_KEY=your_key + +# 3. Run Prototype +flutter run -d chrome --web-renderer html +``` + +--- + +## Roadmap +- [ ] **Offline-First Sync**: Native SQLite integration for zero-connectivity environments. +- [ ] **Batch Tracking**: QR-code integration for granular tracking of individual medicine strips. +- [ ] **IoT Cold Chain**: Integration with sensors to track temperature-sensitive vaccines during transit. + +--- + +## The Team +Built with ❤️ for the **Google Solution Challenge 2026**. + +- [Aarush Yadav] +- [Paavni Bansal] +- [Devansh Rana] +- [Sharvi Singhal] + +--- +

© 2026 MediFlow Team. Engineering a smarter, healthier supply chain.

diff --git a/firebase.json b/firebase.json index 0f759df..57b6cf9 100644 --- a/firebase.json +++ b/firebase.json @@ -1 +1,34 @@ -{"flutter":{"platforms":{"dart":{"lib/firebase_options.dart":{"projectId":"mediflow-92e6f","configurations":{"web":"1:71200393927:web:346d720af6b9cf11898ce2"}}}}}} \ No newline at end of file +{ + "hosting": { + "public": "build/web", + "ignore": [ + "firebase.json", + "**/.*", + "**/node_modules/**" + ], + "rewrites": [ + { + "source": "**", + "destination": "/index.html" + } + ] + }, + "firestore": { + "rules": "firestore.rules" + }, + "functions": { + "source": "functions" + }, + "flutter": { + "platforms": { + "dart": { + "lib/firebase_options.dart": { + "projectId": "mediflow-92e6f", + "configurations": { + "web": "1:71200393927:web:346d720af6b9cf11898ce2" + } + } + } + } + } +} \ No newline at end of file diff --git a/lib/firebase_options.dart b/lib/firebase_options.dart index b81177d..19c6f45 100644 --- a/lib/firebase_options.dart +++ b/lib/firebase_options.dart @@ -39,13 +39,13 @@ class DefaultFirebaseOptions { } } - static FirebaseOptions get web => FirebaseOptions( - apiKey: dotenv.env['FIREBASE_API_KEY'] ?? '', - authDomain: dotenv.env['FIREBASE_AUTH_DOMAIN'] ?? '', - projectId: dotenv.env['FIREBASE_PROJECT_ID'] ?? '', - storageBucket: dotenv.env['FIREBASE_STORAGE_BUCKET'] ?? '', - messagingSenderId: dotenv.env['FIREBASE_MESSAGING_SENDER_ID'] ?? '', - appId: dotenv.env['FIREBASE_APP_ID'] ?? '', + static const FirebaseOptions web = FirebaseOptions( + apiKey: 'AIzaSyCRZrAmF34TIcwIMZ8wqf70JUTkXUt8Mh0', + authDomain: 'mediflow-92e6f.firebaseapp.com', + projectId: 'mediflow-92e6f', + storageBucket: 'mediflow-92e6f.firebasestorage.app', + messagingSenderId: '71200393927', + appId: '1:71200393927:web:346d720af6b9cf11898ce2', ); } \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 3a599d8..5d83003 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -37,10 +37,23 @@ final GlobalKey _adminShellNavigatorKey = GlobalKey + +