-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.pancancer_atlas.TCGA_CDR`
(
  ParticipantBarcode STRING OPTIONS(description="TCGA barcode identifier for the study participant, eg TCGA-02-0001"),
  Study STRING OPTIONS(description="TCGA study abbreviation, eg LAML. Full list available at https://gdc.cancer.gov/resources-tcga-users/tcga-code-tables/tcga-study-abbreviations"),
  OS INT64 OPTIONS(description="Overall survival event, 1 for death from any cause, 0 for alive"),
  OS_time INT64 OPTIONS(description="Overall survival time in days, last_contact_days_to or death_days_to, whichever is larger"),
  DSS INT64 OPTIONS(description="Disease-specific survival event, 1 for patient whose vital_status was Dead and tumor_status was WITH TUMOR. If a patient died from the disease shown in field of cause_of_death, the status of DSS would be 1 for the patient.  0 for patient whose vital_status was Alive or whose vital_status was Dead and tumor_status was  TUMOR FREE. This is not a 100% accurate definition but is the best we could do with this dataset. Technically a patient could be with tumor but died of a car accident and therefore incorrectly considered as an event."),
  DSS_time INT64 OPTIONS(description="Disease-specific survival time in days, last_contact_days_to or death_days_to, whichever is larger."),
  DFI INT64 OPTIONS(description="Disease-free interval event, 1 for patient having new tumor event whether it is a local recurrence, distant metastasis, new primary tumor of the cancer, including cases with a new tumor event whose type is N/A.  Disease free was defined by: first, treatment_outcome_first_course is \"Complete Remission/Response\"; if the tumor type doesn't have \"treatment_outcome_first_course\" then disease-free was defined by the value \"R0\" in the field of \"residual_tumor\"; otherwise, disease-free was defined by the value \"negative\" in the field of \"margin_status\". If the tumor type did not have any of these fields, then its DFI was NA. 0 for censored otherwise. New primary tumor in other organ was censored; patients who were Dead with tumor without new tumor event are excluded; patients wih stage IV are excluded too."),
  DFI_time INT64 OPTIONS(description="Disease-free interval time in days, new_tumor_event_dx_days_to for events, or for censored cases, either last_contact_days_to or death_days_to, whichever is applicable."),
  PFI INT64 OPTIONS(description="Progression-free interval event, 1 for patient having new tumor event whether it was a progression of disease, local recurrence, distant metastasis, new primary tumors all sites, or died with the cancer without new tumor event, including cases with a new tumor event whose type is N/A. 0 for censored otherwise. "),
  PFI_time INT64 OPTIONS(description="Progression-free interval time in days, for events, either new_tumor_event_dx_days_to or death_days_to,  whichever is applicable; or for censored cases, either last_contact_days_to or death_days_to, whichever is applicable"),
  Redaction STRING OPTIONS(description="To show if the case is redacted.")
)
OPTIONS(
  friendly_name="PanCancer Clinical Data Resource (CDR) Outcome and Survival",
  description="Data loaded from the PanCancer Atlas initiative on the GDC in April 2018. Contains A curated resource of the clinical annotations for TCGA data and provides recommendations for use of clinical endpoints. It is strongly recommended that this file be used for clinical elements and survival outcome data first.\nMore details: \nhttps://gdc.cancer.gov/about-data/publications/PanCan-Clinical-2018\nand\nhttps://gdc.cancer.gov/about-data/publications/pancanatlas",
  labels=[("source", "gdc"), ("category", "clinical_biospecimen_data"), ("status", "current"), ("data_type_1", "survival"), ("reference_genome", "hg19"), ("access", "open"), ("data_type_0", "clinical_supplement"), ("program", "pancancer_atlas")]
);

INSERT INTO `isb-cgc-bq.pancancer_atlas.TCGA_CDR` (ParticipantBarcode, Study, OS, OS_time, DSS, DSS_time, DFI, DFI_time, PFI, PFI_time, Redaction) VALUES ('TCGA-BT-A20R', 'BLCA', 1, 154, NULL, 154, NULL, NULL, 0, 154, NULL), ('TCGA-06-0126', 'GBM', 1, 211, NULL, 211, NULL, NULL, 0, 211, NULL), ('TCGA-AB-2848', 'LAML', 1, 455, NULL, NULL, NULL, NULL, NULL, NULL, NULL), ('TCGA-AB-2851', 'LAML', 1, 242, NULL, NULL, NULL, NULL, NULL, NULL, NULL), ('TCGA-AB-2870', 'LAML', 1, 153, NULL, NULL, NULL, NULL, NULL, NULL, NULL);