Skip to content

Commit ff4e11e

Browse files
authored
Merge pull request #134 from GetTechAPI/chore/repo-cleanup
chore: drop the TechAPI submodule loop and unused files; document the layout
2 parents 45090a0 + 422ac8c commit ff4e11e

28 files changed

Lines changed: 160 additions & 265 deletions

‎.editorconfig‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
9+
[*.py]
10+
indent_style = space
11+
indent_size = 4
12+
13+
[*.{yml,yaml,json,astro,md,mjs}]
14+
indent_style = space
15+
indent_size = 2
16+
17+
[*.md]
18+
trim_trailing_whitespace = false

‎.gitattributes‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Every tracked text file is stored with LF; keep working trees the same on
2+
# Windows and macOS.
3+
* text=auto eol=lf

‎.github/CODEOWNERS‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# Default owners for everything in the repo.
2-
# TODO: replace with the maintainer's GitHub handle or org team before Phase 1.
32
* @GetTechAPI/maintainers
43

5-
/data/ @GetTechAPI/maintainers
64
/app/ @GetTechAPI/maintainers

‎.github/workflows/final-check.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: final-check
44
# runs what test.yml runs (ruff, mypy, the seed-data validator, pytest with
55
# coverage) on the PR, and TechEngineBot leaves ONE comment with the verdict;
66
# adding the label again edits that comment. This is the only place the
7-
# TechEngineBot account is used in this repo, and it replaces Copilot reviews.
7+
# TechEngineBot account is used by a workflow in this repo.
88
#
99
# The check job runs PR code, so it gets no secrets and a read-only token.
1010
# Only the comment job sees TECHENGINEBOT_TOKEN, which must be a fine-grained

‎.github/workflows/ingest.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,9 @@ jobs:
188188
PY
189189
190190
# The token is read-only, so the commit leaves the run as a patch. A
191-
# maintainer opens the PR from their own account with TechAPI's
192-
# .github/scripts/open-collect-pr.sh <run-id>, so the PR's checks run.
191+
# maintainer runs TechAPI's .github/scripts/open-collect-pr.sh <run-id>:
192+
# their account pushes the branch and TechEngineBot opens the PR, so the
193+
# PR's checks run.
193194
- name: Export the commit as collect.patch
194195
if: steps.commit.outputs.changed == 'true'
195196
env:

‎.github/workflows/refresh.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,9 @@ jobs:
206206
PY
207207
208208
# The token is read-only, so the commit leaves the run as a patch. A
209-
# maintainer opens the PR from their own account with TechAPI's
210-
# .github/scripts/open-collect-pr.sh <run-id>, so the PR's checks run.
209+
# maintainer runs TechAPI's .github/scripts/open-collect-pr.sh <run-id>:
210+
# their account pushes the branch and TechEngineBot opens the PR, so the
211+
# PR's checks run.
211212
- name: Export the commit as collect.patch
212213
if: steps.commit.outputs.changed == 'true'
213214
env:

‎.github/workflows/verify-promote.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,9 @@ jobs:
221221
PY
222222
223223
# The token is read-only, so the commit leaves the run as a patch. A
224-
# maintainer opens the PR from their own account with TechAPI's
225-
# .github/scripts/open-collect-pr.sh <run-id>, so the PR's checks run.
224+
# maintainer runs TechAPI's .github/scripts/open-collect-pr.sh <run-id>:
225+
# their account pushes the branch and TechEngineBot opens the PR, so the
226+
# PR's checks run.
226227
- name: Export the commit as collect.patch
227228
if: steps.commit.outputs.changed == 'true'
228229
env:

‎.gitignore‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@ env/
1919
*.sqlite
2020
*.sqlite3
2121

22+
# A TechAPI checkout placed inside this repo (CI does this and sets
23+
# TECHAPI_DATA_DIR); the dataset is never committed here.
24+
/TechAPI/
25+
2226
# Generated static dump (build artifact; published by refresh-data workflow)
2327
/dump/
2428

2529
# Local-only handoff notes (private; never committed to the public repo)
2630
*.local.md
2731

28-
# Local tooling/editor config (kept out of the public repo)
29-
.claude/
30-
3132
# Note: data/_staging/ (raw collected candidate pool) is intentionally tracked —
3233
# comprehensive data collection is a purpose of this repo.
3334

‎.gitmodules‎

Lines changed: 0 additions & 4 deletions
This file was deleted.

‎README.md‎

Lines changed: 71 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
TechEngine owns everything *around* the data: schema validation, the FastAPI
99
read API, the static JSON dump generator, the engine's own landing site,
10-
automated coverage checks, and the weekly ingestion/refresh crawlers.
10+
coverage checks, the ingestion/refresh collectors and the verification tiers.
11+
Nothing here runs on a schedule; collectors run only when a maintainer
12+
dispatches them.
1113

1214
The dataset and the public-facing playground site live in
1315
[TechAPI](https://github.com/GetTechAPI/TechAPI) so each can be versioned,
@@ -17,60 +19,89 @@ engine's own landing: what TechEngine is, what it runs, and links out to docs.
1719
## Layout
1820

1921
```text
20-
app/
21-
validate.py # schema/range/uniqueness checks
22-
seed.py # data/ -> SQLModel database
23-
dump.py # API -> static JSON tree
24-
main.py # FastAPI entrypoint
22+
app/ # the engine (the one installable Python package)
23+
main.py # FastAPI entry point; mounts every router under /v1
24+
routers/ # /v1 routes, one module per collection (list below)
2525
models/ # SQLModel tables
26-
routers/ # /v1/{brands,socs,smartphones,gpus,cpus}
27-
schemas/ # Pydantic response models
28-
services/ # scoring (algorithm_version-tagged)
29-
coverage/ # upstream-vs-curated diff + Markdown report
30-
ingest/ # draft new records from upstream pages
31-
tests/ # unit + integration
32-
site/ # Astro engine landing (deploys to Pages)
33-
docs/ # SPEC / DATA_PIPELINE / DEVELOPMENT
34-
TechAPI/ # submodule -> GetTechAPI/TechAPI (clickable @ <sha> link)
35-
.github/workflows/
36-
test.yml # lint + type-check + tests
37-
validate-data.yml # read-only data validation (workflow_call or manual)
38-
deploy-pages.yml # build & deploy engine site + dump
39-
coverage-report.yml # manual: gap report to the job summary + artifact
40-
ingest.yml # workflow_call: draft new SKUs -> collect.patch
41-
refresh.yml # workflow_call: re-scrape benchmarks -> collect.patch
42-
verify-promote.yml # workflow_call: Tier 1-3 checks + verified promotion patch
43-
final-check.yml # label-triggered checks + one TechEngineBot comment
26+
schemas/ # Pydantic response models + serializers
27+
services/scoring/ # 0-100 scores, weights from config/scoring.yaml
28+
data_root.py # finds the TechAPI dataset (see below)
29+
categories.py # the 13 dataset categories and their collection names
30+
validate.py # schema/range/uniqueness checks on the dataset
31+
seed.py # dataset -> SQL database
32+
dump.py # API -> static JSON tree (./dump)
33+
coverage/ # upstream-vs-curated gap report
34+
ingest/ # collectors: draft new records, refresh benchmarks
35+
verify/ # trust tiers 0-3, verified promotion, backfill tools
36+
config/scoring.yaml # scoring weights and reference scales
37+
integrity_check.py # whole-dataset anomaly scan (the --strict gate)
38+
tests/ # unit/, integration/, verify/
39+
site/ # Astro landing page, deployed to GitHub Pages
40+
docs/ # SPEC, DATA_PIPELINE, DEVELOPMENT
41+
.github/workflows/ # CI; every workflow is listed below
42+
Dockerfile, docker-compose.yml # stale, do not build (see Docker)
4443
```
4544

46-
## How The Two Repos Connect
45+
Routes under `/v1`: `health`, `version`, `brands`, `socs`, `smartphones`,
46+
`tablets`, `watches`, `pdas`, `gpus`, `cpus`, `laptops`, `monitors`,
47+
`software`, `websites`, `device-catalog`. Dataset folders are singular
48+
(`cpu/`), routes are plural (`/v1/cpus`); `app/categories.py` holds the mapping.
49+
50+
**How the engine finds the dataset.** This repo holds no data. Every entry
51+
point asks `app/data_root.py`, which returns the first of: the
52+
`TECHAPI_DATA_DIR` environment variable; `../data` (this repo checked out as
53+
TechAPI's `TechEngine` submodule); `../TechAPI/data` (the two repos cloned side
54+
by side). CI checks TechAPI out into `./TechAPI`, which is git-ignored, and
55+
sets `TECHAPI_DATA_DIR` to its `data/` folder.
56+
57+
Workflows:
58+
59+
```text
60+
test.yml # lint + type-check + tests
61+
validate-data.yml # read-only data validation (workflow_call or manual)
62+
deploy-pages.yml # on push to main: build site/ + static dump -> Pages
63+
coverage-report.yml # manual: gap report to the job summary + artifact
64+
ingest.yml # workflow_call: draft new SKUs -> collect.patch
65+
refresh.yml # workflow_call: re-scrape benchmarks -> collect.patch
66+
verify-promote.yml # workflow_call: Tier 1-3 checks + verified promotion patch
67+
final-check.yml # label-triggered checks + one TechEngineBot comment
68+
```
4769

48-
Both repos live in the **GetTechAPI** org and each includes the other as a git
49-
**submodule** (a clickable `@ <sha>` pin). Nothing syncs them automatically.
70+
## How The Two Repos Connect
5071

51-
No workflow here runs on a schedule or uses a personal access token (ADR-017).
52-
The one comment any workflow posts is TechEngineBot's final check, and only when
53-
a maintainer adds the `final-check` label to a PR (`final-check.yml`).
72+
Both repos live in the **GetTechAPI** org. TechAPI pins this repo as its
73+
`TechEngine` git **submodule** (a clickable `@ <sha>` pin); this repo does not
74+
pin TechAPI back, so there is no submodule loop. Nothing syncs them
75+
automatically: the pin moves only when a TechAPI commit moves it.
76+
77+
No workflow here runs on a schedule or uses a personal access token (ADR-017),
78+
and no workflow opens or approves a PR. TechEngineBot opens PRs by hand from a
79+
maintainer's machine, with its gh login kept apart from the maintainer's own;
80+
the maintainer's account still commits, pushes and merges. The one comment any
81+
workflow posts is TechEngineBot's final check, and only when a maintainer adds
82+
the `final-check` label to a PR (`final-check.yml`).
5483
Collection runs only when a maintainer dispatches TechAPI's `collect.yml`, which
5584
calls `ingest.yml`, `refresh.yml` or `verify-promote.yml` with a read-only
5685
token. Each run commits locally, gates the result with `app.validate` and
5786
`integrity_check.py --strict`, and uploads the commit as `collect.patch`. A
58-
maintainer opens the PR from their own account with TechAPI's
59-
`.github/scripts/open-collect-pr.sh`; no workflow pushes or opens a PR. The
87+
maintainer then runs TechAPI's `.github/scripts/open-collect-pr.sh` by hand:
88+
their account pushes the run's `collect/*` branch and TechEngineBot opens the
89+
PR. No workflow pushes or opens a PR. The
6090
engine that runs is the TechEngine commit TechAPI pins as its submodule.
6191
Crawlers identify themselves with a `TechEngine-*` User-Agent.
6292

6393
Every Python entry point reads data from a **TechAPI checkout**. The location
6494
can be overridden via `TECHAPI_DATA_DIR`; by default TechEngine supports both
65-
layouts: `TechAPI/TechEngine` as a submodule and `TechAPI` beside `TechEngine`.
95+
layouts: `TechAPI/TechEngine` as TechAPI's submodule and `TechAPI` beside
96+
`TechEngine` (see Layout).
6697

6798
## Quickstart
6899

69100
```bash
70101
git clone https://github.com/GetTechAPI/TechAPI.git ../TechAPI # data source
71102
pip install -e ".[dev]"
72103
python -m app.validate # check data integrity
73-
python -m app.seed # data/ -> ./techapi.db (SQLite)
104+
python -m app.seed # dataset -> ./techapi.db (SQLite)
74105
uvicorn app.main:app --reload # serve; curl localhost:8000/v1/cpus/ryzen-9-9950x3d
75106
python -m app.dump # generate ./dump/v1/... static tree
76107
```
@@ -82,13 +113,13 @@ seed records may omit them or use `null` when no source value is known, and API
82113
detail responses and static dumps preserve unknown values as `null`.
83114
Smartphones continue to require numeric values for both fields.
84115

85-
### Docker Compose (Postgres)
86-
87-
```bash
88-
docker compose up --build
89-
```
116+
### Docker
90117

91-
Spins up Postgres 16, seeds from the mounted TechAPI checkout, serves on `:8000`.
118+
`Dockerfile` and `docker-compose.yml` predate the split from TechAPI and do
119+
not work as they are: the Dockerfile copies `data/` and `scripts/`, which no
120+
longer exist here, so the image does not build, and the compose file mounts no
121+
TechAPI checkout for `app.seed` to read. No workflow builds or uses them. Use
122+
the Quickstart above; for Postgres, point `DATABASE_URL` at your own instance.
92123

93124
## Roadmap
94125

0 commit comments

Comments
 (0)