# andriirwanzahri/fuzzy-c-means architecture

> Architecture diagram of the GitHub repository andriirwanzahri/fuzzy-c-means, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/andriirwanzahri/fuzzy-c-means
- Repository: https://github.com/andriirwanzahri/fuzzy-c-means

## Overview

##### Main Components
- Frontend/UI Layer:
- Pages such as index.php, home.php, homeuser.php, login.php, registrasi.php, and various data display and management pages (e.g., datadiri.php, datamasyarakat.php, info.php).
- Assets like CSS (css/ folder and SCSS files for styling), JavaScript (js/ folder including demo charts and index.js), and images (img/ directory).
- Reusable templates/components like header.php, headerAdmin.php, footer.php.

- Backend/Business Logic Layer:
- PHP scripts implementing core functionalities such as cetaklaporan.php (printed reports), codesimpan.php (data saving), perhitungan.php (likely carrying out the Fuzzy C Means computation).
- The fuzyycmeans.php file indicates that the Fuzzy C Means algorithm is directly implemented here.
- Other PHP files that manage specific features (kelolaakun.php, subkriteria.php, uploadmasyarakat.php).

- Data Access/Database Layer:
- k_means.sql script suggesting schema definitions or seed data.
- koneksi.php file for database connection.

- External Libraries & Vendor Code:
- There is a vendor/ directory which might encapsulate third-party libraries or packages.
- The excel_reader folder indicates that the application can import data from Excel files.

- Data Files:
- The pages directory contains several Excel datasets (e.g., dataset.xls, dataset Baru.xls) used in the classification process.

##### Relationships and Interactions
- The user interacts with the frontend pages (login, registration, viewing reports) that are styled with CSS/SCSS and enhanced with JavaScript.
- The frontend makes requests (via forms or API-like calls) to the PHP backend for processing user inputs, triggering the Fuzzy C Means calculations, saving data, and fetching results.
- The backend connects to a database (using koneksi.php) to read/write data (user data, inputs for clustering, results) and executes the Fuzzy C Means algorithm (fuzyycmeans.php and possibly perhitungan.php).
- There are additional integration points, such as the Excel reader, which imports data that can be processed further by the application.

##### Architectural Patterns and Design Principles
- MVC (or at least a separation of concerns) is loosely followed through clear separation of view elements (PHP pages with header/footer templates), business logic (PHP files for algorithms like Fuzzy C Means and data manipulation), and data access (koneksi.php, SQL script).
- Modular design: Each feature (e.g., user management, data import, classification, report generation) is in its own file.
- Reusability: Shared UI components (headers, footers) and style sheets suggest reuse and consistency in design.

##### Relevant Technologies and Frameworks
- PHP as the server-side programming language.
- HTML/CSS/JavaScript for the frontend; SCSS files indicate that a preprocessor is in use for styling.
- External libraries: The use of a vendor/ folder and Excel reader implies that third-party libraries are integrated.
- Possibly Bootstrap or a similar framework (indicated by file names such as sb-admin-2.css and sb-admin-2.scss), providing a responsive admin dashboard.

## Diagram (Mermaid)

```mermaid
flowchart TD
    U("User"):::userStyle

    subgraph "Frontend/UI Layer"
        A("Index Page (index.php)"):::frontend
        B("Home Page (home.php)"):::frontend
        C("User Home (homeuser.php)"):::frontend
        D("Login (login.php)"):::frontend
        E("Registrasi (registrasi.php)"):::frontend
        F("Data Diri (datadiri.php)"):::frontend
        G("Data Masyarakat (datamasyarakat.php)"):::frontend
        H("Info Page (info.php)"):::frontend
        I("Header (header.php)"):::frontend
        J("Admin Header (headerAdmin.php)"):::frontend
        K("Footer (footer.php)"):::frontend
        L("Assets (CSS,SCSS,JS,Images)"):::frontend
    end

    subgraph "Backend/Business Logic Layer"
        M("Fuzzy C Means Engine (fuzyycmeans.php,perhitungan.php)"):::backend
        N("Reporting & Data Handling (codesimpan.php,cetaklaporan.php,kelolaakun.php,subkriteria.php,uploadmasyarakat.php,hasilklasifikasi.php,hasilklasifikasiuser.php)"):::backend
    end

    subgraph "Data Access/Database Layer"
        O(["Database (koneksi.php,k_means.sql)"]):::database
    end

    subgraph "External & Third-Party"
        P("Excel Import Module (excel_reader/excel_reader2.php)"):::external
        Q("Vendor Packages (vendor/)"):::external
    end

    subgraph "Data Files"
        R("Datasets (pages/dataset 10.xls,pages/dataset 100.xls,pages/dataset Baru.xls,pages/dataset.xls,pages/datavtes.xls)"):::dataFiles
    end

    U -->|"requests"| A
    U -->|"login/register"| D
    U -->|"register"| E

    A -->|"loads"| M
    A -->|"loads"| N
    D -->|"authenticates"| N
    F -->|"submits"| N
    G -->|"views"| N
    H -->|"inquires"| N

    M -->|"queries/stores"| O
    N -->|"queries/stores"| O

    R -->|"imports"| P
    P -->|"ingests"| O

    Q -->|"supports"| M
    Q -->|"supports"| N

    class U userStyle
    class A,B,C,D,E,F,G,H,I,J,K,L frontend
    class M,N backend
    class O database
    class P,Q external
    class R dataFiles

    classDef userStyle fill:#A0D468,stroke:#333,stroke-width:2px
    classDef frontend fill:#FADDDC,stroke:#333,stroke-width:2px
    classDef backend fill:#F9E79F,stroke:#333,stroke-width:2px
    classDef database fill:#D5F5E3,stroke:#333,stroke-width:2px
    classDef external fill:#D6EAF8,stroke:#333,stroke-width:2px
    classDef dataFiles fill:#F5CBA7,stroke:#333,stroke-width:2px

    click A "https://github.com/andriirwanzahri/fuzzy-c-means/blob/main/index.php"
    click B "https://github.com/andriirwanzahri/fuzzy-c-means/blob/main/home.php"
    click C "https://github.com/andriirwanzahri/fuzzy-c-means/blob/main/homeuser.php"
    click D "https://github.com/andriirwanzahri/fuzzy-c-means/blob/main/login.php"
    click E "https://github.com/andriirwanzahri/fuzzy-c-means/blob/main/registrasi.php"
    click F "https://github.com/andriirwanzahri/fuzzy-c-means/blob/main/datadiri.php"
    click G "https://github.com/andriirwanzahri/fuzzy-c-means/blob/main/datamasyarakat.php"
    click H "https://github.com/andriirwanzahri/fuzzy-c-means/blob/main/info.php"
    click I "https://github.com/andriirwanzahri/fuzzy-c-means/blob/main/header.php"
    click J "https://github.com/andriirwanzahri/fuzzy-c-means/blob/main/headerAdmin.php"
    click K "https://github.com/andriirwanzahri/fuzzy-c-means/blob/main/footer.php"
    click L "https://github.com/andriirwanzahri/fuzzy-c-means/blob/main/css/sb-admin-2.css"
    click M "https://github.com/andriirwanzahri/fuzzy-c-means/blob/main/fuzyycmeans.php"
    click N "https://github.com/andriirwanzahri/fuzzy-c-means/blob/main/codesimpan.php"
    click O "https://github.com/andriirwanzahri/fuzzy-c-means/blob/main/koneksi.php"
    click P "https://github.com/andriirwanzahri/fuzzy-c-means/blob/main/excel_reader/excel_reader2.php"
    click Q "https://github.com/andriirwanzahri/fuzzy-c-means/tree/main/vendor/"
    click R "https://github.com/andriirwanzahri/fuzzy-c-means/blob/main/pages/dataset.xls"
```
