# joro97/microservices-hospital-webapp architecture

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

- Interactive diagram: https://gitdiagram.com/joro97/microservices-hospital-webapp
- Repository: https://github.com/joro97/microservices-hospital-webapp

## Overview

This repository implements a hospital scheduling web application, with a browser frontend, an OAuth authorization server, a hospital API, and a skin-lesion detection service plus model-training code. The main user workflow is authentication followed by doctor discovery and appointment booking; doctor profiles, availability, and booking are backed by hospital-service. Separate capabilities include file/avatar handling, likes, and lesion prediction. The README documents the cloud-native scheduling product, but the excerpts do not establish most cross-service wiring; dashed, unevidenced links mark likely integration points rather than verified calls.

Main entry points: [`hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/controllers/DoctorsController.java`](https://github.com/joro97/microservices-hospital-webapp/blob/master/hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/controllers/DoctorsController.java) (Doctor and schedule API), [`hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/services/services/DBFileStorageServiceImpl.java`](https://github.com/joro97/microservices-hospital-webapp/blob/master/hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/services/services/DBFileStorageServiceImpl.java) (File storage service), [`frontend/src/app/core/helpers/auth.guard.ts`](https://github.com/joro97/microservices-hospital-webapp/blob/master/frontend/src/app/core/helpers/auth.guard.ts) (Role-based route guard), [`frontend/src/app/doctors/doctors.component.ts`](https://github.com/joro97/microservices-hospital-webapp/blob/master/frontend/src/app/doctors/doctors.component.ts) (Doctor discovery and profiles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_account["Login and registration<br/>[login.component.ts]"]
  node_authclient["Authentication service"]
  node_guard["Role-based route guard<br/>[auth.guard.ts]"]
  node_doctorui["Doctor discovery and profiles"]
  node_bookingui["Appointment booking"]
  node_patienthours["Booked hours"]
  node_lesionui["Lesion detection UI"]
end

subgraph group_hospital["Hospital API"]
  node_doctorsapi["Doctor and schedule API"]
  node_doctorservice["Doctor scheduling service<br/>[DoctorService.java]"]
  node_doctorstore[("Doctor and schedule records<br/>[Doctor.java]")]
  node_fileapi["File upload and retrieval"]
  node_filestore["File storage service"]
  node_filerecords[("Stored files<br/>[DBFile.java]")]
  node_likes["Doctor likes"]
end

subgraph group_oauth["Identity service"]
  node_oauthapi["OAuth and user endpoints"]
  node_userdetails["User and role service"]
  node_userstore[("User and authority repositories")]
end

subgraph group_detection["Lesion prediction"]
  node_prediction["Prediction endpoint"]
  node_model["Lesion detection model"]
end

subgraph group_training["Model training"]
  node_preprocess["Dataset preprocessing<br/>[preprocessor.py]"]
  node_trainingflow["Model training and evaluation<br/>[train_and_eval.py]"]
  node_trainmodel["Training model definition<br/>[definitions.py]"]
end

node_patient(("Patient or doctor"))

node_patient -->|"enters credentials"| node_account
node_account -.->|"requests login"| node_authclient
node_authclient -->|"requests token"| node_oauthapi
node_oauthapi -.->|"authenticates users"| node_userdetails
node_userdetails -->|"loads and saves"| node_userstore
node_doctorui -->|"requires role access"| node_guard
node_bookingui -->|"requires role access"| node_guard
node_patienthours -->|"requires role access"| node_guard
node_doctorui -.->|"loads doctors"| node_doctorsapi
node_bookingui -.->|"books appointment"| node_doctorsapi
node_patienthours -.->|"loads bookings"| node_doctorsapi
node_doctorsapi -->|"delegates scheduling"| node_doctorservice
node_doctorservice -.->|"reads and updates"| node_doctorstore
node_fileapi -->|"stores or retrieves"| node_filestore
node_filestore -->|"persists file data"| node_filerecords
node_filestore -->|"updates doctor avatar"| node_doctorstore
node_patient -.->|"likes doctor"| node_likes
node_lesionui -.->|"requests prediction"| node_prediction
node_prediction -->|"runs inference"| node_model
node_preprocess -->|"uses definitions"| node_trainmodel
node_trainingflow -->|"uses definitions"| node_trainmodel
node_trainingflow -.->|"provides trained weights"| node_model

click node_account "https://github.com/joro97/microservices-hospital-webapp/blob/master/frontend/src/app/account/login/login.component.ts"
click node_authclient "https://github.com/joro97/microservices-hospital-webapp/blob/master/frontend/src/app/core/services/authentication.service.ts"
click node_guard "https://github.com/joro97/microservices-hospital-webapp/blob/master/frontend/src/app/core/helpers/auth.guard.ts"
click node_doctorui "https://github.com/joro97/microservices-hospital-webapp/blob/master/frontend/src/app/doctors/doctors.component.ts"
click node_bookingui "https://github.com/joro97/microservices-hospital-webapp/blob/master/frontend/src/app/doctors/appointment/appointment.component.ts"
click node_patienthours "https://github.com/joro97/microservices-hospital-webapp/blob/master/frontend/src/app/patients/booked-hours/booked-hours.component.ts"
click node_lesionui "https://github.com/joro97/microservices-hospital-webapp/blob/master/frontend/src/app/doctors/doctor-lesion-detection/doctor-lesion-detection.component.ts"
click node_oauthapi "https://github.com/joro97/microservices-hospital-webapp/blob/master/oauth-authorization-server/src/main/java/com/baeldung/controller/TokenController.java"
click node_userdetails "https://github.com/joro97/microservices-hospital-webapp/blob/master/oauth-authorization-server/src/main/java/com/baeldung/service/HospitalUserDetailsService.java"
click node_userstore "https://github.com/joro97/microservices-hospital-webapp/blob/master/oauth-authorization-server/src/main/java/com/baeldung/repository/UserRepository.java"
click node_doctorsapi "https://github.com/joro97/microservices-hospital-webapp/blob/master/hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/controllers/DoctorsController.java"
click node_doctorservice "https://github.com/joro97/microservices-hospital-webapp/blob/master/hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/services/interfaces/DoctorService.java"
click node_doctorstore "https://github.com/joro97/microservices-hospital-webapp/blob/master/hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/models/entity/Doctor.java"
click node_fileapi "https://github.com/joro97/microservices-hospital-webapp/blob/master/hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/controllers/FileController.java"
click node_filestore "https://github.com/joro97/microservices-hospital-webapp/blob/master/hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/services/services/DBFileStorageServiceImpl.java"
click node_filerecords "https://github.com/joro97/microservices-hospital-webapp/blob/master/hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/models/entity/DBFile.java"
click node_likes "https://github.com/joro97/microservices-hospital-webapp/blob/master/hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/controllers/LikesController.java"
click node_prediction "https://github.com/joro97/microservices-hospital-webapp/blob/master/skin-lesion-detection-service/src/controller/predict_controller.py"
click node_model "https://github.com/joro97/microservices-hospital-webapp/blob/master/skin-lesion-detection-service/src/model/lesion_detection_model.py"
click node_preprocess "https://github.com/joro97/microservices-hospital-webapp/blob/master/skin-cancer-model-training/src/prepare/preprocessor.py"
click node_trainingflow "https://github.com/joro97/microservices-hospital-webapp/blob/master/skin-cancer-model-training/src/train/train_and_eval.py"
click node_trainmodel "https://github.com/joro97/microservices-hospital-webapp/blob/master/skin-cancer-model-training/src/train/definitions.py"

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_account,node_authclient,node_guard,node_doctorui,node_bookingui,node_patienthours,node_lesionui toneBlue
class node_doctorsapi,node_doctorservice,node_doctorstore,node_fileapi,node_filestore,node_filerecords,node_likes toneAmber
class node_oauthapi,node_userdetails,node_userstore toneMint
class node_prediction,node_model toneRose
class node_preprocess,node_trainingflow,node_trainmodel,node_patient toneIndigo
```

## Components

### Web application

- [Login and registration](https://github.com/joro97/microservices-hospital-webapp/blob/master/frontend/src/app/account/login/login.component.ts): `frontend/src/app/account/login/login.component.ts`
- [Authentication service](https://github.com/joro97/microservices-hospital-webapp/blob/master/frontend/src/app/core/services/authentication.service.ts): `frontend/src/app/core/services/authentication.service.ts`
- [Role-based route guard](https://github.com/joro97/microservices-hospital-webapp/blob/master/frontend/src/app/core/helpers/auth.guard.ts): `frontend/src/app/core/helpers/auth.guard.ts`
- [Doctor discovery and profiles](https://github.com/joro97/microservices-hospital-webapp/blob/master/frontend/src/app/doctors/doctors.component.ts): `frontend/src/app/doctors/doctors.component.ts`
- [Appointment booking](https://github.com/joro97/microservices-hospital-webapp/blob/master/frontend/src/app/doctors/appointment/appointment.component.ts): `frontend/src/app/doctors/appointment/appointment.component.ts`
- [Booked hours](https://github.com/joro97/microservices-hospital-webapp/blob/master/frontend/src/app/patients/booked-hours/booked-hours.component.ts): `frontend/src/app/patients/booked-hours/booked-hours.component.ts`
- [Lesion detection UI](https://github.com/joro97/microservices-hospital-webapp/blob/master/frontend/src/app/doctors/doctor-lesion-detection/doctor-lesion-detection.component.ts): `frontend/src/app/doctors/doctor-lesion-detection/doctor-lesion-detection.component.ts`

### Hospital API

- [Doctor and schedule API](https://github.com/joro97/microservices-hospital-webapp/blob/master/hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/controllers/DoctorsController.java): `hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/controllers/DoctorsController.java`
- [Doctor scheduling service](https://github.com/joro97/microservices-hospital-webapp/blob/master/hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/services/interfaces/DoctorService.java): `hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/services/interfaces/DoctorService.java`
- [Doctor and schedule records](https://github.com/joro97/microservices-hospital-webapp/blob/master/hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/models/entity/Doctor.java): `hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/models/entity/Doctor.java`
- [File upload and retrieval](https://github.com/joro97/microservices-hospital-webapp/blob/master/hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/controllers/FileController.java): `hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/controllers/FileController.java`
- [File storage service](https://github.com/joro97/microservices-hospital-webapp/blob/master/hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/services/services/DBFileStorageServiceImpl.java): `hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/services/services/DBFileStorageServiceImpl.java`
- [Stored files](https://github.com/joro97/microservices-hospital-webapp/blob/master/hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/models/entity/DBFile.java): `hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/models/entity/DBFile.java`
- [Doctor likes](https://github.com/joro97/microservices-hospital-webapp/blob/master/hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/controllers/LikesController.java): `hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/controllers/LikesController.java`

### Identity service

- [OAuth and user endpoints](https://github.com/joro97/microservices-hospital-webapp/blob/master/oauth-authorization-server/src/main/java/com/baeldung/controller/TokenController.java): `oauth-authorization-server/src/main/java/com/baeldung/controller/TokenController.java`
- [User and role service](https://github.com/joro97/microservices-hospital-webapp/blob/master/oauth-authorization-server/src/main/java/com/baeldung/service/HospitalUserDetailsService.java): `oauth-authorization-server/src/main/java/com/baeldung/service/HospitalUserDetailsService.java`
- [User and authority repositories](https://github.com/joro97/microservices-hospital-webapp/blob/master/oauth-authorization-server/src/main/java/com/baeldung/repository/UserRepository.java): `oauth-authorization-server/src/main/java/com/baeldung/repository/UserRepository.java`

### Lesion prediction

- [Prediction endpoint](https://github.com/joro97/microservices-hospital-webapp/blob/master/skin-lesion-detection-service/src/controller/predict_controller.py): `skin-lesion-detection-service/src/controller/predict_controller.py`
- [Lesion detection model](https://github.com/joro97/microservices-hospital-webapp/blob/master/skin-lesion-detection-service/src/model/lesion_detection_model.py): `skin-lesion-detection-service/src/model/lesion_detection_model.py`

### Model training

- [Dataset preprocessing](https://github.com/joro97/microservices-hospital-webapp/blob/master/skin-cancer-model-training/src/prepare/preprocessor.py): `skin-cancer-model-training/src/prepare/preprocessor.py`
- [Model training and evaluation](https://github.com/joro97/microservices-hospital-webapp/blob/master/skin-cancer-model-training/src/train/train_and_eval.py): `skin-cancer-model-training/src/train/train_and_eval.py`
- [Training model definition](https://github.com/joro97/microservices-hospital-webapp/blob/master/skin-cancer-model-training/src/train/definitions.py): `skin-cancer-model-training/src/train/definitions.py`

### Other components

- **Patient or doctor**

## Connections

- Patient or doctor → Login and registration: enters credentials
- Login and registration → Authentication service: requests login (evidence: `frontend/src/app/account/login/login.component.ts`)
- Authentication service → OAuth and user endpoints: requests token (evidence: `frontend/src/app/core/services/authentication.service.ts`)
- OAuth and user endpoints → User and role service: authenticates users
- User and role service → User and authority repositories: loads and saves (evidence: `oauth-authorization-server/src/main/java/com/baeldung/service/HospitalUserDetailsService.java`)
- Doctor discovery and profiles → Role-based route guard: requires role access (evidence: `frontend/src/app/doctors/doctors.routing.ts`)
- Appointment booking → Role-based route guard: requires role access (evidence: `frontend/src/app/doctors/doctors.routing.ts`)
- Booked hours → Role-based route guard: requires role access (evidence: `frontend/src/app/patients/patients.routing.ts`)
- Doctor discovery and profiles → Doctor and schedule API: loads doctors
- Appointment booking → Doctor and schedule API: books appointment
- Booked hours → Doctor and schedule API: loads bookings
- Doctor and schedule API → Doctor scheduling service: delegates scheduling (evidence: `hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/controllers/DoctorsController.java`)
- Doctor scheduling service → Doctor and schedule records: reads and updates (evidence: `hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/services/interfaces/DoctorService.java`)
- File upload and retrieval → File storage service: stores or retrieves (evidence: `hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/controllers/FileController.java`)
- File storage service → Stored files: persists file data (evidence: `hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/services/services/DBFileStorageServiceImpl.java`)
- File storage service → Doctor and schedule records: updates doctor avatar (evidence: `hospital-service/src/main/java/com/hospital/webapp/hospitalMicroservice/services/services/DBFileStorageServiceImpl.java`)
- Patient or doctor → Doctor likes: likes doctor
- Lesion detection UI → Prediction endpoint: requests prediction
- Prediction endpoint → Lesion detection model: runs inference (evidence: `skin-lesion-detection-service/src/controller/predict_controller.py`)
- Dataset preprocessing → Training model definition: uses definitions (evidence: `skin-cancer-model-training/src/prepare/preprocessor.py`)
- Model training and evaluation → Training model definition: uses definitions
- Model training and evaluation → Lesion detection model: provides trained weights
