[DT-3869] Define the Study Template CSV v1 contract and fixtures - #3004
[DT-3869] Define the Study Template CSV v1 contract and fixtures#3004kevinmarete wants to merge 9 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 17 changed files in this pull request and generated no new comments.
Suppressed comments (1)
docs/study-template-v1.md:65
- The contract text says JSON values must be "compact", but the canonical fixtures include whitespace inside JSON arrays/objects (e.g.,
"cloud": ["GCP"]). If whitespace is allowed (as implied by the fixtures and ObjectMapper parsing), the contract should say "JSON" rather than requiring a compact representation to avoid ambiguity for producers/consumers.
| Array | Compact JSON array in one CSV cell, such as `["Genomic","Phenotypic"]`. CSV escaping still applies. |
| Object | Compact JSON object in one CSV cell, used only for supported asset payloads and `fileTypes` entries. |
fboulnois
left a comment
There was a problem hiding this comment.
Have we run these templates by Jonathan? I see some JSON in the multi-consent-group. I think these templates were meant to be user facing, so that might become complicated with embedded JSON.
otchet-broad
left a comment
There was a problem hiding this comment.
The alternativeSharingPlan should be run to ground.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 17 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/test/java/org/broadinstitute/consent/http/models/dto/registration/StudyTemplateV1FixturesTest.java:115
- This duplicate-detection key uses a NUL character (\0), which makes assertion output hard to interpret. Use a visible delimiter (e.g.,
::) to keep debugging straightforward.
.map(csvRecord -> csvRecord.get(1) + '\0' + csvRecord.get(2) + '\0' + csvRecord.get(4))
src/test/java/org/broadinstitute/consent/http/models/dto/registration/StudyTemplateV1FixturesTest.java:61
- Building
fieldKeyusing a NUL character (\0) makes assertion failure messages hard to read/debug and can behave oddly in logs. Prefer a visible delimiter (e.g.,::) viaString.jointo keep keys unambiguous and readable.
This issue also appears on line 115 of the same file.
String fieldKey = csvRecord.get(1) + '\0' + csvRecord.get(2) + '\0' + csvRecord.get(4);
|
@jlaw-codes — DT-3869 defines the v1 CSV contract for importing one study and its datasets into a registration draft (doc: 1. Dropping the alternative data sharing plan from the template The template can't carry file uploads. Rather than exclude only Is that right — a user who needs an alternative sharing plan fills that section in on the populated draft, where the upload lives? Or would you rather the non-file fields import anyway so they only have to attach the document? 2. How much hand-authored JSON is acceptable Each row is one field. Multi-value fields like That keeps JSON out of every field a typical study needs. It survives in two optional places — Neither appears in a minimal template. Is that acceptable for the people who'll actually fill these out? If not, the realistic alternative is dropping non-file assets from v1 and adding them once there's a UI to author them — there's no One thing that would help me judge #2: how do you expect producers to get the template — download a pre-filled one from DUOS, or build it from this spec? If DUOS generates it, the JSON is something people edit rather than write, and it matters much less. |
|
Fine to exclude Alt DS plans |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 23 out of 24 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/test/java/org/broadinstitute/consent/http/models/dto/registration/StudyTemplateV1FixturesTest.java:50
- The Javadoc says
fileTypes"stays a single JSON cell", but this contradicts the v1 contract (and the rest of this test) which asserts that v1 has no JSON encoding and thatfileTypesis modeled viafileTyperecords. This comment is misleading for future readers maintaining the fixture rules.
/**
* Array-typed fields that the contract encodes as one row per item, so the same (recordType,
* recordId, field) tuple may legitimately repeat. Every other field is single-valued. {@code
* fileTypes} is an object array and stays a single JSON cell.
*/
Product confirmed a preference for no JSON in the template, so v1 now expresses every structured wire value as rows. - Make fileTypes a record type parented to its consent group rather than a JSON array cell, with an orphan-parent fixture for the new rule. The consent-group mapping row no longer types it as an object array, which read as an instruction to paste JSON. - Drop non-file assets from v1. Their payloads nest (authors, presenter, maintainer), so a JSON-free encoding needs dotted paths or second-level child records. They are optional and additive, so nothing is blocked, and they are the first v2 candidate. - Confirm the alternativeDataSharingPlan exclusion with product. - Assert no fixture encodes a value as JSON so the rule holds going forward. - Repair the File contract section, whose bullet list had been split by the subsections added in the previous commit. - Link to the duos-ui plan, which now records how these decisions change the later tickets. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Pushed two rounds of changes since your reviews. Summary of what moved:
The plan in duos-ui is updated to match, including the ticket changes these decisions force: DataBiosphere/duos-ui#3828. @otchet-broad this should cover your change request when you get a chance. |
|
@fboulnois yes — took it to Jonathan, and he preferred no JSON, so it's all gone rather than justified. Scalar arrays repeat their row, He also confirmed the template gets downloaded from the DUOS UI rather than hand-built, which is now a v1 requirement on the UI side — DataBiosphere/duos-ui#3828 adds it to Ticket 4. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 23 out of 24 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/test/java/org/broadinstitute/consent/http/models/dto/registration/StudyTemplateV1FixturesTest.java:50
- The Javadoc for
SCALAR_ARRAY_FIELDSsaysfileTypes“stays a single JSON cell”, but this contradicts the v1 contract and the rest of this test (v1 has no JSON-in-cell encoding;fileTypesis represented viafileTyperecords). This comment should be corrected to avoid misleading future parser/test work.
/**
* Array-typed fields that the contract encodes as one row per item, so the same (recordType,
* recordId, field) tuple may legitimately repeat. Every other field is single-valued. {@code
* fileTypes} is an object array and stays a single JSON cell.
*/
The SCALAR_ARRAY_FIELDS comment still said fileTypes stays a single JSON cell, which is the opposite of what the contract now says. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|



Addresses
https://broadworkbench.atlassian.net/browse/DT-3869
Summary
Have you read CONTRIBUTING.md lately? If not, do that first.