Files
vaxtrack-agent-files/schema.md
T
Minidu Thiranjaya 47f11bc396 agent files
2026-02-10 20:44:10 +05:30

2.8 KiB

erDiagram %% SHARED COMPONENT (All Members) %% User Management is central to the system USERS { ObjectId _id PK string name string email string password string role "Admin, HospitalStaff, Public" string nic "National ID" string phone string address date createdAt }

%% MODULE 1: VACCINE SUPPLY CHAIN (Minidu)
%% Manages the abstract vaccine types and specific physical batches
VACCINE {
    ObjectId _id PK
    string name "e.g., Pfizer, Sinopharm"
    string manufacturer
    string description
    int dosesRequired
    int daysBetweenDoses
    string imageUrl "Cloudinary URL"
}

BATCH {
    ObjectId _id PK
    ObjectId vaccineId FK
    ObjectId hospitalId FK
    string batchNumber
    int quantity
    date expiryDate
    date arrivalDate
    string status "Available, Expired, Depleted"
}

%% MODULE 2: CLINIC MANAGEMENT (Nethmi)
%% Manages the physical locations and time slots
HOSPITAL {
    ObjectId _id PK
    string name
    string district
    string city
    object location "Lat/Lng from LocationIQ"
    string contactNumber
    string type "Govt, Private"
}

CLINIC {
    ObjectId _id PK
    ObjectId hospitalId FK
    ObjectId vaccineId FK
    date date
    string timeSlot "08:00-12:00"
    int maxCapacity
    int currentBookings
    string status "Scheduled, Active, Completed, Cancelled"
}

%% MODULE 3: APPOINTMENT ENGINE (Saniru)
%% Manages the booking transaction and queue
APPOINTMENT {
    ObjectId _id PK
    ObjectId clinicId FK
    ObjectId userId FK
    int queueNumber
    string status "Pending, Completed, Cancelled, No-Show"
    string qrCodeUrl "QR API Generated"
    date bookedAt
}

%% MODULE 4: PATIENT RECORDS & HISTORY (Kaveen)
%% Manages the permanent medical history and post-vax data
RECORD {
    ObjectId _id PK
    ObjectId userId FK
    ObjectId appointmentId FK
    ObjectId batchId FK "Traceability"
    date vaccinationDate
    string notes
    date nextDoseDate
    string certificateUrl "Generated PDF"
}

%% RELATIONSHIPS
%% Linking the specific modules together

%% Minidu's Relationships
VACCINE ||--o{ BATCH : "has many batches"

%% Nethmi's Relationships
HOSPITAL ||--o{ CLINIC : "hosts"
HOSPITAL ||--o{ BATCH : "stocks"

%% Saniru's Relationships
CLINIC ||--o{ APPOINTMENT : "has bookings"
USERS ||--o{ APPOINTMENT : "makes"

%% Kaveen's Relationships
APPOINTMENT ||--|| RECORD : "generates"
USERS ||--o{ RECORD : "has history"
BATCH ||--o{ RECORD : "used in"

%% Cross-Module Links
VACCINE ||--o{ CLINIC : "offered at"