The AI-Powered Unified Clinic Notes & Billing System is a full-stack application designed to simplify clinic workflows by allowing doctors to enter prescriptions, lab tests, and clinical notes in a single unified interface. The system uses AI to automatically classify unstructured medical text into structured data and generates billing and printable PDF reports.
This project demonstrates practical integration of AI/NLP with a scalable software architecture, focusing on usability, structured data storage, billing accuracy, and report generation.
-
Unified clinic input screen for doctors
-
AI-powered medical text classification
-
Automatic extraction of:
- Drugs & dosages
- Lab tests
- Clinical notes
-
Structured database storage
-
Billing calculation based on drugs and lab tests
-
Printable PDF medical report
-
Clean REST API architecture
-
Modular backend design
-
Responsive NextJS 13 frontend
- Golang
- Echo Framework
- PostgreSQL
- AI API (LLM-based text classification)
- gofpdf (PDF generation)
- NextJS 13
- TypeScript
- React Query
- Axios
- PostgreSQL
- Docker (optional)
- Postman
- Draw.io (Architecture diagrams)
The system follows a layered architecture with clear separation of concerns.
React Frontend
β
Golang API (Echo)
β
Service Layer
β
AI Service
β
Repository Layer
β
PostgreSQL Database
- AI API for NLP classification
- PDF generator for report printing
AI is used to convert unstructured medical text into structured clinical data.
-
Doctor enters medical text
-
Backend sends text to AI service
-
AI extracts:
- Drugs
- Lab tests
- Clinical notes
-
Data is validated
-
Structured data stored in PostgreSQL
-
Billing calculated
-
PDF report generated
Input
Patient has fever for 3 days. Prescribe Paracetamol 500mg twice daily. Order CBC test.
AI Output
Drugs:
Paracetamol 500mg
Lab Tests:
CBC
Notes:
Patient has fever for 3 days
The database is designed using normalized relational tables.
- patients
- visits
- prescribed_drugs
- lab_tests
- clinical_notes
- drug_catalog
- lab_test_catalog
- billing
- Catalog tables store official prices
- Visit tables store structured AI output
- Snapshot pricing ensures billing consistency
- Raw AI input is stored for auditing
Billing is calculated using:
Grand Total = Consultation Fee + Drug Prices + Lab Test Prices
- Drug prices fetched from
drug_catalog - Lab test prices fetched from
lab_test_catalog - Prices stored in visit tables
- Billing stored in
billingtable
- Consistent billing
- Historical price tracking
- Easy invoice generation
The system generates a printable PDF report for each visit.
- Clinic information
- Patient details
- Prescription
- Lab tests
- Clinical notes
- Billing summary
GET /visits/{id}/report
PDF file ready for printing or download.
POST /visits
Create new visit and process AI classification
GET /visits
Get all visits
GET /visits/{id}
Get visit details
GET /billing/{visit_id}
Get billing details
GET /visits/{id}/report
Download PDF invoice
swag init -g main.go -d cmd/service,internal
- Doctor enters medical text
- AI processes text
- Structured data displayed
- Billing calculated
- PDF invoice generated
- User downloads invoice
- Go 1.25+
- Node.js 18+
- PostgreSQL
- AI API Key
git clone https://github.com/KNR1997/21c_Care.git
cd 21c_Care
Create .env
PORT=8080
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=postgres
DB_NAME=clinic
AI_API_KEY=your_api_key
psql -U postgres
CREATE DATABASE clinic;
goose -dir ./migrations postgres "host=localhost user=myuser password=mypassword dbname=mydatabase port=5432 sslmode=disable" up
air
Server runs on:
http://localhost:7788
cd web
yarn
copy `.env.template` to `.env`
yarn dev
App runs on:
http://localhost:3002
Doctor enters:
Patient has headache. Prescribe Ibuprofen 200mg. Order MRI.
AI extracts:
- Ibuprofen
- MRI
- headache
Database stores structured data
Billing generated
PDF report downloaded
backend/
internal/
handlers/
services/
repositories/
ai/
report/
database/
main.go
frontend/
src/
components/
pages/
data/
client/
- AI classification may not be 100% accurate
- Drug and lab test catalog contains common items
- Consultation fee is fixed
- Single clinic environment
- Internet connection required for AI API
Software Engineer Candidate
AI-Powered Clinic System Technical Assessment