Finalize JavaScript Medical EHR

Job ID: 40418638

Budget: $15 – $25 USD

PatientFlow EHR — Developer Handoff Brief
1. Project Overview
PatientFlow is a custom Electronic Health Records (EHR) system built for urgent and primary care clinics in South Africa. It manages the full patient journey from registration → triage → consultation → billing → discharge, with integrated CRM, workflow automation, and real-time messaging.


2. Architecture
┌─────────────────────────────────┐
│ React Frontend │
│ (Port 3000 / Tailwind/UI) │
└──────────────┬──────────────────┘

┌──────────────▼──────────────────┐
│ Python/FastAPI API Gateway │
│ (Port 8001) │
│ server.py + gateway_router.py │
└─┬──────────┬──────────────┬─────┘
│ │ │
┌────────────▼┐ ┌────▼──────┐ ┌───▼───────────┐
│ .NET 8 API │ │ Go Service │ │ Python CRM │
│ (Port 5000) │ │(Port 5001) │ │ (Port 5002) │
│ EHR Business │ │ Messaging │ │ CRM/Analytics │
│ Logic + Auth │ │ PDF + WS │ │ Automation │
└──────┬───────┘ └────┬───────┘ └───┬───────────┘
│ │ │
┌──────▼────────────────▼───┐ ┌─────▼──────┐
│ MongoDB │ │ PostgreSQL │
│ (test_database) │ │(patientflow │
│ Clinical Data │ │ _crm) │
└───────────────────────────┘ └────────────┘
Service Breakdown
Service Port Tech Responsibility
React Frontend 3000 React 19, Tailwind, Shadcn UI All UI
API Gateway 8001 Python/FastAPI Routes requests, legacy endpoints, auth
.NET API 5000 C#/.NET 8 Auth, Patients, Triage, Encounters, Billing, Inventory
Go Services 5001 Go 1.22 WebSocket, WhatsApp (Twilio), PDF generation
Python CRM 5002 Python/FastAPI CRM, Analytics, Workflows, Tickets, Appointments, Staff
MongoDB 27017 MongoDB EHR clinical data
PostgreSQL 5432 PostgreSQL 15 CRM, scheduling, automation data
3. Directory Structure
/app/
├── frontend/ # React SPA
│ ├── src/
│ │ ├── components/ # Reusable (DashboardLayout, SymptomInput, ui/)
│ │ ├── pages/ # Route pages (Dashboard, Patients, ClinicalNotes, etc.)
│ │ ├── config/apiConfig.js # API URL routing config
│ │ └── App.js # Route definitions
│ ├── package.json
│ └── .env # REACT_APP_BACKEND_URL

├── backend/ # Legacy API Gateway
│ ├── server.py # Main monolith (3800+ lines) — auth, CRUD, billing
│ ├── gateway_router.py # Proxy routes to .NET/Go/Python services
│ ├── .env # MONGO_URL, DB_NAME
│ └── requirements.txt

├── dotnet-api/PatientFlowApi/ # .NET 8 Microservice
│ ├── Controllers/ # Auth, Patients, Triage, Encounters, Billing, Inventory
│ ├── Services/ # Business logic
│ ├── Models/ # Entities + DTOs
│ └── Program.cs # Startup config

├── go-services/ # Go Microservice
│ ├── cmd/server/main.go # Entry point
│ └── internal/
│ ├── messaging/twilio.go # WhatsApp via Twilio
│ ├── pdf/generator.go # PDF generation
│ └── websocket/ # Real-time updates

├── python-services/ # Python CRM Microservice
│ ├── main.py # FastAPI app
│ ├── database.py # PostgreSQL connection
│ ├── models/ # SQLAlchemy models
│ ├── routers/ # API routes (CRM, workflows, tickets, etc.)
│ └── services/ # Sync, analytics

└── memory/ # Project documentation
├── PRD.md # Product requirements
└── test_credentials.md # Auth credentials