# eyesun23/matching-problem architecture

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

- Interactive diagram: https://gitdiagram.com/eyesun23/matching-problem
- Repository: https://github.com/eyesun23/matching-problem

## Overview

##### Project type and purpose
- This is a small, single‑script command‑line Python tool whose sole responsibility is to read two CSV files of preferences (one for girls, one for guys), compute a weighted matching, and write out a results CSV. It is not a multi‑tier web app or microservice but a linear data‑processing pipeline.

##### File structure
- Top level:
- MatchingProblem.py – contains all code (CSV I/O, data models, matching algorithm, output).
- Sheet6.csv, Sheet7.csv – input data for girls’ and guys’ preference weights.
- results.csv – the algorithm’s output.
- README.md – describes the overall purpose.
- No subdirectories or separate modules, so the internal architecture lives inside one file.

##### README for additional insights
- The README clarifies that each person ranks three preferences, assigns weights, and the match is computed based on those weights.
- No mention of external services or databases—everything is file‑based.

a. Input Layer (CSV Sources)
– “Girls Preferences” (Sheet6.csv)
– “Guys Preferences” (Sheet7.csv)
b. Parser / Data Loader
– Reads CSVs, validates rows, normalizes weights into in‑memory data structures (e.g., Python dicts or objects)
c. Matching Engine
– Core algorithm: iterates over preferences, computes weighted scores, picks best mutual matches
d. Results Writer
– Serializes matched pairs into results.csv
e. (Optional) Logging/Configuration

##### Architectural pattern and design principles
- Streaming pipeline (Input → Transform → Compute → Output).
- Single responsibility per component: one for I/O, one for core logic.
- Keep business logic (matching algorithm) decoupled from file format concerns (CSV parsing/serialization).

##### Relevant technologies & libraries
- Python interpreter (e.g., CPython)
- Built‑in csv module or pandas (if used)
- Standard logging (optional)
- argparse or click (optional CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Input CSV files
    Sheet6[(Girls Preferences\nSheet6.csv)]:::io
    Sheet7[(Guys Preferences\nSheet7.csv)]:::io

    %% Parser / Data Loader
    Parser["Parser / Data Loader"]:::io

    %% Matching Engine
    MatchingEngine["Matching Engine"]:::processing

    %% Results Writer
    Writer["Results Writer"]:::io

    %% Output CSV
    Results[(Match Results\nresults.csv)]:::io

    %% Documentation
    README["README.md"]:::doc

    %% Data Flow
    Sheet6 -->|reads| Parser
    Sheet7 -->|reads| Parser
    Parser -->|provides data| MatchingEngine
    MatchingEngine -->|sends matches| Writer
    Writer -->|writes| Results

    %% Documentation link
    README -.->|describes tool| Parser

    %% Legend
    subgraph Legend
        IOComp["I/O Components"]:::io
        ProcComp["Processing Component"]:::processing
        DocComp["Documentation"]:::doc
    end

    %% Click Events
    click Sheet6 "https://github.com/eyesun23/matching-problem/blob/master/Sheet6.csv"
    click Sheet7 "https://github.com/eyesun23/matching-problem/blob/master/Sheet7.csv"
    click Parser "https://github.com/eyesun23/matching-problem/blob/master/MatchingProblem.py"
    click MatchingEngine "https://github.com/eyesun23/matching-problem/blob/master/MatchingProblem.py"
    click Writer "https://github.com/eyesun23/matching-problem/blob/master/MatchingProblem.py"
    click Results "https://github.com/eyesun23/matching-problem/blob/master/results.csv"
    click README "https://github.com/eyesun23/matching-problem/blob/master/README.md"

    %% Styles
    classDef io fill:#D6EAF8,stroke:#1B4F72,stroke-width:1px;
    classDef processing fill:#D5F5E3,stroke:#196F3D,stroke-width:1px;
    classDef doc fill:#FCF3CF,stroke:#B7950B,stroke-width:1px;
```
