platform that allows patient data safety in kenya
# AfyaKey - Patient-Led Health Records
AfyaKey is a secure, patient-centric medical record management system designed for the Kenyan healthcare ecosystem. It empowers patients to own their medical history and selectively share it with healthcare providers.
## System Flow Summary
1. **Secure Authentication**: Users register and log in using Email and Password. The system distinguishes between Patients, Practitioners, and Facility Admins.
2. **Unified Patient Dashboard**:
- Patients get an immediate overview of their total records and active sharing consents.
- Real-time notifications for pending access requests from hospitals or labs.
3. **Smart Medical Records**:
- **Digital Storage**: Centralized view of all clinical documents like prescriptions and lab results.
- **AI Insights**: Integrated with Google Genkit (Gemini) to provide "AI Summaries." This feature simplifies complex medical jargon into patient-friendly language and extracts key findings automatically.
4. **Sovereign Consent Control**:
- Patients have absolute control over who accesses their PHI (Protected Health Information).
- Granular permissions (Profile, Records, Emergency) can be granted or revoked instantly.
5. **Emergency "Break-Glass" Access**:
- A dedicated Emergency QR code provides medical responders with immediate access to critical vitals (Blood Type, Allergies) during crises, even if full records are locked.
6. **Facility & Practitioner Portal**:
- Healthcare facilities can search for patients and request permission to view history.
- Audit logs track every single data access event to ensure compliance with the Kenya Data Protection Act.
## Tech Stack
- **Framework**: Next.js 15 (App Router)
- **Database & Auth**: Firebase (Firestore & Authentication)
- **AI Pipeline**: Google Genkit using Gemini 2.5 Flash
- **UI/UX**: Tailwind CSS, ShadCN UI, and Lucide Icons
- **Typography**: Manrope (Optimized for readability and mobile flexibility)
---
*Compliant with Kenya Data Protection Ac …