How ghostblaster08/smile_horizon works
Main System Components
a. Backend (Django):
• The core of the application is built using Django 4.2+.
• It includes several Django apps (modules) such as:
• Appointment: Manages appointments and treatment records.
• Patient: Handles patient registration, medical history, and document management.
• Prescription: Manages medicines and prescription details.
• User: Manages user profiles (extending Django’s AbstractUser for roles like doctors and staff).
• Core: Provides shared functionality such as the dashboard and common utilities.
• The project’s main directory (Smile_Horizon/Smile_Horizon) holds the global settings, main URL router, and server configuration.
• Use of Django’s MTV architecture (Models, Templates, and Views) is evident, with models defining the data, views containing the business logic, and templates handling presentation in the backend.
• Built-in authentication system as part of the backend.
b. Frontend:
• Two frontend approaches are in the repository:
• Traditional Django Templates: Found under the “templates” directory, using HTML, CSS, JavaScript, and Bootstrap 5.
• React-based Frontend: Located in the “react_smilehorizon” directory. This part contains a complete React project (with its own package.json, Tailwind CSS configuration, and components) indicating an SPA interface which likely interacts with backend endpoints (via Django REST Framework serializers present in several apps).
c. Database:
• The application uses SQLite by default (as seen in the db.sqlite3 file), with a note in the README that it’s configurable for PostgreSQL, MySQL, or other production-grade databases.
d. Additional Concerns:
• Static and Media Files: Managed by Django (static assets and uploaded files).
• Migration files in each app ensure that the database schema is synchronized with the defined models.
• Integration Between Frontend and Backend: Likely REST API endpoints exist (evidenced by serializers in Appointment, Patient, and Prescription apps) that are consumed by the React SPA.
Relationships & Data Flow
• The client (web browser) interacts with the system using both the traditional Django-rendered pages and the React SPA.
• For the React SPA:
• The frontend (React application) sends HTTP requests (possibly AJAX/Fetch calls) to REST API endpoints served by the Django backend.
• Responses from Django (via views/serializers) are used to update the UI dynamically.
• In the backend:
• Views call business logic, interact with models, and use serializers to produce JSON data for the frontend when needed.
• Django’s URL routing (both in the main project and within individual apps) manages the endpoints.
• The database is accessed via Django’s ORM, storing the core data (patients, appointments, prescriptions, user accounts, etc.)
Architectural Patterns and Design Principles
• Separation of Concerns: Clear division between individual Django apps (each handling a specific business domain) and the separation between the presentation layer (templates/React) and the business logic.
• REST API Pattern: Evidenced by serializers in multiple apps, suggesting that the backend is built to serve data to the React frontend.
• MVC/MVT Architecture: The project follows Django’s conventional patterns, with a strict separation between data models, views (business logic), and templates.
• Frontend-Backend Decoupling: With the presence of a dedicated React project, the system design should show loosely-coupled interactions via clearly defined API contracts.