gabrielaltay commited on
Commit
eff7e9a
·
verified ·
1 Parent(s): efb2d6d

Card: add How this dataset is built section with verbatim GDC request payloads

Browse files
Files changed (1) hide show
  1. README.md +109 -1
README.md CHANGED
@@ -30,7 +30,7 @@ National Cancer Institute (NCI) Genomic Data Commons (GDC). One HuggingFace
30
  (HF) subset per TCGA project; one row per patient.
31
 
32
  - **Projects included:** `TCGA-CHOL`, `TCGA-DLBC`, `TCGA-LUAD`
33
- - **Generated:** 2026-05-05 03:50:12 UTC
34
  - **Source:** GDC `/cases` endpoint, open-access tier only.
35
  - **Schema:** derived from the [GDC Data Dictionary][gdc-dict]; the live
36
  dictionary the GDC was serving when the data was fetched is hashed into
@@ -82,6 +82,114 @@ tree:
82
  unstranded](https://docs.gdc.cancer.gov/Data/Bioinformatics_Pipelines/Expression_mRNA_Pipeline/),
83
  so `unstranded` is the canonical column.
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  ## Loading
86
 
87
  The [`tcga2hf` package][repo] ships a typed `TcgaHfPatient` pydantic model
 
30
  (HF) subset per TCGA project; one row per patient.
31
 
32
  - **Projects included:** `TCGA-CHOL`, `TCGA-DLBC`, `TCGA-LUAD`
33
+ - **Generated:** 2026-05-05 05:47:17 UTC
34
  - **Source:** GDC `/cases` endpoint, open-access tier only.
35
  - **Schema:** derived from the [GDC Data Dictionary][gdc-dict]; the live
36
  dictionary the GDC was serving when the data was fetched is hashed into
 
82
  unstranded](https://docs.gdc.cancer.gov/Data/Bioinformatics_Pipelines/Expression_mRNA_Pipeline/),
83
  so `unstranded` is the canonical column.
84
 
85
+ ## How this dataset is built
86
+
87
+ Three GDC REST endpoints feed every row in this dataset. Both endpoints
88
+ and payloads below are reproduced verbatim from the build code; the
89
+ on-disk `gdc_status.json` for each project additionally pins the GDC
90
+ data release and dictionary SHA-256 the data was fetched against.
91
+
92
+ ### `POST /cases` — clinical entities
93
+
94
+ One paginated POST per build, returning the nested case JSON for every
95
+ patient in the requested projects.
96
+
97
+ ```json
98
+ {
99
+ "filters": {
100
+ "op": "in",
101
+ "content": {
102
+ "field": "project.project_id",
103
+ "value": [
104
+ "TCGA-CHOL",
105
+ "TCGA-DLBC",
106
+ "TCGA-LUAD"
107
+ ]
108
+ }
109
+ },
110
+ "fields": "case_id,submitter_id,primary_site,disease_type,index_date,consent_type,days_to_consent,days_to_lost_to_followup,lost_to_followup",
111
+ "expand": "demographic,diagnoses,diagnoses.treatments,follow_ups,exposures,family_histories,project,samples,samples.portions,samples.portions.analytes,samples.portions.analytes.aliquots",
112
+ "format": "JSON",
113
+ "size": 200,
114
+ "from": 0
115
+ }
116
+ ```
117
+
118
+ The full nested response (top-level scalars + `demographic` + `diagnoses[]`
119
+ with `treatments[]` inside + `follow_ups[]` + `exposures[]` +
120
+ `family_histories[]` + `samples[]` with `portions[].analytes[].aliquots[]`
121
+ inside) is written to `<data-dir>/raw/<project>/cases.json` and feeds the
122
+ `cases` config (and the consolidated patient row).
123
+
124
+ ### `POST /files` — molecular file discovery
125
+
126
+ One POST per (project, data_type) pair, listing every open-access file
127
+ of that type. Below is the request for `Masked Somatic Mutation` against
128
+ `TCGA-LUAD`; the build also runs the same shape with
129
+ `data_type` = `"Gene Expression Quantification"`. The responses are
130
+ written to `<data-dir>/raw/<project>/<modality>/manifest.json` and feed
131
+ the `files` config.
132
+
133
+ ```json
134
+ {
135
+ "filters": {
136
+ "op": "and",
137
+ "content": [
138
+ {
139
+ "op": "=",
140
+ "content": {
141
+ "field": "cases.project.project_id",
142
+ "value": "TCGA-LUAD"
143
+ }
144
+ },
145
+ {
146
+ "op": "=",
147
+ "content": {
148
+ "field": "access",
149
+ "value": "open"
150
+ }
151
+ },
152
+ {
153
+ "op": "=",
154
+ "content": {
155
+ "field": "data_type",
156
+ "value": "Masked Somatic Mutation"
157
+ }
158
+ }
159
+ ]
160
+ },
161
+ "fields": "file_id,file_name,file_size,md5sum,data_category,data_type,data_format,experimental_strategy,workflow_type,access,cases.case_id,cases.submitter_id,cases.project.project_id,cases.samples.sample_id,cases.samples.submitter_id,cases.samples.sample_type,cases.samples.tissue_type,cases.samples.portions.analytes.aliquots.aliquot_id,cases.samples.portions.analytes.aliquots.submitter_id",
162
+ "format": "JSON",
163
+ "size": 500,
164
+ "from": 0
165
+ }
166
+ ```
167
+
168
+ ### `POST /data` — file bytes
169
+
170
+ For every file UUID returned by `/files`, the build batches up to 50
171
+ UUIDs per request:
172
+
173
+ ```json
174
+ {"ids": ["<file_uuid_1>", "<file_uuid_2>", "..."]}
175
+ ```
176
+
177
+ The response is a tar.gz of the files. Mutations files are parsed
178
+ row-by-row into the `masked_somatic_mutation` config; expression files
179
+ are parsed gene-row-by-gene-row into the
180
+ `gene_expression_quantification` config. (See `tcga2hf.gdc.bulk_download`
181
+ for the batching + retry logic.)
182
+
183
+ ### Other GDC calls captured for provenance
184
+
185
+ - `GET /status` — once at the top of every build; `data_release` /
186
+ `tag` / `commit` are saved in each project's `gdc_status.json`.
187
+ - `GET /v0/submission/_dictionary/_all` — once at the top of every build;
188
+ written to `<data-dir>/raw/gdc_dictionary.<major>.<minor>.json` and its
189
+ SHA-256 is recorded in `gdc_status.json`. The static schema in
190
+ `tcga2hf.schema` is regenerated from this dictionary; see the package
191
+ `scripts/regenerate_clinical_fields.py`.
192
+
193
  ## Loading
194
 
195
  The [`tcga2hf` package][repo] ships a typed `TcgaHfPatient` pydantic model