# saif-ullah0/flyrank-ml-internship architecture

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

- Interactive diagram: https://gitdiagram.com/saif-ullah0/flyrank-ml-internship
- Repository: https://github.com/saif-ullah0/flyrank-ml-internship

## Overview

#### Purpose and Entry Points
FlyRank ML Internship is an educational, reproducible search-intelligence workflow built around anonymized content-refresh data. It supports two execution modes: local Python pipeline via `scripts/run_all.py`, and Google Colab notebooks for guided learning and assignment submissions. The bundled sample is `data/raw/content_refresh_anonymized.csv`; the full gated dataset is hosted externally on Hugging Face.

#### Reference ML Pipeline Orchestration
`scripts/run_all.py` is the main batch entry point and runs the ordered reference workflow. It coordinates feature preparation, baseline scoring, model training, evaluation/export, and PDF generation. Pipeline stages are separately executable, creating a clear boundary between reusable reference implementation and student work.
- `scripts/run_all.py`
- `scripts/01_prepare_features.py`
- `scripts/04_evaluate_and_export.py`

#### Feature and Label Construction
The pipeline first cleans the anonymized page-level data, builds model features, and defines the prediction label. This is the principal input contract: downstream baseline and learned models depend on its prepared feature vector rather than raw CSV fields. Column meanings and constraints are documented separately.
- `scripts/01_prepare_features.py`
- `data/raw/content_refresh_anonymized.csv`
- `docs/data-dictionary.md`

#### Baseline-versus-Learned Decisioning
A transparent hand-authored “fix this first” baseline provides an interpretable benchmark. Learned candidates—logistic regression, decision tree, and random forest—are trained with a client-holdout split, establishing a generalization boundary rather than evaluating on mixed client data. Shared modeling logic resides in the utility module.
- `scripts/02_baseline_score.py`
- `scripts/03_train_model.py`
- `scripts/ml_utils.py`

#### Evaluation and Action Outputs
Evaluation converts scores into operational decision-support artifacts: a ranked refresh queue, charts, and a Markdown model report. The final stage renders a shareable PDF summary. Outputs are recommendations for review prioritization, not claims to predict Google’s ranking algorithm.
- `scripts/04_evaluate_and_export.py`
- `scripts/05_build_pdf_report.py`
- `outputs/model_report.md`

#### Guided Learning and Student Workspace
Starter notebooks introduce discovery and readable models; `work/notebooks/` is the durable student-owned progression from research question through validation, action playbook, and capstone. This separates the maintained reference pipeline from learner experiments and portfolio submissions.
- `notebooks/01_first_look_and_discovery.ipynb`
- `work/notebooks/w05_model.ipynb`
- `work/notebooks/capstone.ipynb`

#### Runtimes, External Services, and Governance
The runtime is Python with dependencies declared in `requirements.txt`, runnable locally or in Google Colab. Colab is the primary hosted notebook environment; GitHub templates/forks serve as each learner’s submission repository. Full-scale data is accessed through the gated Hugging Face `FlyRank/internship-warehouse` dataset. Data governance prohibits private client-data ingestion and is enforced through repository policy and CI smoke/data-path workflows.
- `requirements.txt`
- `DATA_USE.md`
- `.github/workflows/data-path-smoke.yml`

Main entry points: [`scripts/run_all.py`](https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/scripts/run_all.py) (Batch runner), [`scripts/01_prepare_features.py`](https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/scripts/01_prepare_features.py) (Feature preparation), [`scripts/04_evaluate_and_export.py`](https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/scripts/04_evaluate_and_export.py) (Evaluation and export), [`scripts/03_train_model.py`](https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/scripts/03_train_model.py) (Model training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pipeline["Reference Pipeline"]
  node_runner["Batch runner<br/>Python entry point<br/>[run_all.py]"]
  node_raw_data[("Anonymized sample<br/>CSV dataset")]
  node_prepare["Feature preparation<br/>pipeline stage"]
  node_dictionary["Data dictionary<br/>documentation<br/>[data-dictionary.md]"]
  node_baseline["Fix-first baseline<br/>pipeline stage"]
  node_train["Model training<br/>pipeline stage<br/>[03_train_model.py]"]
  node_ml_utils["Model utilities<br/>shared module<br/>[ml_utils.py]"]
  node_evaluate["Evaluation and export<br/>pipeline stage"]
  node_model_report["Model report<br/>Markdown artifact<br/>[model_report.md]"]
  node_pdf_builder["PDF report builder<br/>pipeline stage"]
  node_pdf_summary["PDF summary<br/>report artifact"]
end

subgraph group_learning["Learning Workspace"]
  node_starter_notebook["Discovery notebook<br/>starter notebook"]
  node_model_notebook["Student model notebook<br/>student notebook<br/>[w05_model.ipynb]"]
  node_capstone["Student capstone<br/>student notebook<br/>[capstone.ipynb]"]
  node_colab{{"Google Colab<br/>hosted runtime"}}
  node_github{{"GitHub forks and templates<br/>submission repository"}}
end

subgraph group_governance["Data Governance"]
  node_full_data[("Gated full dataset<br/>external dataset")]
  node_data_policy["Data-use policy<br/>governance policy<br/>[DATA_USE.md]"]
  node_data_smoke["Data-path CI smoke<br/>CI workflow"]
end

node_python{{"Python environment<br/>runtime dependencies<br/>[requirements.txt]"}}

node_runner -->|"runs"| node_prepare
node_runner -->|"runs"| node_baseline
node_runner -->|"runs"| node_train
node_runner -->|"runs"| node_evaluate
node_runner -->|"runs"| node_pdf_builder
node_raw_data -->|"input"| node_prepare
node_dictionary -.->|"defines fields"| node_prepare
node_prepare -->|"prepared features"| node_baseline
node_prepare -->|"features and label"| node_train
node_ml_utils -->|"shared logic"| node_train
node_baseline -->|"benchmark scores"| node_evaluate
node_train -->|"holdout predictions"| node_evaluate
node_ml_utils -.->|"shared evaluation"| node_evaluate
node_evaluate -->|"exports"| node_model_report
node_model_report -->|"source report"| node_pdf_builder
node_pdf_builder -->|"renders"| node_pdf_summary
node_python -->|"runs"| node_runner
node_colab -->|"hosts"| node_starter_notebook
node_colab -->|"hosts"| node_model_notebook
node_model_notebook -.->|"progresses to"| node_capstone
node_capstone -->|"submitted through"| node_github
node_full_data -.->|"full-scale alternative"| node_raw_data
node_data_policy -->|"governs access"| node_full_data
node_data_smoke -->|"enforces"| node_data_policy

click node_runner "https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/scripts/run_all.py"
click node_raw_data "https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/data/raw/content_refresh_anonymized.csv"
click node_prepare "https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/scripts/01_prepare_features.py"
click node_dictionary "https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/docs/data-dictionary.md"
click node_baseline "https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/scripts/02_baseline_score.py"
click node_train "https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/scripts/03_train_model.py"
click node_ml_utils "https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/scripts/ml_utils.py"
click node_evaluate "https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/scripts/04_evaluate_and_export.py"
click node_model_report "https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/outputs/model_report.md"
click node_pdf_builder "https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/scripts/05_build_pdf_report.py"
click node_starter_notebook "https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/notebooks/01_first_look_and_discovery.ipynb"
click node_model_notebook "https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/work/notebooks/w05_model.ipynb"
click node_capstone "https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/work/notebooks/capstone.ipynb"
click node_python "https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/requirements.txt"
click node_data_policy "https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/DATA_USE.md"
click node_data_smoke "https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/.github/workflows/data-path-smoke.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_runner,node_raw_data,node_prepare,node_dictionary,node_baseline,node_train,node_ml_utils,node_evaluate,node_model_report,node_pdf_builder,node_pdf_summary toneBlue
class node_starter_notebook,node_model_notebook,node_capstone,node_colab,node_github toneAmber
class node_full_data,node_data_policy,node_data_smoke toneMint
class node_python toneNeutral
```

## Components

### Reference Pipeline

Reproducible batch workflow.

- [Batch runner](https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/scripts/run_all.py): Python entry point · Orchestrates the ordered reference workflow. · `scripts/run_all.py`
- [Anonymized sample](https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/data/raw/content_refresh_anonymized.csv): CSV dataset · `data/raw/content_refresh_anonymized.csv`
- [Feature preparation](https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/scripts/01_prepare_features.py): pipeline stage · Cleans records, constructs features, and defines the label. · `scripts/01_prepare_features.py`
- [Data dictionary](https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/docs/data-dictionary.md): documentation · Defines source columns and constraints. · `docs/data-dictionary.md`
- [Fix-first baseline](https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/scripts/02_baseline_score.py): pipeline stage · Transparent benchmark scoring. · `scripts/02_baseline_score.py`
- [Model training](https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/scripts/03_train_model.py): pipeline stage · Trains learned candidates with client holdout. · `scripts/03_train_model.py`
- [Model utilities](https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/scripts/ml_utils.py): shared module · Shared split and modeling logic. · `scripts/ml_utils.py`
- [Evaluation and export](https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/scripts/04_evaluate_and_export.py): pipeline stage · Produces ranked decisions, charts, and report. · `scripts/04_evaluate_and_export.py`
- [Model report](https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/outputs/model_report.md): Markdown artifact · `outputs/model_report.md`
- [PDF report builder](https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/scripts/05_build_pdf_report.py): pipeline stage · Renders the shareable summary. · `scripts/05_build_pdf_report.py`
- **PDF summary**: report artifact

### Learning Workspace

Guided and student-owned notebooks.

- [Discovery notebook](https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/notebooks/01_first_look_and_discovery.ipynb): starter notebook · `notebooks/01_first_look_and_discovery.ipynb`
- [Student model notebook](https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/work/notebooks/w05_model.ipynb): student notebook · `work/notebooks/w05_model.ipynb`
- [Student capstone](https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/work/notebooks/capstone.ipynb): student notebook · Portfolio and submission workspace. · `work/notebooks/capstone.ipynb`
- **Google Colab**: hosted runtime · Primary guided notebook environment.
- **GitHub forks and templates**: submission repository · Learner submission destination.

### Data Governance

Approved data access and enforcement.

- **Gated full dataset**: external dataset · Hugging Face FlyRank/internship-warehouse.
- [Data-use policy](https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/DATA_USE.md): governance policy · Prohibits private client-data ingestion. · `DATA_USE.md`
- [Data-path CI smoke](https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/.github/workflows/data-path-smoke.yml): CI workflow · Checks approved data-path workflows. · `.github/workflows/data-path-smoke.yml`

### Other components

- [Python environment](https://github.com/saif-ullah0/flyrank-ml-internship/blob/main/requirements.txt): runtime dependencies · `requirements.txt`

## Connections

- Batch runner → Feature preparation: runs
- Batch runner → Fix-first baseline: runs
- Batch runner → Model training: runs
- Batch runner → Evaluation and export: runs
- Batch runner → PDF report builder: runs
- Anonymized sample → Feature preparation: input
- Data dictionary → Feature preparation: defines fields
- Feature preparation → Fix-first baseline: prepared features
- Feature preparation → Model training: features and label
- Model utilities → Model training: shared logic
- Fix-first baseline → Evaluation and export: benchmark scores
- Model training → Evaluation and export: holdout predictions
- Model utilities → Evaluation and export: shared evaluation
- Evaluation and export → Model report: exports
- Model report → PDF report builder: source report
- PDF report builder → PDF summary: renders
- Python environment → Batch runner: runs
- Google Colab → Discovery notebook: hosts
- Google Colab → Student model notebook: hosts
- Student model notebook → Student capstone: progresses to
- Student capstone → GitHub forks and templates: submitted through
- Gated full dataset → Anonymized sample: full-scale alternative
- Data-use policy → Gated full dataset: governs access
- Data-path CI smoke → Data-use policy: enforces
