Peritoneal Dialysis (PD) management application
- Project Overview The Peritoneal Dialysis (PD) Management App is designed to help patients and providers monitor and manage peritoneal dialysis treatment. The application allows patients to log their health data, provides analytics for trend monitoring, and enables providers to make informed treatment decisions based on notifications.
1.1 Features
• Patient Module:
o Input and track dialysis session details (weight, blood pressure, effluent volume).
o Monitor trends and receive alerts for negative patterns.
o Log daily meals and track protein intake.
• Provider Module:
o Dashboard to track patient data and identify high-risk cases.
o View analytics and adjust treatment recommendations.
• Security & Authentication:
o OAuth2-based authentication with JWT.
o Role-based access control (patients, providers).
• Deployment:
o backend (FastAPI).
o Frontend built with React (Next.js).
o PostgreSQL database.
o Dockerized deployment.
• Mockups:
o Mockups were designed in Figma
2.1 Authentication Endpoints
• POST /auth/register – Register new users.
• POST /auth/login – Authenticate users and return JWT.
• POST /auth/logout – Invalidate session.
2.2 Patient Endpoints
• POST /patients/{id}/dialysis-session – Log dialysis session.
• GET /patients/{id}/dialysis-history – Retrieve dialysis history.
• POST /patients/{id}/meal-log – Log meals and protein intake.
• GET /patients/{id}/nutrition-summary – Get daily protein intake summary.
2.3 Provider Endpoints
• GET /providers/dashboard – View all patients' status.
• GET /patients/{id}/risk-analysis – Fetch analytics and flag high-risk cases.
• PUT /patients/{id}/treatment-plan – Update treatment plan.
- Database Schema (PostgreSQL)
3.1 Tables
-users
-dialysis_sessions
-food_intake
Backend:
pip install -r requirements.txt
uvicorn app.api.main:app --reload --host 0.0.0.0 --port 8004 --log-level debug
Frontend:
npm install
npm run build
npm run dev
Hapi FHIR Server:
running at:
http://localhost:8080
- Assuming you have docker installed and setup on your machince.
to start the container run:
docker-compose up --build
to stop the container run:
docker-compose down
Swagger Specs: http://localhost:8004/docs#/
Backend APIs URL: http://localhost:8004/
Frontend- React URL: http://localhost:3000/
-
Hapi FHIR https://hapi.igortaskovski.com/
flowchart TD
%% CLIENT SIDE
subgraph ClientBrowser["Patient / Provider Browser"]
LoginForm[Login Form]
Dashboard[Dashboard]
DialysisForm[Dialysis Form]
UI[Angular Frontend]
LoginForm -->|POST /auth/token| UI
Dashboard -->|GET /dialysis/analytics| UI
DialysisForm -->|POST /dialysis/sessions| UI
end
%% FRONTEND CONTAINER
subgraph Frontend["Frontend - Angular Docker Container"]
UI
end
%% BACKEND CONTAINER
subgraph Backend["Backend - FastAPI Docker Container"]
API[FastAPI App]
Auth[Auth Routes - /auth/token and /auth/register]
Dialysis[Dialysis Routes - /dialysis/sessions and /analytics]
FHIR[New FHIR Routes - /fhir/patients and /fhir/resources]
Seeder[Seeder Script]
Alembic[Alembic Migrations]
API --> Auth
API --> Dialysis
API --> FHIR
API --> Seeder
API --> Alembic
end
%% DATABASE CONTAINER
subgraph Database["PostgreSQL Docker Container"]
DB[(pd_management)]
Tables[users, dialysis_sessions, food_intake]
end
%% FHIR SERVER CONTAINER
subgraph FHIRServer["HAPI FHIR Server Docker Container"]
HappiFHIR[(HAPI FHIR Database)]
PatientResource[Patient Resources]
end
%% CONNECTIONS
UI -->|Fetch token, store JWT and user_id| Auth
UI -->|Submit dialysis data| Dialysis
UI -->|Fetch analytics and live updates| Dialysis
UI -->|Post / Fetch Patient Data| FHIR
Dialysis -->|SQLAlchemy Queries| DB
Auth -->|JWT creation and validation| DB
Seeder -->|Insert dummy data| DB
Alembic -->|Run migrations| DB
FHIR -->|POST / GET FHIR Resources| HappiFHIR
PatientResource --> HappiFHIR
%% DOCKER COMPOSE
subgraph DockerCompose["docker-compose"]
frontendService[frontend service]
backendService[backend service]
dbService[postgres service]
fhirService[HAPI FHIR server service]
frontendService --> Frontend
backendService --> Backend
dbService --> Database
fhirService --> FHIRServer
frontendService --> backendService
backendService --> fhirService
end
This workflow ensures clean progression of code from development (main) to testing (test) and final staging (stage).
git checkout main # Switch to main branch
git pull origin main # Get latest changes
git merge <your-branch> # Merge your work
git push origin main # Push updated maingit checkout test
git pull origin test
git merge main
git push origin testgit checkout stage
git pull origin stage
git merge test
git push origin stage