# yousefmm09/doctorappointmentapi architecture

> Architecture diagram of the GitHub repository yousefmm09/doctorappointmentapi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yousefmm09/doctorappointmentapi
- Repository: https://github.com/yousefmm09/doctorappointmentapi

## Overview

##### Project Type and Purpose
- This is a full-stack Doctor Appointment Booking system with a .NET Core Web API backend, a React/JS frontend, real-time chat via SignalR, and an AI-powered chatbot microservice (Python/MedLLama). It follows a Clean Architecture (Controllers → Services → Repositories → EF Core → SQL Server).

##### File Structure Analysis
- Top-level “DoctorAppoitmentApi” (ASP.NET Core Web API solution)
- Controllers: HTTP endpoints (Account, Appointment, Chat, ChatBot, etc.)
- Dto: data contracts between client and server
- Models: EF Core entities & DbContext
- Migrations: DB schema evolution
- Repository & Service: business logic, data access (Repository pattern, DI)
- medllama & DCA/Chatbot: Python modules for LLM integration and fine-tuning
- frontend/src: React components (MedLLamaChat, PhoneVerification, etc.)
- wwwroot: static files, mock-payment, uploads
- Supporting solutions: ChatBotTester (C# test harness), DummyProject

##### README Insights
- Shows tech stack: ASP.NET Core, EF Core, JWT Auth, Swagger, SQL Server, SignalR, Paymob (mocked), optional Azure.
- Describes features: user management, appointments, profiles, chat, payments, GDPR.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    Browser["User Browser"]:::presentation
    Browser -->|"Interacts with"| Frontend["React SPA"]:::presentation
    subgraph "Frontend" 
        direction TB
        Frontend
        MedLLamaChat["MedLLamaChat Component"]:::presentation
        PhoneVerification["PhoneVerification Component"]:::presentation
        Swagger["Swagger UI / API Testing"]:::presentation
    end
    Frontend -->|"HTTP/HTTPS"| AccountController
    Frontend --> SignalRClient["WebSocket (SignalR)"]:::presentation
    Frontend --> Swagger

    %% Backend Layer
    subgraph "Backend API" 
        direction TB
        subgraph "Controllers" 
            direction TB
            AccountController["AccountController"]:::presentation
            AuthController["AuthController"]:::presentation
            AppointmentController["AppointmentController"]:::presentation
            ChatController["ChatController"]:::presentation
            AdvancedChatBotController["AdvancedChatBotController"]:::presentation
            ChatBotController["ChatBotController"]:::presentation
            MedLLamaController["MedLLamaController"]:::presentation
        end
        SignalRClient --> ChatHub["ChatHub"]:::application
        SignalRClient --> NotificationHub["NotificationHub"]:::application

        subgraph "Services" 
            direction TB
            ChatService["ChatService"]:::application
            CombinedChatService["CombinedChatService"]:::application
            MedLLamaService["MedLLamaService"]:::infrastructure
            OpenAIService["OpenAIService"]:::infrastructure
            EmailService["EmailService"]:::application
            SmsService["SmsService"]:::application
            PaymobService["PaymobService"]:::application
        end

        subgraph "Repositories" 
            direction TB
            DoctorRepository["DoctorRepository"]:::infrastructure
        end

        subgraph "Infrastructure" 
            direction TB
            AppDbContext["AppDbContext & Entities"]:::infrastructure
            Migrations["Migrations"]:::infrastructure
            PythonMicroservice["Python Chatbot Microservice"]:::infrastructure
            ChatbotApp["Flask app.py"]:::infrastructure
            MedllamaModule["medllama modules"]:::infrastructure
        end
    end

    %% Data Flows
    AccountController -->|Uses| ChatService
    AuthController -->|Uses| ChatService
    AppointmentController -->|Uses| EmailService
    AppointmentController -->|Uses| SmsService
    AppointmentController -->|Uses| PaymobService
    ChatController -->|Routes to| ChatService
    AdvancedChatBotController -->|Calls| MedLLamaService
    ChatBotController -->|Calls| MedLLamaService
    MedLLamaController -->|Proxies to| PythonMicroservice
    ChatService -->|Stores/Retrieves| DoctorRepository
    DoctorRepository -->|Via EF Core| AppDbContext
    AppDbContext -->|Migrates| Migrations
    MedLLamaService -->|HTTP→| ChatbotApp
    ChatbotApp -->|Invokes| MedllamaModule

    %% External Integrations
    EmailService -->|SMTP| EmailProvider["Email Provider"]:::external
    SmsService -->|SMS API| SMSProvider["SMS Provider"]:::external
    PaymobService -->|Webhook| PaymobGateway["Paymob Gateway (Mock)"]:::external

    %% Click Events
    click Frontend "https://github.com/yousefmm09/doctorappointmentapi/tree/master/DoctorAppoitmentApi/frontend/src/components"
    click MedLLamaChat "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/frontend/src/components/MedLLamaChat.jsx"
    click PhoneVerification "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/frontend/src/components/PhoneVerification.jsx"
    click AccountController "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/Controllers/AccountController.cs"
    click AuthController "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/Controllers/AuthController.cs"
    click AppointmentController "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/Controllers/AppointmentController.cs"
    click ChatController "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/Controllers/ChatController.cs"
    click AdvancedChatBotController "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/Controllers/AdvancedChatBotController.cs"
    click ChatBotController "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/Controllers/ChatBotController.cs"
    click MedLLamaController "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/Controllers/MedLLamaController.cs"
    click ChatHub "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/ChatHub.cs"
    click NotificationHub "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/NotificationHub.cs"
    click ChatService "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/Service/ChatService.cs"
    click CombinedChatService "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/Service/CombinedChatService.cs"
    click MedLLamaService "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/Service/MedLLamaService.cs"
    click OpenAIService "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/Service/OpenAIService.cs"
    click EmailService "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/Service/EmailService.cs"
    click SmsService "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/Service/SmsService.cs"
    click PaymobService "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/Service/PaymobService.cs"
    click DoctorRepository "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/Repository/DoctorRepository.cs"
    click AppDbContext "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/Models/AppDbContext.cs"
    click Migrations "https://github.com/yousefmm09/doctorappointmentapi/tree/master/DoctorAppoitmentApi/Migrations"
    click PythonMicroservice "https://github.com/yousefmm09/doctorappointmentapi/tree/master/DoctorAppoitmentApi/medllama"
    click ChatbotApp "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/DCA/Doctor-Appointment-Booking-System--main/Chatbot/app.py"
    click MedllamaModule "https://github.com/yousefmm09/doctorappointmentapi/tree/master/DoctorAppoitmentApi/DCA/Doctor-Appointment-Booking-System--main/Chatbot/medllama"
    click Swagger "https://github.com/yousefmm09/doctorappointmentapi/blob/master/DoctorAppoitmentApi/DoctorAppoitmentApi.http"

    %% Styles
    classDef presentation fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef application fill:#d4edda,stroke:#333,stroke-width:1px
    classDef infrastructure fill:#fff3cd,stroke:#333,stroke-width:1px
    classDef external fill:#f8d7da,stroke:#333,stroke-width:1px
```
