# ambientwave/odoo-dental-clinic-managment-system-with-rest-api architecture

> Architecture diagram of the GitHub repository ambientwave/odoo-dental-clinic-managment-system-with-rest-api, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api
- Repository: https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api

## Overview

##### Project type and purpose
- This is an Odoo module (“Odoo-Dental-Clinic-Management-System-With-REST-API”) that extends the Odoo ERP platform to manage dental-clinic workflows (patients, appointments, prescriptions) and provides a token-based REST API for authentication and appointment creation.

##### File structure
- __manifest__.py / __init__.py: module metadata and entry points.
- controllers/: REST controllers (login, common endpoints).
- models/: ORM classes (Patient, ClinicDoctor, PatientAppointment, AppointmentDentalProcedureLine, AppointmentAttachmentLine, PatientPrescription, AccessToken).
- views/: XML files customizing Odoo’s web UI (form views for patients, appointments, back-office dashboards).
- data/: initial data load (data.xml).
- security/: access control rules (ir.model.access.csv, security.xml).
- static/src/js, scss, xml: frontend assets for a custom ToothChart widget.

##### Extracted insights from README
- Core functionality: manage patients, appointments, prescriptions.
- Exposes login and appointment-creation endpoints via a REST API.
- Relies on Odoo’s MVC architecture plus a custom JS/SCSS widget.

- External Clients: Web browser (Odoo web UI) and API consumers (mobile app, external services).
- Odoo Server:
- Controllers layer (login.py, common.py) – REST API entry points.
- Models / ORM layer (all models/*.py) – business entities.
- View layer (views/*.xml + static assets) – UI definitions and JS widgets.
- Security layer (security/*.xml & CSV) – access rules and ACLs.
- PostgreSQL Database: persistent storage for all models.
- Static Asset Server: serves JS/SCSS/ToothChart widget.

b. Relationships & data flow
- UI Clients → HTTP → Odoo web server → View controllers → ORM → DB
- API Clients → HTTP/JSON → controllers/login.py → AccessToken model → ORM → DB
→ controllers/common.py → Appointment model → DB
- Odoo view XML definitions pull static assets (ToothChart.js + CSS) into browser.

c. Architectural patterns & principles
- MVC:
- Model = Odoo models/*.py mapped to DB tables
- View = XML and JS widget for dynamic charting
- Controller = Python code handling HTTP/JSON
- Token-based authentication for API (AccessToken model)
- Modular plugin for Odoo: encapsulation of functionality in a single add-on

d. Key technologies/frameworks
- Python 3 + Odoo framework
- PostgreSQL
- XML (Odoo views, data import)
- JavaScript/SCSS for custom ToothChart widget

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Clients
    subgraph "External Clients"
        direction TB
        WebUI["Web Browser UI"]:::frontend
        APIClient["API Client (Mobile/App)"]:::api
    end

    %% Odoo Module Layers
    subgraph "Odoo Module: Dental Clinic Management" 
        direction TB

        %% Controllers Layer
        subgraph "Controllers (REST API)" 
            direction TB
            LoginCtrl["login.py\n(/api/auth/login)"]:::backend
            CommonCtrl["common.py\n(/api/appointments)"]:::backend
            CtrlInit["__init__.py"]:::backend
        end

        %% Models Layer
        subgraph "Models (ORM Layer)" 
            direction TB
            AccessToken["AccessToken"]:::backend
            Patient["Patient"]:::backend
            ClinicDoctor["ClinicDoctor"]:::backend
            Appointment["PatientAppointment"]:::backend
            ProcedureLine["AppointmentDentalProcedureLine"]:::backend
            AttachmentLine["AppointmentAttachmentLine"]:::backend
            Prescription["PatientPrescription"]:::backend
            ModelsInit["__init__.py"]:::backend
        end

        %% Views Layer
        subgraph "Views (XML & UI)" 
            direction TB
            PatientView["patient_view.xml"]:::frontend
            AppointmentView["appointment_view.xml"]:::frontend
            CustomForm["Patient_Appointment_Form_view_customization.xml"]:::frontend
            BackendView["backend.xml"]:::frontend
        end

        %% Security Layer
        subgraph "Security & ACL" 
            direction TB
            SecurityXML["security.xml"]:::backend
            AccessCSV["ir.model.access.csv"]:::backend
        end

        %% Data Initialization
        DataXML["data.xml"]:::backend

        %% Static Assets
        subgraph "Static Assets (ToothChart Widget)" 
            direction TB
            ToothChartJS["ToothChart.js"]:::frontend
            ToothChartSCSS["toothChart.scss"]:::frontend
            ToothChartXML["ToothChart.xml"]:::frontend
        end
    end

    %% Database
    Database["PostgreSQL Database"]:::database

    %% Interactions
    WebUI -->|"HTTP/HTML|XML"| BackendView
    BackendView -->|"Loads XML definitions"| OdooServer[("Odoo Server")]:::backend
    OdooServer -->|"RPC/ORM Calls"| Patient
    OdooServer -->|"RPC/ORM Calls"| Appointment
    OdooServer -->|"Serve Static"| ToothChartJS
    OdooServer -->|"Serve Styles"| ToothChartSCSS

    APIClient -->|"HTTP/JSON"| LoginCtrl
    LoginCtrl -->|"Validate Token"| AccessToken
    AccessToken -->|"ORM"| Database

    APIClient -->|"HTTP/JSON"| CommonCtrl
    CommonCtrl -->|"Create Appointment"| Appointment
    Appointment -->|"ORM"| Database

    DataXML -->|"Initial Load"| Database
    SecurityXML -->|"Enforce ACLs"| ModelsInit
    AccessCSV -->|"Enforce Rules"| ModelsInit

    %% Click Events
    click LoginCtrl "https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api/blob/main/controllers/login.py"
    click CommonCtrl "https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api/blob/main/controllers/common.py"
    click CtrlInit "https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api/blob/main/controllers/__init__.py"

    click AccessToken "https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api/blob/main/models/access_token.py"
    click Patient "https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api/blob/main/models/patient.py"
    click ClinicDoctor "https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api/blob/main/models/clinic_doctor.py"
    click Appointment "https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api/blob/main/models/patient_appointment.py"
    click ProcedureLine "https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api/blob/main/models/appointment_dental_procedure_line.py"
    click AttachmentLine "https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api/blob/main/models/appointment_attachment_line.py"
    click Prescription "https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api/blob/main/models/patient_prescription.py"
    click ModelsInit "https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api/blob/main/models/__init__.py"

    click PatientView "https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api/blob/main/views/patient_view.xml"
    click AppointmentView "https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api/blob/main/views/appointment_view.xml"
    click CustomForm "https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api/blob/main/views/Patient_Appointment_Form_view_customization.xml"
    click BackendView "https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api/blob/main/views/backend.xml"

    click DataXML "https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api/blob/main/data/data.xml"

    click SecurityXML "https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api/blob/main/security/security.xml"
    click AccessCSV "https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api/blob/main/security/ir.model.access.csv"

    click ToothChartJS "https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api/blob/main/static/src/js/ToothChart.js"
    click ToothChartSCSS "https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api/blob/main/static/src/scss/toothChart.scss"
    click ToothChartXML "https://github.com/ambientwave/odoo-dental-clinic-managment-system-with-rest-api/blob/main/static/src/xml/ToothChart.xml"

    %% Styles
    classDef backend fill:#d0e1f9,stroke:#3a5785,stroke-width:1px
    classDef frontend fill:#fff4c1,stroke:#a67c00,stroke-width:1px
    classDef api fill:#ffd6cc,stroke:#cc3300,stroke-width:1px
    classDef database fill:#d0f9d8,stroke:#2d7a2d,stroke-width:1px
```
