Skip to content

feat: AI grading v3 — 8 subgrades, card detection, ML dataset#109

Merged
Pyronewbic merged 4 commits into
mainfrom
dev
May 15, 2026
Merged

feat: AI grading v3 — 8 subgrades, card detection, ML dataset#109
Pyronewbic merged 4 commits into
mainfrom
dev

Conversation

@Pyronewbic

Copy link
Copy Markdown
Owner

Summary

  • 8-subgrade front/back split: centering, corners, edges, surface graded independently for front and back. Overall uses AGS-style 60/40 weighting with excessive defect cap (lowest subgrade + 1).
  • Card boundary detection: Haiku preflight auto-detects and crops card from background in user photos. Skips when card fills >80% of frame (listing images).
  • ML dataset pipeline: track-prices passively collects graded slab images (PSA/BGS/CGC/TAG) from eBay sold listings into grading-dataset Firestore collection. Owner-only stats endpoint.
  • Token usage tracking: estimated cost per grade in response ($3/$15 per 1M for Claude).
  • Practices skill: coding conventions reference for consistent development.

Test plan

  • node test/unit-test.js — 172 tests pass (roundGrade, image blocks, v3 formula, price trend edges)
  • Smoke test new endpoints: /api/grading-dataset/stats, /api/autocomplete, /api/sets/:setCode
  • POST /api/grade with front + back images — verify 8 subgrades + mode: "llm-detailed-v3"
  • POST /api/grade with front only — verify fallback with limitation note
  • Verify cardDetection field populated when user photo has background

… dataset pipeline

- 8 subgrades (centering/corners/edges/surface x front/back) with 60/40 weighting
- Card boundary detection via Haiku preflight — auto-crops user photos with background
- Passive slab image collection from eBay sold listings into grading-dataset Firestore
- Token usage + cost tracking per grade
- Overall formula: (front*0.60 + back*0.40), capped at lowest subgrade + 1
- 172 unit tests, ~130 API tests
Comment on lines +19 to +23
const imgRes = await axios.get(imageUrl, {
responseType: "arraybuffer",
timeout: 15_000,
maxRedirects: 5,
});
DNS-resolves hostnames and blocks private IPs, cloud metadata endpoints,
and non-HTTP(S) schemes in detectAndCropCard and cropCorners.
…ction

- Changelog v1.3.0: 8-subgrade grading, card detection, ML dataset, SSRF protection
- README: version bump, updated AI grading description
- Internals: v3 pipeline, SSRF validation, new Firestore collections, test counts
- Preprocessing: SSRF-safe image fetch with DNS resolution + private IP blocking
@Pyronewbic Pyronewbic merged commit c495b5f into main May 15, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants