# andrewkimutai/skin-care-connect architecture

> Architecture diagram of the GitHub repository andrewkimutai/skin-care-connect, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/andrewkimutai/skin-care-connect
- Repository: https://github.com/andrewkimutai/skin-care-connect

## Overview

1. **Purpose and scope**
   - This repository implements a **skin disease image classification system** for the **HAM10000** dermoscopy dataset.
   - The core output is a **7-class prediction model** packaged for interactive use in a small application.

2. **Main runtime boundary**
   - The production-facing part appears to be the **Streamlit app** in `app/streamlit_app.py`.
   - It likely serves as the user interface for uploading/choosing an image, invoking inference, and displaying the predicted disease class.

3. **Inference subsystem**
   - `app/ai_model.py` is the inference layer that wraps model loading and prediction logic.
   - It likely consumes image data from the Streamlit UI and returns class probabilities or a predicted label.
   - This layer is the boundary between the UI and the trained model artifact.

4. **Model artifacts**
   - The trained deep learning models are stored under `models/`:
     - `skin_disease_model.h5`
     - `skin_disease_model_best.h5`
   - These `.h5` files strongly suggest a **Keras/TensorFlow** model format.
   - The “best” variant is probably the checkpoint selected for deployment or evaluation.

5. **Training subsystem**
   - `models/model_training.py` is the training pipeline.
   - It likely loads preprocessed HAM10000 data, trains the classifier, and writes model artifacts to `models/`.
   - `models/model_evaluation.py` evaluates the trained model and produces metrics/reports.

6. **Data preprocessing boundary**
   - The `preprocessing/` package is responsible for preparing raw dataset inputs before training.
   - `preprocessing/organize_ham10000.py` likely restructures the HAM10000 dataset into the expected folder/layout or metadata format.
   - `preprocessing/data_preprocessing.py` likely handles normalization, resizing, class balancing, label encoding, or train/validation splitting.
   - This preprocessing stage sits between the raw dataset and model training.

7. **Persistence layer**
   - `app/database.py` plus the presence of `app.db` and a root-level `app.db` indicate the project uses **SQLite** for local persistence.
   - The database is probably used to store application-side records such as predictions, user activity, or metadata rather than model state.
   - This is a separate boundary from the ML model itself.

8. **Data flow from dataset to prediction**
   - Raw HAM10000 data enters the preprocessing layer.
   - Preprocessed data feeds model training/evaluation.
   - Training produces `.h5` model files.
   - The Streamlit app loads a saved model through `ai_model.py`.
   - User-provided dermoscopic images are passed through inference and displayed back to the user, with optional persistence in SQLite.

9. **External dependencies and infrastructure**
   - The project is Python-based and includes `requirements.txt` plus `.python-version`, so the environment is managed explicitly.
   - The deep learning stack is likely centered on **TensorFlow/Keras**; the UI layer uses **Streamlit**.
   - The system appears fully local/self-contained, with no obvious cloud services or external APIs in the repository.

10. **Documentation and deliverables**
   - The `documentation/` folder contains project reports, presentation materials, and a classification report.
   - These files support the model-development lifecycle and indicate the repository includes both code and project artifacts for academic/reporting purposes.

11. **Testing / validation**
   - The `test/` directory exists, but no files are visible in the tree.
   - Architecturally, this suggests a place for unit/integration tests around preprocessing, model loading, or inference, even if coverage is minimal or not shown.

12. **Suggested architectural diagram framing**
   - Draw three main layers: **data preparation**, **model training/evaluation**, and **application/inference**.
   - Add **SQLite persistence** as a side component connected to the app layer.
   - Treat the `.h5` files as the deployable model artifact bridging training and inference.

Main entry points: [`app/streamlit_app.py`](https://github.com/andrewkimutai/skin-care-connect/blob/main/app/streamlit_app.py) (Streamlit App), [`app/ai_model.py`](https://github.com/andrewkimutai/skin-care-connect/blob/main/app/ai_model.py) (AI Model), [`preprocessing/data_preprocessing.py`](https://github.com/andrewkimutai/skin-care-connect/blob/main/preprocessing/data_preprocessing.py) (Prep Pipeline), [`models/model_training.py`](https://github.com/andrewkimutai/skin-care-connect/blob/main/models/model_training.py) (Train Model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g_preprocessing["Preprocessing"]
  node_n_raw_data[("HAM10000<br/>dataset")]
  node_n_organize["Organize Data<br/>preprocess script"]
  node_n_preprocess["Prep Pipeline<br/>preprocess pipeline"]
end

subgraph group_g_models["Modeling"]
  node_n_train["Train Model<br/>training pipeline<br/>[model_training.py]"]
  node_n_eval["Evaluate Model<br/>evaluation pipeline"]
  node_n_model_best[("Best Model<br/>keras artifact")]
  node_n_model_final[("Model File<br/>keras artifact")]
end

subgraph group_g_app["Application"]
  node_n_ui["Streamlit App<br/>ui runtime<br/>[streamlit_app.py]"]
  node_n_infer["AI Model<br/>inference service<br/>[ai_model.py]"]
  node_n_db[("SQLite DB<br/>local persistence<br/>[app.db]")]
  node_n_db_access["DB Access<br/>database layer<br/>[database.py]"]
end

subgraph group_g_docs["Documentation"]
  node_n_readme["README<br/>project docs<br/>[README.md]"]
  node_n_doc_readme["Docs README<br/>[README.md]"]
  node_n_report["Report"]
  node_n_presentation["Presentation<br/>slides<br/>[presentation.pptx]"]
  node_n_code_pdf["Code PDF<br/>project artifact<br/>[code.pdf]"]
end

node_n_raw_data -->|"organize"| node_n_organize
node_n_organize -->|"prepare"| node_n_preprocess
node_n_preprocess -->|"train"| node_n_train
node_n_preprocess -->|"validate"| node_n_eval
node_n_train -->|"save"| node_n_model_final
node_n_train -->|"checkpoint"| node_n_model_best
node_n_model_best -->|"load"| node_n_eval
node_n_model_best -->|"load"| node_n_infer
node_n_model_final -->|"load"| node_n_infer
node_n_ui -->|"predict"| node_n_infer
node_n_infer -->|"result"| node_n_ui
node_n_ui -->|"store"| node_n_db_access
node_n_db_access -->|"write"| node_n_db
node_n_db_access -->|"query"| node_n_ui
node_n_readme -.->|"document"| node_n_ui
node_n_doc_readme -.->|"organize"| node_n_report

click node_n_organize "https://github.com/andrewkimutai/skin-care-connect/blob/main/preprocessing/organize_ham10000.py"
click node_n_preprocess "https://github.com/andrewkimutai/skin-care-connect/blob/main/preprocessing/data_preprocessing.py"
click node_n_train "https://github.com/andrewkimutai/skin-care-connect/blob/main/models/model_training.py"
click node_n_eval "https://github.com/andrewkimutai/skin-care-connect/blob/main/models/model_evaluation.py"
click node_n_model_best "https://github.com/andrewkimutai/skin-care-connect/blob/main/models/skin_disease_model_best.h5"
click node_n_model_final "https://github.com/andrewkimutai/skin-care-connect/blob/main/models/skin_disease_model.h5"
click node_n_ui "https://github.com/andrewkimutai/skin-care-connect/blob/main/app/streamlit_app.py"
click node_n_infer "https://github.com/andrewkimutai/skin-care-connect/blob/main/app/ai_model.py"
click node_n_db "https://github.com/andrewkimutai/skin-care-connect/blob/main/app/app.db"
click node_n_db_access "https://github.com/andrewkimutai/skin-care-connect/blob/main/app/database.py"
click node_n_readme "https://github.com/andrewkimutai/skin-care-connect/blob/main/README.md"
click node_n_doc_readme "https://github.com/andrewkimutai/skin-care-connect/blob/main/documentation/README.md"
click node_n_report "https://github.com/andrewkimutai/skin-care-connect/blob/main/documentation/classification_report.txt"
click node_n_presentation "https://github.com/andrewkimutai/skin-care-connect/blob/main/documentation/presentation.pptx"
click node_n_code_pdf "https://github.com/andrewkimutai/skin-care-connect/blob/main/documentation/code.pdf"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_n_raw_data,node_n_organize,node_n_preprocess toneBlue
class node_n_train,node_n_eval,node_n_model_best,node_n_model_final toneAmber
class node_n_ui,node_n_infer,node_n_db,node_n_db_access toneMint
class node_n_readme,node_n_doc_readme,node_n_report,node_n_presentation,node_n_code_pdf toneRose
```

## Components

### Preprocessing

Dataset preparation and cleanup before model training.

- **HAM10000**: dataset · Source dermoscopy dataset used for classification.
- [Organize Data](https://github.com/andrewkimutai/skin-care-connect/blob/main/preprocessing/organize_ham10000.py): preprocess script · Restructures or prepares the HAM10000 dataset layout. · `preprocessing/organize_ham10000.py`
- [Prep Pipeline](https://github.com/andrewkimutai/skin-care-connect/blob/main/preprocessing/data_preprocessing.py): preprocess pipeline · Core data preprocessing for resizing, encoding, splitting, or balancing. · `preprocessing/data_preprocessing.py`

### Modeling

Training, evaluation, and saved model artifacts.

- [Train Model](https://github.com/andrewkimutai/skin-care-connect/blob/main/models/model_training.py): training pipeline · Trains the skin disease classifier and writes model artifacts. · `models/model_training.py`
- [Evaluate Model](https://github.com/andrewkimutai/skin-care-connect/blob/main/models/model_evaluation.py): evaluation pipeline · Measures model performance and produces evaluation output. · `models/model_evaluation.py`
- [Best Model](https://github.com/andrewkimutai/skin-care-connect/blob/main/models/skin_disease_model_best.h5): keras artifact · Deployment-oriented trained model artifact in HDF5 format. · `models/skin_disease_model_best.h5`
- [Model File](https://github.com/andrewkimutai/skin-care-connect/blob/main/models/skin_disease_model.h5): keras artifact · Saved trained classifier artifact in HDF5 format. · `models/skin_disease_model.h5`

### Application

Streamlit interface, inference, and local persistence.

- [Streamlit App](https://github.com/andrewkimutai/skin-care-connect/blob/main/app/streamlit_app.py): ui runtime · Interactive interface for uploading images and showing predictions. · `app/streamlit_app.py`
- [AI Model](https://github.com/andrewkimutai/skin-care-connect/blob/main/app/ai_model.py): inference service · Loads the trained model and returns predicted classes or probabilities. · `app/ai_model.py`
- [SQLite DB](https://github.com/andrewkimutai/skin-care-connect/blob/main/app/app.db): local persistence · Application-side SQLite storage for records or metadata. · `app/app.db`
- [DB Access](https://github.com/andrewkimutai/skin-care-connect/blob/main/app/database.py): database layer · Database helper layer used by the application. · `app/database.py`

### Documentation

Project reports and presentation materials.

- [README](https://github.com/andrewkimutai/skin-care-connect/blob/main/README.md): project docs · Top-level project overview and usage notes. · `README.md`
- [Docs README](https://github.com/andrewkimutai/skin-care-connect/blob/main/documentation/README.md): docs · Documentation index and supporting notes. · `documentation/README.md`
- [Report](https://github.com/andrewkimutai/skin-care-connect/blob/main/documentation/classification_report.txt): project report · Classification report and project deliverables. · `documentation/classification_report.txt`
- [Presentation](https://github.com/andrewkimutai/skin-care-connect/blob/main/documentation/presentation.pptx): slides · Project presentation deck. · `documentation/presentation.pptx`
- [Code PDF](https://github.com/andrewkimutai/skin-care-connect/blob/main/documentation/code.pdf): project artifact · Compiled code or project PDF deliverable. · `documentation/code.pdf`

## Connections

- HAM10000 → Organize Data: organize · Raw HAM10000 data is organized into a training-ready structure.
- Organize Data → Prep Pipeline: prepare · Organized dataset feeds preprocessing.
- Prep Pipeline → Train Model: train · Preprocessed data is used to train the classifier.
- Prep Pipeline → Evaluate Model: validate · Preprocessed data is also used for evaluation.
- Train Model → Model File: save · Training writes a deployable model artifact.
- Train Model → Best Model: checkpoint · Training may also produce the best-performing checkpoint.
- Best Model → Evaluate Model: load · Evaluation can consume the selected best model.
- Best Model → AI Model: load · Inference layer loads the saved model artifact.
- Model File → AI Model: load · Alternative saved model artifact available to inference.
- Streamlit App → AI Model: predict · Streamlit app sends user images to the inference layer.
- AI Model → Streamlit App: result · Predictions are returned to the UI for display.
- Streamlit App → DB Access: store · Application may persist prediction or user records.
- DB Access → SQLite DB: write · Database helper reads and writes the SQLite file.
- DB Access → Streamlit App: query · Stored records can be retrieved for the app interface.
- README → Streamlit App: document · Top-level README describes the main application flow.
- Docs README → Report: organize · Documentation folder groups project deliverables.
