agent files

This commit is contained in:
Minidu Thiranjaya
2026-02-10 20:44:10 +05:30
commit 47f11bc396
4 changed files with 277 additions and 0 deletions
+116
View File
@@ -0,0 +1,116 @@
### **1. The Core Strategy: "Microservices" Approach**
- **Shared Foundation (Group Task):** Everyone works together on **Day 1** to set up the `User` model, `Auth` middleware (JWT), and MongoDB connection. This is "boilerplate" and doesn't count towards the distinct 4 endpoints.
- **Individual Ownership:** Each member owns a specific business domain.
---
### **2. Revised Role Allocation (The "Who Does What")**
### **Member 1: Minidu Supply Chain & Family Identity**
- **Core Domain:** Managing the vaccine stocks AND the "Head of Household" logic (adding children/dependents).
- **Complexity:** Inventory tracking + Relation mapping (Parent-Child).
- **3rd Party API:** **Cloudinary / ImgBB** (Upload images of vaccine vials/branding).
| Method | Endpoint | Description |
| --- | --- | --- |
| `POST` | `/api/vaccines` | Add Vaccine (w/ **Image Upload** to Cloudinary). |
| `POST` | `/api/batches` | Add Stock Batch (Qty, Expiry). |
| `POST` | `/api/users/dependents` | **New:** Add a child/spouse to the logged-in user's account. |
| `GET` | `/api/users/dependents` | **New:** List all family members managed by the user. |
### **Member 2: Nethmi Clinic & Location Services**
- **Core Domain:** Managing where and when vaccinations happen.
- **Complexity:** Spatial data (Coordinates) + Time Management.
- **3rd Party API:** **LocationIQ / Mapbox** (Convert address to Lat/Long coordinates).
| Method | Endpoint | Description |
| --- | --- | --- |
| `POST` | `/api/hospitals` | Register Hospital (Auto-fetch **Lat/Lon** from API). |
| `POST` | `/api/clinics` | Create a Vaccination Event (Date, Time, Vaccine Type). |
| `PUT` | `/api/clinics/:id` | Update capacity (e.g., increase slots). |
| `GET` | `/api/clinics/search` | Filter clinics by City or Vaccine Type. |
### **Member 3: Saniru Appointment Engine**
- **Core Domain:** The booking transaction logic (handling quotas).
- **Complexity:** Concurrency (preventing double booking) + Handling "Booking for Dependent".
- **3rd Party API:** **QR Code API ([goqr.me](http://goqr.me/))** (Generate a unique pass for the appointment).
| Method | Endpoint | Description |
| --- | --- | --- |
| `POST` | `/api/appointments` | Book Slot. **Logic:** Handle `dependentId` vs `userId`. Check Quota. Generate **QR**. |
| `PUT` | `/api/appointments/:id` | Cancel & Restore Quota to the Clinic. |
| `GET` | `/api/appointments/my` | List appointments for **Self AND Family**. |
| `GET` | `/api/appointments/clinic/:id` | Admin View: List of people (Names + QR Codes) for a specific day. |
### **Member 4: Kaveen Records & Communication**
- **Core Domain:** Medical history and notifying users.
- **Complexity:** State management (Vaccinated vs. Pending) + External Comms.
- **3rd Party API:** **SendGrid / EmailJS** (Send confirmations).
| Method | Endpoint | Description |
| --- | --- | --- |
| `POST` | `/api/records` | Doctor marks patient as "Vaccinated". **Triggers Email**. |
| `GET` | `/api/records/history` | Get full history for **Self AND Dependents**. |
| `GET` | `/api/records/due` | Logic: Calculate next dose date based on vaccine rules. |
| `POST` | `/api/side-effects` | Log adverse reactions for a specific batch. |
---
### **3. Milestone 1 Schedule (Feb 8 - Feb 20)**
**Internal Target:** Finish by Friday, Feb 20 (gives 1 week buffer before Evaluation 01).
### **Phase 1: Setup (Days 1-2)**
- **Dates:** Feb 8-9
- **Group:** Git Repo, Express Setup, Mongo Atlas Connection.
- **Shared Code:** Write `authController.js` (Register/Login) and `authMiddleware.js`.
- **API Keys:** Get keys for Cloudinary, LocationIQ, and SendGrid. Put them in `.env`.
### **Phase 2: Individual Feature Dev (Days 3-8)**
- **Dates:** Feb 10-15
- **Minidu:** Build `Dependent` model. Implement logic: "Parent ID must match User ID". Implement Image Upload.
- **Nethmi:** Build `Hospital` model. Implement Geocoding middleware.
- **Saniru:** Build `Appointment` model. Logic: "If `dependentId` exists, save that name, else save User name." Integrate QR API.
- **Kaveen:** Build `Record` model. Logic: "When status = Vaccinated, fire email function."
### **Phase 3: Integration & Testing (Days 9-12)**
- **Dates:** Feb 16-19
- **Crucial Integration:**
- Does Saniru's booking subtract from Nethmi's clinic capacity?
- Does Kaveen's history show Minidu's vaccine details?
- **Testing:** Test the **"Family Flow"**:
1. Login as Parent.
2. Add Child (Minidu).
3. Book Appt for Child (Saniru).
4. Doctor marks Child vaccinated (Kaveen).
5. Parent checks email (Kaveen).
---
### **4. Pre-Submission Checklist (Evaluation 01 Specific)**
**Group Marks (20%)**
- [ ] **Architecture Diagram:** Includes the "Dependent" entity logic?
- [ ] **Framework Justification:** Slide explaining "Why MongoDB?" -> "Because storing nested family records and varied vaccine attributes is easier in JSON/BSON."
**Individual Marks (80%) - The "Must Haves"**
- [ ] **Minidu:** Is the vaccine image hosted on Cloudinary? Can you add a child to a user account?
- [ ] **Nethmi:** Does the Hospital registration automatically fill in Lat/Long?
- [ ] **Saniru:** Does the appointment response include a valid QR code link? Can you book for a dependent?
- [ ] **Kaveen:** Does the email arrive when a record is updated? Does the history endpoint show family data?
**Code Quality**
- [ ] **Separation:** Controllers are separate from Routes.
- [ ] **Security:** "Dependents" can only be viewed by their own Parent (Middleware check).
- [ ] **Validation:** Inputs are validated (e.g., cannot book a date in the past).