Description
Construct a complete entity/measure grid with planted duplicate observations, explicitly sum duplicates, reshape to fixed-header wide CSV and unpivot the aggregate answer using reviewed CSV converters.
CSV stores records as delimited text fields. Quoting can protect embedded delimiters and newlines, so a record need not equal one physical line. Cleaning field contents, interpreting their types, and preserving an exact import/export round trip are separate operations.
Construct a complete entity/measure grid with planted duplicate observations, explicitly sum duplicates, reshape to fixed-header wide CSV and unpivot the aggregate answer using reviewed CSV converters.
When to use this tool
Use this generator to create reproducible csv pivot long wide round trip cases from the supplied model or bank. Inspect the returned evidence before using cases in a test or exercise.
How to use the tool and how it works
- Supply entities, measures, duplicateCount, aggregation in the field shapes below. Set seed when you need an explicit replay.
- Run the tool and correct any input error. For generated controls, distinguish a successful fixture containing an invalid case from failure to generate the fixture.
- Read longRows, wideRows, aggregatedLongRows, longCsv, wideCsv, parsedLongJson. Use the conventions below. Keep answer-bearing fields separate when presenting an exercise.
Generate one value for every entity/measure pair, append sampled duplicate pairs, and sum values by pair to create a wide table. Expand those sums into aggregatedLongRows and return both CSV layouts and a nonnumeric long-table import.1
Delegated operations used for this result: json to csv; csv to json. Their calculation or parsing conventions apply to the corresponding result fields.2, 3
| Input field | Meaning and units | Accepted input |
|---|---|---|
| entities | Entities | Required. Array of Text; minimum UTF-16 length 1; maximum UTF-16 length 64.; minimum items 1; maximum items 8. |
| measures | Measures | Required. Array of Text; minimum UTF-16 length 1; maximum UTF-16 length 64.; minimum items 1; maximum items 8. |
| duplicateCount | Duplicate Count | Required. Safe integer; minimum 0; maximum 32. |
| aggregation | Aggregation | Required. Text; one of "sum". |
| seed | Optional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed. | Optional. Safe integer. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| longRows | Long Rows | Required. Array of Object; no unknown keys.; minimum items 0; maximum items 96. |
| longRows[].entity | Entity | Required. Text; maximum UTF-16 length 64. |
| longRows[].measure | Measure | Required. Text; maximum UTF-16 length 64. |
| longRows[].value | Value | Required. Safe integer. |
| wideRows | Wide Rows | Required. Array of Object; no unknown keys.; minimum items 0; maximum items 8. |
| wideRows[].entity | Entity | Required. Text; maximum UTF-16 length 64. |
| wideRows[].values | Values | Required. Array of Safe integer.; minimum items 0; maximum items 8. |
| aggregatedLongRows | Aggregated Long Rows | Required. Array of Object; no unknown keys.; minimum items 0; maximum items 64. |
| aggregatedLongRows[].entity | Entity | Required. Text; maximum UTF-16 length 64. |
| aggregatedLongRows[].measure | Measure | Required. Text; maximum UTF-16 length 64. |
| aggregatedLongRows[].value | Value | Required. Safe integer. |
| longCsv | Long Csv | Required. Text; maximum UTF-16 length 100000. |
| wideCsv | Wide Csv | Required. Text; maximum UTF-16 length 100000. |
| parsedLongJson | Parsed Long Json | Required. Text; maximum UTF-16 length 100000. |
| randomness | Replay source and normalized 32-bit seed, or null seed for an advancing context source. | Required. Object; no unknown keys. |
| randomness.seed | Optional safe-integer replay seed; normalization and precedence are explained below. | Required. Safe integer. or Null. |
| randomness.source | Source | Required. Text; one of "context", "seed". |
An explicit safe-integer seed takes precedence over injected context randomness and is normalized to an unsigned 32-bit integer. With no seed and no context source, replay uses the fixed tool.io default seed. A context source must return finite values from zero inclusive to one exclusive; its advancing state must be retained separately. randomness records the source and normalized seed, or null for context. These generators are not cryptographic random sources.
{
"input": {
"entities": [
"A"
],
"measures": [
"x",
"y"
],
"duplicateCount": 1,
"aggregation": "sum",
"seed": 42
},
"output": {
"longRows": [
{
"entity": "A",
"measure": "x",
"value": 6
},
{
"entity": "A",
"measure": "y",
"value": 5
},
{
"entity": "A",
"measure": "y",
"value": 7
}
],
"wideRows": [
{
"entity": "A",
"values": [
6,
12
]
}
],
"aggregatedLongRows": [
{
"entity": "A",
"measure": "x",
"value": 6
},
{
"entity": "A",
"measure": "y",
"value": 12
}
],
"longCsv": "entity,measure,value\nA,x,6\nA,y,5\nA,y,7\n",
"wideCsv": "entity,m0,m1\nA,6,12\n",
"parsedLongJson": "[{\"entity\":\"A\",\"measure\":\"x\",\"value\":\"6\"},{\"entity\":\"A\",\"measure\":\"y\",\"value\":\"5\"},{\"entity\":\"A\",\"measure\":\"y\",\"value\":\"7\"}]",
"randomness": {
"seed": 42,
"source": "seed"
}
}
} Limitations and assumptions
- The round trip preserves aggregated totals, not duplicate row identities or original multiplicity. Wide CSV columns use m0 onward aligned with measures rather than treating arbitrary measure labels as structural keys.
- A replay requires the same complete input and implementation. The stated sampling convention applies within its eligible space. A finite draw does not exhaust all possible outputs; repeats remain possible unless a distinct-selection rule is explicit.
- The field tables state structural bounds; cross-field constraints and bounded search or output budgets also apply. Unknown keys are rejected where the object contract disallows them. Input errors are distinct from null fields and deliberate invalid controls in a successful output.
Alternative or Complementary methods
For a supplied example, inspect the returned construction or delegated check directly. To evaluate a consumer, also test cases chosen for its own boundaries; a generated finite corpus does not establish exhaustive coverage.
References
Similar or alternative tools
- Random CSV Pivot Practice Dataset Generator
Construct exact-count repeated categorical groups with seeded integer/missing values, serialize to CSV and delegate count/sum/mean/min/max pivot answers; count includes missing-value rows, other aggregates omit missing values and return zero for all-missing groups, with the core's floating arithmetic and sorted group keys—not a missing cross-tab fill rule.
- Random CSV Aggregate Reconciliation Exercise Generator
Generate synthetic grouped integer observations, plant one declared subtotal discrepancy and retain exact decimal-string subtotal, grand-total and checksum-row reconciliation answers.