# nandakishore-menon/hospital-management-system architecture

> Architecture diagram of the GitHub repository nandakishore-menon/hospital-management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nandakishore-menon/hospital-management-system
- Repository: https://github.com/nandakishore-menon/hospital-management-system

## Overview

WE-CARE is a terminal-based patient-record manager. The user selects operations from the main menu to add, display, search, edit, or delete patient records, and can filter records by blood group, doctor, diagnosis, or visit date. Patient data is stored in binary files; visit dates are kept separately in files named for each patient. The sampled source shows the menu dispatch and several feature implementations; other module behavior is represented only where the README or menu documents it.

Main entry points: [`main.c`](https://github.com/nandakishore-menon/hospital-management-system/blob/master/main.c) (Menu dispatcher), [`print.c`](https://github.com/nandakishore-menon/hospital-management-system/blob/master/print.c) (Record listing), [`search.c`](https://github.com/nandakishore-menon/hospital-management-system/blob/master/search.c) (Search records), [`log.c`](https://github.com/nandakishore-menon/hospital-management-system/blob/master/log.c) (Visit-date filter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Patient workflow"]
  node_main["Menu dispatcher<br/>[main.c]"]
  node_add["Add patient<br/>[add_patient.c]"]
  node_edit["Edit patient<br/>[edit.c]"]
  node_delete["Delete patient<br/>[delete.c]"]
end

subgraph group_lookup["Record lookup"]
  node_search["Search records<br/>[search.c]"]
  node_blood["Blood-group filter<br/>[bgrp.c]"]
  node_doctor["Doctor filter<br/>[doctor.c]"]
  node_diagnosis["Diagnosis filter<br/>[diagnosis.c]"]
  node_datequery["Visit-date filter<br/>[log.c]"]
end

subgraph group_storage["File storage"]
  node_records[("Patient records")]
  node_visitlogs[("Patient visit logs")]
end

subgraph group_presentation["Terminal output"]
  node_print["Record listing<br/>[print.c]"]
  node_display["Patient details<br/>[display.c]"]
  node_namepid["Name and ID listing<br/>[printname_pid.c]"]
end

node_user(("User"))

node_user -->|"selects operation"| node_main
node_main -->|"dispatches display"| node_print
node_main -->|"dispatches add"| node_add
node_main -->|"dispatches search"| node_search
node_main -->|"dispatches edit"| node_edit
node_main -->|"dispatches delete"| node_delete
node_main -->|"dispatches filter"| node_blood
node_main -->|"dispatches filter"| node_doctor
node_main -->|"dispatches filter"| node_diagnosis
node_main -->|"dispatches filter"| node_datequery
node_add -->|"writes records"| node_records
node_add -->|"writes visit date"| node_visitlogs
node_edit -->|"rewrites records"| node_records
node_edit -->|"appends visit date"| node_visitlogs
node_delete -->|"rewrites records"| node_records
node_delete -->|"removes patient log"| node_visitlogs
node_records -->|"reads records"| node_print
node_records -->|"reads records"| node_search
node_search -->|"displays match"| node_display
node_search -->|"lists matches"| node_namepid
node_records -->|"reads records"| node_blood
node_blood -->|"prints matches"| node_print
node_records -->|"reads records"| node_doctor
node_doctor -->|"prints matches"| node_print
node_records -->|"reads records"| node_diagnosis
node_diagnosis -->|"prints matches"| node_print
node_records -->|"reads records"| node_datequery
node_datequery -->|"checks visit dates"| node_visitlogs
node_datequery -->|"prints matches"| node_print
node_print -->|"reads visit dates"| node_visitlogs

click node_main "https://github.com/nandakishore-menon/hospital-management-system/blob/master/main.c"
click node_add "https://github.com/nandakishore-menon/hospital-management-system/blob/master/add_patient.c"
click node_edit "https://github.com/nandakishore-menon/hospital-management-system/blob/master/edit.c"
click node_delete "https://github.com/nandakishore-menon/hospital-management-system/blob/master/delete.c"
click node_search "https://github.com/nandakishore-menon/hospital-management-system/blob/master/search.c"
click node_blood "https://github.com/nandakishore-menon/hospital-management-system/blob/master/bgrp.c"
click node_doctor "https://github.com/nandakishore-menon/hospital-management-system/blob/master/doctor.c"
click node_diagnosis "https://github.com/nandakishore-menon/hospital-management-system/blob/master/diagnosis.c"
click node_datequery "https://github.com/nandakishore-menon/hospital-management-system/blob/master/log.c"
click node_print "https://github.com/nandakishore-menon/hospital-management-system/blob/master/print.c"
click node_display "https://github.com/nandakishore-menon/hospital-management-system/blob/master/display.c"
click node_namepid "https://github.com/nandakishore-menon/hospital-management-system/blob/master/printname_pid.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_add,node_edit,node_delete,node_user toneBlue
class node_search,node_blood,node_doctor,node_diagnosis,node_datequery toneAmber
class node_records,node_visitlogs toneMint
class node_print,node_display,node_namepid toneRose
```

## Components

### Patient workflow

- [Menu dispatcher](https://github.com/nandakishore-menon/hospital-management-system/blob/master/main.c): `main.c`
- [Add patient](https://github.com/nandakishore-menon/hospital-management-system/blob/master/add_patient.c): `add_patient.c`
- [Edit patient](https://github.com/nandakishore-menon/hospital-management-system/blob/master/edit.c): `edit.c`
- [Delete patient](https://github.com/nandakishore-menon/hospital-management-system/blob/master/delete.c): `delete.c`

### Record lookup

- [Search records](https://github.com/nandakishore-menon/hospital-management-system/blob/master/search.c): `search.c`
- [Blood-group filter](https://github.com/nandakishore-menon/hospital-management-system/blob/master/bgrp.c): `bgrp.c`
- [Doctor filter](https://github.com/nandakishore-menon/hospital-management-system/blob/master/doctor.c): `doctor.c`
- [Diagnosis filter](https://github.com/nandakishore-menon/hospital-management-system/blob/master/diagnosis.c): `diagnosis.c`
- [Visit-date filter](https://github.com/nandakishore-menon/hospital-management-system/blob/master/log.c): `log.c`

### File storage

- **Patient records**
- **Patient visit logs**

### Terminal output

- [Record listing](https://github.com/nandakishore-menon/hospital-management-system/blob/master/print.c): `print.c`
- [Patient details](https://github.com/nandakishore-menon/hospital-management-system/blob/master/display.c): `display.c`
- [Name and ID listing](https://github.com/nandakishore-menon/hospital-management-system/blob/master/printname_pid.c): `printname_pid.c`

### Other components

- **User**

## Connections

- User → Menu dispatcher: selects operation
- Menu dispatcher → Record listing: dispatches display
- Menu dispatcher → Add patient: dispatches add
- Menu dispatcher → Search records: dispatches search
- Menu dispatcher → Edit patient: dispatches edit
- Menu dispatcher → Delete patient: dispatches delete
- Menu dispatcher → Blood-group filter: dispatches filter
- Menu dispatcher → Doctor filter: dispatches filter
- Menu dispatcher → Diagnosis filter: dispatches filter
- Menu dispatcher → Visit-date filter: dispatches filter
- Add patient → Patient records: writes records
- Add patient → Patient visit logs: writes visit date
- Edit patient → Patient records: rewrites records
- Edit patient → Patient visit logs: appends visit date
- Delete patient → Patient records: rewrites records
- Delete patient → Patient visit logs: removes patient log
- Patient records → Record listing: reads records
- Patient records → Search records: reads records
- Search records → Patient details: displays match
- Search records → Name and ID listing: lists matches
- Patient records → Blood-group filter: reads records
- Blood-group filter → Record listing: prints matches
- Patient records → Doctor filter: reads records
- Doctor filter → Record listing: prints matches
- Patient records → Diagnosis filter: reads records
- Diagnosis filter → Record listing: prints matches
- Patient records → Visit-date filter: reads records
- Visit-date filter → Patient visit logs: checks visit dates
- Visit-date filter → Record listing: prints matches
- Record listing → Patient visit logs: reads visit dates
