# flyrank-bih/flyrank-ml-internship-starter architecture

> Architecture diagram of the GitHub repository flyrank-bih/flyrank-ml-internship-starter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/flyrank-bih/flyrank-ml-internship-starter
- Repository: https://github.com/flyrank-bih/flyrank-ml-internship-starter

## Overview

#### Purpose and Entry Points
FlyRank ML Internship is an educational, reproducible search-intelligence ML workspace. It teaches a controlled workflow for prioritizing pages for content refresh using anonymized search data—not prediction of Google’s ranking algorithm.

Primary execution paths:
- Local reference pipeline: `scripts/run_all.py`
- Guided introductory notebooks: `notebooks/01_first_look_and_discovery.ipynb`, `notebooks/02_your_first_readable_model.ipynb`
- Learner assignment/capstone workspace: `work/notebooks/`
- Google Colab is the primary zero-install interactive runtime.

#### Data Boundary and Contracts
The bundled input is a small anonymized CSV, `data/raw/content_refresh_anonymized.csv`; its field semantics and cautions are defined in `docs/data-dictionary.md`. The repository explicitly prohibits adding raw/private client data, governed by `DATA_USE.md`.

A separate scaled-data path uses the gated Hugging Face dataset `FlyRank/internship-warehouse`, queried through DuckDB in `notebooks/03_working_with_the_full_release.ipynb`. This is a material boundary: starter CSV runs locally, while the full release requires approved external access.

#### Reference ML Pipeline
`scripts/run_all.py` orchestrates five ordered stages against the sample data:
1. Feature preparation and label definition in `scripts/01_prepare_features.py`.
2. A transparent hand-built prioritization score in `scripts/02_baseline_score.py`.
3. Candidate learned models—logistic regression, decision tree, and random forest—with client holdout evaluation in `scripts/03_train_model.py`.
4. Ranking, metrics, charts, refresh queue, and Markdown reporting in `scripts/04_evaluate_and_export.py`.
5. PDF packaging in `scripts/05_build_pdf_report.py`.

Shared model/data utilities are centralized in `scripts/ml_utils.py`, keeping stage scripts focused on pipeline transitions.

#### Evaluation and Decision-Support Output
The pipeline compares the interpretable baseline against learned ranking quality, particularly Precision@50, then produces a ranked review queue rather than an autonomous action system. Outputs are materialized under `outputs/`, including `outputs/refresh_queue_sample.csv` and `outputs/model_report.md`; charts are placed in `outputs/charts/`.

This output boundary reinforces the intended use: measured, directional recommendations for review.

#### Learning and Capstone Control Flow
The instructional flow progresses from question framing through data contract, leakage checks, signal audit, baseline, modeling, validation, and action playbook. The persistent learner-owned artifacts are in `work/notebooks/`, ending with `work/notebooks/capstone.ipynb`.

Reference notebooks demonstrate the early stages, while `skills/` supplies reusable assistant-oriented process guidance such as `skills/framing-ml-problems/SKILL.md`, `skills/hunting-leakage-and-validating/SKILL.md`, and `skills/training-honest-models/SKILL.md`.

#### Runtime, Dependencies, and Automation
The main runtime is Python with dependencies pinned through `requirements.txt`; supported environments are local Python and Google Colab. The full-data notebook introduces DuckDB and Hugging Face-hosted data access.

GitHub Actions provide operational guardrails and smoke coverage through `.github/workflows/smoke-test.yml`, `.github/workflows/data-path-smoke.yml`, and `.github/workflows/personalize.yml`. Personalization automation rewires Colab notebook links in template-derived learner repositories; data-path automation supports the repo’s no-private-data enforcement model.

Main entry points: [`scripts/01_prepare_features.py`](https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/scripts/01_prepare_features.py) (Feature preparation), [`.github/workflows/smoke-test.yml`](https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/.github/workflows/smoke-test.yml) (GitHub Actions guardrails), [`scripts/04_evaluate_and_export.py`](https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/scripts/04_evaluate_and_export.py) (Ranking & export), [`data/raw/content_refresh_anonymized.csv`](https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/data/raw/content_refresh_anonymized.csv) (Anonymized starter CSV)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data boundaries"]
  node_sample_data[("Anonymized starter CSV<br/>local dataset")]
  node_data_dictionary["Data contract<br/>documentation<br/>[data-dictionary.md]"]
  node_data_policy["No-private-data policy<br/>governance<br/>[DATA_USE.md]"]
  node_full_data_notebook["Full release notebook<br/>interactive notebook"]
  node_hf_dataset[("Gated warehouse dataset<br/>external dataset")]
end

subgraph group_pipeline["Reference pipeline"]
  node_local_runner{{"Local pipeline runner<br/>Python orchestrator<br/>[run_all.py]"}}
  node_prepare["Feature preparation<br/>pipeline stage"]
  node_baseline["Transparent baseline<br/>pipeline stage"]
  node_train["Candidate model training<br/>pipeline stage<br/>[03_train_model.py]"]
  node_evaluate["Ranking &amp; export<br/>pipeline stage"]
  node_pdf["PDF report packaging<br/>pipeline stage"]
  node_ml_utils["Shared ML utilities<br/>Python utilities<br/>[ml_utils.py]"]
  node_decision_outputs["Review outputs<br/>decision-support artifacts"]
end

subgraph group_learning["Learning workspace"]
  node_intro_notebooks["Intro notebooks<br/>guided notebooks"]
  node_learner_workspace["Learner workspace<br/>capstone notebooks"]
  node_skills["Process guidance<br/>assistant skills"]
end

subgraph group_operations["Runtime &amp; automation"]
  node_runtime["Python &amp; Colab runtime<br/>execution environment<br/>[requirements.txt]"]
  node_automation["GitHub Actions guardrails<br/>CI automation<br/>[smoke-test.yml]"]
end

node_local_runner -->|"runs first"| node_prepare
node_prepare -->|"prepared features"| node_baseline
node_baseline -->|"baseline comparison"| node_train
node_train -->|"model results"| node_evaluate
node_evaluate -->|"Markdown report"| node_pdf
node_sample_data -->|"local input"| node_prepare
node_data_dictionary -.->|"defines fields"| node_sample_data
node_data_policy -.->|"governs use"| node_sample_data
node_ml_utils -.->|"shared helpers"| node_prepare
node_ml_utils -.->|"shared helpers"| node_train
node_evaluate -->|"queue, metrics, charts"| node_decision_outputs
node_pdf -->|"packaged report"| node_decision_outputs
node_full_data_notebook -->|"DuckDB query"| node_hf_dataset
node_intro_notebooks -->|"progresses into"| node_learner_workspace
node_skills -.->|"guides work"| node_learner_workspace
node_runtime -.->|"executes"| node_local_runner
node_runtime -.->|"interactive runtime"| node_intro_notebooks
node_automation -.->|"smoke coverage"| node_local_runner
node_automation -.->|"enforces data path"| node_data_policy
node_automation -.->|"personalizes Colab links"| node_intro_notebooks

click node_local_runner "https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/scripts/run_all.py"
click node_prepare "https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/scripts/01_prepare_features.py"
click node_baseline "https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/scripts/02_baseline_score.py"
click node_train "https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/scripts/03_train_model.py"
click node_evaluate "https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/scripts/04_evaluate_and_export.py"
click node_pdf "https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/scripts/05_build_pdf_report.py"
click node_ml_utils "https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/scripts/ml_utils.py"
click node_sample_data "https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/data/raw/content_refresh_anonymized.csv"
click node_data_dictionary "https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/docs/data-dictionary.md"
click node_data_policy "https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/DATA_USE.md"
click node_full_data_notebook "https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/notebooks/03_working_with_the_full_release.ipynb"
click node_intro_notebooks "https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/notebooks/01_first_look_and_discovery.ipynb"
click node_runtime "https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/requirements.txt"
click node_automation "https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/.github/workflows/smoke-test.yml"

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_sample_data,node_data_dictionary,node_data_policy,node_full_data_notebook,node_hf_dataset toneBlue
class node_local_runner,node_prepare,node_baseline,node_train,node_evaluate,node_pdf,node_ml_utils,node_decision_outputs toneAmber
class node_intro_notebooks,node_learner_workspace,node_skills toneMint
class node_runtime,node_automation toneRose
```

## Components

### Data boundaries

- [Anonymized starter CSV](https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/data/raw/content_refresh_anonymized.csv): local dataset · Small bundled input for reproducible local runs. · `data/raw/content_refresh_anonymized.csv`
- [Data contract](https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/docs/data-dictionary.md): documentation · Defines field semantics and cautions. · `docs/data-dictionary.md`
- [No-private-data policy](https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/DATA_USE.md): governance · Prohibits raw or private client data. · `DATA_USE.md`
- [Full release notebook](https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/notebooks/03_working_with_the_full_release.ipynb): interactive notebook · Queries approved scaled data through DuckDB. · `notebooks/03_working_with_the_full_release.ipynb`
- **Gated warehouse dataset**: external dataset · Hugging Face release requiring approved access.

### Reference pipeline

- [Local pipeline runner](https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/scripts/run_all.py): Python orchestrator · Runs the five ordered reference stages. · `scripts/run_all.py`
- [Feature preparation](https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/scripts/01_prepare_features.py): pipeline stage · Defines features and labels from sample data. · `scripts/01_prepare_features.py`
- [Transparent baseline](https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/scripts/02_baseline_score.py): pipeline stage · Builds a hand-crafted prioritization score. · `scripts/02_baseline_score.py`
- [Candidate model training](https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/scripts/03_train_model.py): pipeline stage · Evaluates logistic regression, tree, and forest with client holdout. · `scripts/03_train_model.py`
- [Ranking & export](https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/scripts/04_evaluate_and_export.py): pipeline stage · Compares ranking quality and creates review artifacts. · `scripts/04_evaluate_and_export.py`
- [PDF report packaging](https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/scripts/05_build_pdf_report.py): pipeline stage · `scripts/05_build_pdf_report.py`
- [Shared ML utilities](https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/scripts/ml_utils.py): Python utilities · Shared data and model helpers for pipeline stages. · `scripts/ml_utils.py`
- **Review outputs**: decision-support artifacts · Ranked review queue, report, and charts—not autonomous actions.

### Learning workspace

- [Intro notebooks](https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/notebooks/01_first_look_and_discovery.ipynb): guided notebooks · Teach discovery and a first readable model. · `notebooks/01_first_look_and_discovery.ipynb`
- **Learner workspace**: capstone notebooks · Persistent learner-owned work ending in the capstone.
- **Process guidance**: assistant skills · Reusable framing, leakage-validation, and honest-model guidance.

### Runtime & automation

- [Python & Colab runtime](https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/requirements.txt): execution environment · Local Python and Google Colab are supported. · `requirements.txt`
- [GitHub Actions guardrails](https://github.com/flyrank-bih/flyrank-ml-internship-starter/blob/main/.github/workflows/smoke-test.yml): CI automation · Smoke tests, data-path checks, and Colab-link personalization. · `.github/workflows/smoke-test.yml`

## Connections

- Local pipeline runner → Feature preparation: runs first
- Feature preparation → Transparent baseline: prepared features
- Transparent baseline → Candidate model training: baseline comparison
- Candidate model training → Ranking & export: model results
- Ranking & export → PDF report packaging: Markdown report
- Anonymized starter CSV → Feature preparation: local input
- Data contract → Anonymized starter CSV: defines fields
- No-private-data policy → Anonymized starter CSV: governs use
- Shared ML utilities → Feature preparation: shared helpers
- Shared ML utilities → Candidate model training: shared helpers
- Ranking & export → Review outputs: queue, metrics, charts
- PDF report packaging → Review outputs: packaged report
- Full release notebook → Gated warehouse dataset: DuckDB query
- Intro notebooks → Learner workspace: progresses into
- Process guidance → Learner workspace: guides work
- Python & Colab runtime → Local pipeline runner: executes
- Python & Colab runtime → Intro notebooks: interactive runtime
- GitHub Actions guardrails → Local pipeline runner: smoke coverage
- GitHub Actions guardrails → No-private-data policy: enforces data path
- GitHub Actions guardrails → Intro notebooks: personalizes Colab links
