# Architecture summary

This Spring Boot application uses both MVC and REST controllers. 

Thymeleaf templates are used for the Admin and Doctor dashboards, while REST APIs serve all other modules. 

The application interacts with two databases—MySQL (for patient, doctor, appointment, and admin data) and MongoDB (for prescriptions). 

All controllers route requests through a common service layer, which in turn delegates to the appropriate repositories. MySQL uses JPA entities while MongoDB uses document models.

# Numbered flow of data and control

1. User accesses AdminDashboard or Appointment pages.
2. The action is routed to the appropriate Thymeleaf or REST controller.
3. The controller calls the service layer to fetch data to display or execute a user initiated operation
4. The service layer deduces what data is required for the business logic and either accesses the MySQL repositories or 
   MongoDB repositories as needed.
5. Both the Mysql and MongDB repositories translate the data JPA queries to database queries (SQL for 
   MySQL, and NOSQL for MongoDB) and executes them as database transactions on the actual databases using the database 
   drivers 
6. The database queries are executed on the entity models defined for the databases and the data is retrieved from 
   the database
7. Finally, the data traverses back up via each layer up to either the Thymleaf template where it is rendered as 
   HTML or to the REST Controller where the data is served as JSON.