-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.clinical_tier3_colorectal_r5`
(
  Timepoint_Label STRING OPTIONS(description="Label to identify the time point at which the clinical data or biospecimen was obtained (e.g. Baseline, End of Treatment, Overall survival, Final). NO PHI/PII INFORMATION IS ALLOWED."),
  Component STRING OPTIONS(description="Category of metadata (e.g. Diagnosis, Biospecimen, scRNA-seq Level 1, etc.); provide the same one for all items/rows."),
  Stop_Days_from_Index STRING OPTIONS(description="Number of days from the date of birth (index date) to the end date of the event (e.g. exposure to environmental factor, treatment start, etc.). Note: if the event occurs at a single time point, e.g. a diagnosis or a lab test, the values for this column is 'Not Applicable'"),
  Family_Colon_Cancer_History_Indicator STRING OPTIONS(description="The indicator to designate if any first degree relative has a history of colorectal cancer."),
  History_of_Prior_Colon_Polyps STRING OPTIONS(description="Yes/No indicator to describe if the subject had a previous history of colon polyps as noted in the history/physical or previous endoscopic report (s)."),
  Colorectal_Cancer_Tumor_Border_Configuration STRING OPTIONS(description="The description of the border configuration of a colorectal tumor at pathologic assessment."),
  Immediate_Family_History_Ovarian_Cancer STRING OPTIONS(description="Text that describes the age at which the family member was diagnosed with ovarian cancer in relationship to their 50th birthday."),
  MLH1_Promoter_Methylation_Status STRING OPTIONS(description="Text term to define the status of promoter methylation for the MLH1 gene. Note: MLH1 gene is commonly associated with hereditary nonpolyposis colorectal cancer. Testing for methylation of the MLH1 promoter can help distinguish sporadic from inherited cancers."),
  Size_of_Polyp_Removed STRING OPTIONS(description="Size of the polyp removed in cm"),
  Family_History_Colorectal_Polyp STRING OPTIONS(description="A yes/no/unknown/not applicable indicator related to family medical history diagnosis of polypoid lesion that arises from the colon or rectum and protrudes into the lumen."),
  Colorectal_Polyp_New_Indicator STRING OPTIONS(description="A yes/no response to a question that asks whether any new polyps greater or equal to two millimeter were identified."),
  Colorectal_Cancer_KRAS_Indicator STRING OPTIONS(description="The yes/no/not applicable indicator that describes if patient has diagnosis of colorectal cancer with known KRAS."),
  Colorectal_Polyp_Type STRING OPTIONS(description="Type of polyp found in the participant"),
  entityId STRING OPTIONS(description="Synapse ID of entity"),
  Colorectal_Cancer_Detection_Method_Type STRING OPTIONS(description="The means, manner of procedure, or systematic course of actions performed in order to discover or identify colorectal cancer"),
  Colorectal_Polyp_Adenoma_Type STRING OPTIONS(description="Type of adenoma associated with the polyp"),
  Colon_Polyp_Occurence_Indicator STRING OPTIONS(description="Yes/No indicator to describe if the subject had a previous history of colon polyps as noted in the history/physical or previous endoscopic report (s)."),
  Colorectal_Polyp_Shape STRING OPTIONS(description="Shape of polyp identified in the participant"),
  Immediate_Family_History_Endometrial_Cancer STRING OPTIONS(description="Text that describes the age at which the family member was diagnosed with endometrial or uterine cancer in relationship to their 50th birthday."),
  HTAN_Participant_ID STRING OPTIONS(description="HTAN ID associated with a patient based on HTAN ID SOP (eg HTANx_yyy )"),
  Patient_Colonoscopy_Performed_Indicator STRING OPTIONS(description="The yes/no indicator that records if the subject has undergone a previous colonoscopy."),
  Start_Days_from_Index STRING OPTIONS(description="Number of days from the date of birth (index date) to the date of an event (e.g. exposure to environmental factor, treatment start, etc.). If not applicable please enter 'Not Applicable'"),
  Colorectal_Polyp_Count STRING OPTIONS(description="The total number of polyps detected"),
  Family_Medical_History_Colorectal_Polyp_Diagnosis STRING OPTIONS(description="A yes/no/unknown/not applicable indicator related to family medical history diagnosis of polypoid lesion that arises from the colon or rectum and protrudes into the lumen."),
  Patient_Inflammatory_Bowel_Disease_Personal_Medica_History STRING OPTIONS(description="The indicator for patient's personal medical history of inflammatory bowel disease (chronic, non-specific disorders of unknown etiology, including Crohn disease and ulcerative colitis)."),
  Id STRING OPTIONS(description="Unique identifier of entity e.g. a96059eb-81af-4b24-ae50-9242c0d8f819"),
  HTAN_Center STRING OPTIONS(description="Name of HTAN Center e.g. HTAN HTAPP"),
  Manifest_Id STRING OPTIONS(description="Synapse ID of manifest containing file annotation"),
  Manifest_Version INT64 OPTIONS(description="Latest version of metadata manifest")
)
OPTIONS(
  friendly_name="HTAN CLINICAL TIER 3 DATA - COLORECTAL R5 VERSIONED",
  description="This table contains third-tier, colorectal clinical information about HTAN patient cases. Data was extracted from HTAN Synapse projects in April 2024 and corresponds to HTAN Data Release 5.1. More details: see https://data.humantumoratlas.org/standard/clinical",
  labels=[("access", "open"), ("data_type", "clinical_data"), ("program", "htan"), ("source", "htan"), ("category", "metadata"), ("status", "current")]
);

INSERT INTO `isb-cgc-bq.HTAN_versioned.clinical_tier3_colorectal_r5` (Timepoint_Label, Component, Stop_Days_from_Index, Family_Colon_Cancer_History_Indicator, History_of_Prior_Colon_Polyps, Colorectal_Cancer_Tumor_Border_Configuration, Immediate_Family_History_Ovarian_Cancer, MLH1_Promoter_Methylation_Status, Size_of_Polyp_Removed, Family_History_Colorectal_Polyp, Colorectal_Polyp_New_Indicator, Colorectal_Cancer_KRAS_Indicator, Colorectal_Polyp_Type, entityId, Colorectal_Cancer_Detection_Method_Type, Colorectal_Polyp_Adenoma_Type, Colon_Polyp_Occurence_Indicator, Colorectal_Polyp_Shape, Immediate_Family_History_Endometrial_Cancer, HTAN_Participant_ID, Patient_Colonoscopy_Performed_Indicator, Start_Days_from_Index, Colorectal_Polyp_Count, Family_Medical_History_Colorectal_Polyp_Diagnosis, Patient_Inflammatory_Bowel_Disease_Personal_Medica_History, Id, HTAN_Center, Manifest_Id, Manifest_Version) VALUES ('Pre-Enrollment', 'ColorectalCancerTier3', NULL, 'no', NULL, NULL, NULL, NULL, NULL, 'no', 'no', NULL, NULL, NULL, 'Colonoscopy', NULL, NULL, NULL, NULL, 'HTA11_14015', NULL, '20134', '0', NULL, NULL, 'd96ca25a-5f51-4f5c-8cb4-87847c3030bc', 'HTAN Vanderbilt', 'syn55158312', 2), ('Pre-Enrollment', 'ColorectalCancerTier3', NULL, 'no', NULL, NULL, NULL, NULL, NULL, 'no', 'no', NULL, NULL, NULL, 'Colonoscopy', NULL, NULL, NULL, NULL, 'HTA11_5216', NULL, '20347', '0', NULL, NULL, 'd207c8c7-a4e9-4111-bb3f-0b0980abd835', 'HTAN Vanderbilt', 'syn55158312', 2), ('Pre-Enrollment', 'ColorectalCancerTier3', NULL, 'no', NULL, NULL, NULL, NULL, NULL, 'no', 'no', NULL, NULL, NULL, 'Colonoscopy', NULL, NULL, NULL, NULL, 'HTA11_5216', NULL, '21482', '0', NULL, NULL, 'a30adc6f-c165-4923-8845-b926afcd48d6', 'HTAN Vanderbilt', 'syn55158312', 2), ('Pre-Enrollment', 'ColorectalCancerTier3', NULL, 'no', NULL, NULL, NULL, NULL, NULL, 'no', 'no', NULL, NULL, NULL, 'Colonoscopy', NULL, NULL, NULL, NULL, 'HTA11_6818', NULL, '19505', '0', NULL, NULL, 'ad211787-57ba-410a-9a68-ad368356270c', 'HTAN Vanderbilt', 'syn55158312', 2), ('Post-Enrollment', 'ColorectalCancerTier3', NULL, 'no', NULL, NULL, NULL, NULL, NULL, 'no', 'no', NULL, NULL, NULL, 'Colonoscopy', NULL, NULL, NULL, NULL, 'HTA11_8890', NULL, '19370', '0', NULL, NULL, 'dd0a866e-31b8-46fb-8958-d90abef33929', 'HTAN Vanderbilt', 'syn55158312', 2);