Generate reviewable code in your stack
Anyone's AI can write a mapping. The value is in shipping it safely: DataChord turns your mapping into reviewable code in the language your team runs, with golden-sample tests, an audit-ready mapping spec, and a Docker package — so a senior dev reviews a real diff and runs it in your architecture, not a black box on ours.
By the end of this page you will have:
- Generated a transform in Python, TypeScript, or Java from one mapping.
- Downloaded a golden-sample test suite that pins the code to the mapping's semantics.
- Exported a Markdown mapping specification that replaces the Excel sheet.
- Built a Docker package (CLI or FastAPI) ready to run.
- A MapCraft project with at least one mapping rule (see the walkthrough).
Step 1 — Generate code in your language
Open the Codegen panel for the project and click Generate All. Each target renders the same mapping IR deterministically:
| Target | Output |
|---|---|
| Python | transform(record) -> dict module (stdlib only) |
| TypeScript | export function transform(record) module |
| Java | Transform class with a transform(Map) method |
| SQL / JSONata / XSLT | warehouse / document expressions |
| FastAPI | POST /transform service scaffold |
The TypeScript and Java emitters cover the full rule vocabulary — string/number/ date functions, conditionals, lookups, and array iteration/aggregation — with the same semantics as Python (including banker's rounding), so the languages agree value-for-value.
Step 2 — Download golden-sample tests
With a code target open, click Tests. DataChord computes the expected output for each sample by running the mapping IR through the same evaluator the verifier trusts, then emits a matching suite:
- Python →
pytest(test_transform.py) - TypeScript →
jest(transform.test.ts) - Java → a JUnit scaffold loading the JSON fixtures
Drop the test file next to the generated code and your reviewer has a runnable regression pin, not just a diff to eyeball.
Step 3 — Export the mapping specification
From the MapCraft toolbar Export dropdown, choose Documentation. You get a Markdown spec rendered from the same mapping definition: source/target schema tables, the field-mapping matrix (with confidence), per-rule detail (natural language + compiled Python/SQL/JSONata), combined rules, and lookup tables. It's deterministic — regenerate it any time the mapping changes instead of hand-editing a spreadsheet.
Step 4 — Build a Docker package
In the Codegen panel, open the Docker package tab and pick a flavor:
- Python CLI — a stdlib-only image that reads a JSON record on stdin and writes the transformed record on stdout. Golden tests are bundled.
- FastAPI service — the generated
POST /transformapp served by uvicorn.
Download the ZIP, then:
docker build -t my-transform .
echo '{"example":"record"}' | docker run -i --rm my-transform # CLI flavor
Verify
- The generated TypeScript runs under Node and produces the same output as the Python transform for the same input.
- The downloaded
pytestsuite passes against the downloadedtransform.py. - The Docker image builds and runs the sample.