Add apparel technical pack generator - SuperDocs task submission - #21
Open
priyansh-0304 wants to merge 2 commits into
Open
Add apparel technical pack generator - SuperDocs task submission#21priyansh-0304 wants to merge 2 commits into
priyansh-0304 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a standalone “apparel tech pack generator” use-case that deterministically grades measurement specs in code, runs SuperDocs chat/edit to polish formatting and insert flats, verifies post-edit measurement integrity, and exports a DOCX.
Changes:
- Implement deterministic grading + HTML tech pack generation + post-edit measurement-table verification.
- Add a thin SuperDocs API wrapper (chat/approve/export) and an orchestration script (
main.py) to run the pipeline end-to-end. - Add a pytest suite covering grading correctness, SuperDocs response-shape edge cases, and verification mismatch detection.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| use-cases/priyansh-0304/apparel-techpack-generator/tests/test_verification.py | Adds tests ensuring verification detects mismatches and missing tables. |
| use-cases/priyansh-0304/apparel-techpack-generator/tests/test_superdocs_client.py | Adds mocked tests for SuperDocs client response parsing and error handling. |
| use-cases/priyansh-0304/apparel-techpack-generator/tests/test_grading.py | Adds unit tests for deterministic grading across sizes and base-size changes. |
| use-cases/priyansh-0304/apparel-techpack-generator/techpack/verification.py | Implements HTML table extraction + verification against computed graded spec. |
| use-cases/priyansh-0304/apparel-techpack-generator/techpack/superdocs_client.py | Implements SuperDocs API wrapper for chat/approve/export and response normalization. |
| use-cases/priyansh-0304/apparel-techpack-generator/techpack/grading.py | Implements deterministic grading and graded-spec table builder. |
| use-cases/priyansh-0304/apparel-techpack-generator/techpack/generator.py | Generates initial tech-pack HTML (measurement table + BOM + notes). |
| use-cases/priyansh-0304/apparel-techpack-generator/techpack/init.py | Marks techpack as a package. |
| use-cases/priyansh-0304/apparel-techpack-generator/styles/classic_crew_tee.json | Adds a sample style definition used by the generator. |
| use-cases/priyansh-0304/apparel-techpack-generator/requirements.txt | Adds runtime deps (requests, python-dotenv). |
| use-cases/priyansh-0304/apparel-techpack-generator/requirements-dev.txt | Adds dev dep (pytest). |
| use-cases/priyansh-0304/apparel-techpack-generator/README.md | Documents the pipeline, assumptions, setup, and tests. |
| use-cases/priyansh-0304/apparel-techpack-generator/main.py | Orchestrates the end-to-end flow (chat → verify → images → verify → approve → export). |
| use-cases/priyansh-0304/apparel-techpack-generator/.gitignore | Ignores env/venv/cache/output artifacts. |
| use-cases/priyansh-0304/apparel-techpack-generator/.env.example | Provides env var template for SUPERDOCS_API_KEY. |
Suppressed comments (2)
use-cases/priyansh-0304/apparel-techpack-generator/techpack/superdocs_client.py:90
requests.post(...)is called without a timeout, which can hang indefinitely on network issues. Add a timeout for this API call as well.
resp = requests.post(f"{BASE_URL}/approve", headers=_get_headers(), json=payload)
use-cases/priyansh-0304/apparel-techpack-generator/techpack/superdocs_client.py:122
requests.post(...)is called without a timeout, which can hang indefinitely on network issues. Add a timeout for the export call too.
resp = requests.post(f"{BASE_URL}/documents/export", headers=_get_headers(), json=payload)
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if document_html is not None: | ||
| payload["document_html"] = document_html | ||
|
|
||
| resp = requests.post(f"{BASE_URL}/chat", headers=_get_headers(), json=payload) |
Comment on lines
+55
to
+58
| if data.get("document_changes") is None: | ||
| print("⚠️ document_changes was null. Full raw response:") | ||
| print(json.dumps(data, indent=2)) | ||
|
|
Comment on lines
+6
to
+8
| def grade_measurement(base_value: float, grade_rule: float, base_size: str, target_size: str) -> float: | ||
| steps = SIZE_ORDER.index(target_size) - SIZE_ORDER.index(base_size) | ||
| return round(base_value + (grade_rule * steps), 3) |
Comment on lines
+11
to
+15
| rows = "" | ||
| for point in style["measurement_points"]: | ||
| cells = "".join(f"<td>{graded[point['point_name']][s]}\"</td>" for s in sizes) | ||
| rows += f"<tr><td>{point['point_name']}</td>{cells}<td>±{point['tolerance']}\"</td></tr>" | ||
|
|
Comment on lines
+1
to
+4
| import json | ||
| import os | ||
| import time | ||
| from pathlib import Path |
Comment on lines
+70
to
+77
| changes = result.get("document_changes") or {} | ||
| version_id = changes.get("version_id") | ||
|
|
||
| # Step 3: approve if needed | ||
| if changes.get("requires_approval") or changes.get("pending_changes"): | ||
| try: | ||
| approve_changes(version_id=version_id, approve_all=True) | ||
| print("Changes approved.") |
…rd missing version_id, minor cleanup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Priyansh Arora
Apparel technical pack generator built for the SuperDocs hiring round. Produces a factory-ready technical pack — deterministically graded measurement tables (verified correct via automated tests, never AI-computed), materials, construction notes, and AI-generated flat sketches — built on SuperDocs' chat/edit and export API.