-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.clinical_tier2_r5`
(
  COVID19_Current_Status STRING OPTIONS(description="The patient's current COVID-19 status of sign or symptom events or interventions"),
  Cancer_Incidence_Location STRING OPTIONS(description="The county and state in which the patient lives and to which the cancer_incidence data correlates. Record as \"County, State\" as they appear in the incidence box from which the cancer_incidence data is obtained in the https://gis.cancer.gov/canceratlas/tableview/ website"),
  COVID19_Occurrence_Indicator STRING OPTIONS(description="The indicator that describes whether or not a COVID-19 infectious disorder occurred."),
  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."),
  COVID19_Positive_Lab_Test_Indicator STRING OPTIONS(description="The indicator that describes whether or not there was a COVID-19 positive test result."),
  Component STRING OPTIONS(description="Category of metadata (e.g. Diagnosis, Biospecimen, scRNA-seq Level 1, etc.); provide the same one for all items/rows."),
  Lab_Tests_for_MMR_Status STRING OPTIONS(description="Laboratory tests used to evaluate the status of mismatch repair pathways"),
  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'"),
  Cancer_Incidence STRING OPTIONS(description="Incidence of specific cancer type in a defined area (a number between 0 and 100). The rate of incident cases per population of 100,000 persons of a specific type of cancer as designated in the \"primary_diagnosis\" data element in the county where the patient resides, using the most recent 2013-2017 NCI Cancer Atlas derived data.  Use patient zip code to find the county the patient lives in by going to https://www.unitedstateszipcodes.org/. Enter the zip code in the main text field and use the asociated county on the right side of the result field. On the https://gis.cancer.gov/canceratlas/tableview/ website, choose \"Incidence\" from the Topic dropdown menu, state of interest from the Area menu, \"All Races\" from the Race menu, and the cancer type (\"Both Sexes\" when possible) from the Statistic menu. Find the county of interest and enter the numeric Age-Adjusted Rate per 100,000 as the value."),
  Sentinel_Node_Positive_Assessment_Count STRING OPTIONS(description="The number or amount of metastatic neoplasms related to the confirmed presence of disease or specific microorganisms during examination of the first rounded mass of lymphatic tissue to which cancer is likely to spread from the primary tumor."),
  Ecig_vape_times_per_day STRING OPTIONS(description="e-cig frequency of use (times per day—one “time” consists of around 15 puffs or lasts around 10 minutes)"),
  Known_Genetic_Predisposition_Mutation STRING OPTIONS(description="A yes/no/unknown indicator to identify whether there is a known genetic predisposition mutation present in the patient."),
  COVID19_Cancer_Treatment_Followup STRING OPTIONS(description="Indicator that describes if cancer treatment was modified for the patient due to COVID-19 infectious disorder"),
  Prior_Sites_of_Radiation STRING OPTIONS(description="The anatomic location to which radiation treatment was administered to a patient prior to enrollment on a protocol."),
  Mutational_Signatures STRING OPTIONS(description="Mutational signatures identified in the patient, includes signatures linked to selected exogenous carcinogens, endogenous and enzymatic modification of DNA or defective DNA repair. Note: Include only outputs of tests that were completed clinically for the participant and only include data from a diagnostic array that was completed prior to research sequencing was done. "),
  Hereditary_Cancer_Predisposition_Syndrome STRING OPTIONS(description="History of presence of inherited genetic predisposition syndrome that confers heightened susceptibility to cancer in the patient."),
  COVID19_Antibody_Testing STRING OPTIONS(description="Text term that demonstrates the test results of immunoglobulin M (IgM) and immunoglobulin G (IgG) antibodies to the SARS-CoV-2 virus in subject serum samples."),
  Sentinel_Lymph_Node_Count STRING OPTIONS(description="Numeric count of sentinel lymph nodes."),
  COVID19_Complications_Severity STRING OPTIONS(description="Text term that retrospectively indicates the worst complications during COVID-19 infectious disorder in the patient."),
  Satellite_Metastasis_Present_Indicator STRING OPTIONS(description="A yes/no indicator to ask if intransit metastases or satellite lesions are present."),
  Concomitant_Medication_Received_Type STRING OPTIONS(description="An enumerated list of the type of concomitant medication received by the patient."),
  Medically_Underserved_Area STRING OPTIONS(description="Areas or populations designated by HRSA as having too few primary care providers, high infant mortality, high poverty or a high elderly population:  Use patient zip code to find the county the patient lives in by going to https://www.unitedstateszipcodes.org/ - enter the zip code in the main text field and use the associated county on the right side of the result field. Go to data.hrsa.gov website and select \"Query Data\". Pick the Medically Underserved Areas/Populations (MUA/P) data source in the step 1 menu and select \"View Data\". Enter the name of the county (_______ county) in the first \"Service Area\" column, adding the state in the 5th column may help direct you to the data.  If the designation type in the third column is \"medically underserved area\" enter \"Yes\" as the value. If the county generates a \"No data available in table\" enter \"No\" as the value.  A value of \"Unknown\" indicates that sufficient data was not available to look up the value.  If value is yes, complete the Medically_underserved_score d"),
  Family_Member_Vital_Status_Indicator STRING OPTIONS(description="The response indicates whether the family member of the patient with a history of cancer is alive. (Extension to GDC attributes in Family History Tier 1)"),
  Tumor_Extranodal_Extension_Indicator STRING OPTIONS(description="The indicator to determine extranodal involvement or extent of the disease."),
  entityId STRING OPTIONS(description="Synapse ID of entity"),
  Medically_Underserved_Score STRING OPTIONS(description="Index of Medical Underservice (IMU) score, a number between 0 and 100, where 0 represents completely underserved and 100 represents best served or least underserved. Use patient zip code to find the county the patient lives in by going to https://www.unitedstateszipcodes.org/. Enter the zip code in the main text field and use the asociated county on the right side of the result field. Go to data.hrsa.gov website and select Query Data. Pick the Medically Underserved Areas/Populations (MUA/P) data source in the step 1 menu and select View Data. Enter the name of the county (______ county) in the first \"Service Area\" column, adding the state in the 5th column may help direct you to the data. Enter the Index of Medical Underservice Score in the fourth column to one decimal place as the value."),
  Country_of_Birth STRING OPTIONS(description="Country where the patient was born."),
  Second_hand_smoke_exposure_years STRING OPTIONS(description="The number of cumulative years of the patient's exposure to second-hand cigarette smoke"),
  Cancer_Associated_Gene_Mutations STRING OPTIONS(description="Type of inherited germline or other gene mutations that confers heightened susceptibility to cancer identified in patient history"),
  HTAN_Participant_ID STRING OPTIONS(description="HTAN ID associated with a patient based on HTAN ID SOP (eg HTANx_yyy )"),
  Ecig_vape_30_day_use_num STRING OPTIONS(description="Number of days e-cigarettes or vaping device was used in the last 30 days"),
  Type_of_smoke_exposure_cumulative_years STRING OPTIONS(description="The number of cumulative years of the patient's specific type of smoke exposure"),
  Extent_of_Tumor_Resection STRING OPTIONS(description="The degree to which the lesion has been cut out, or resected."),
  Other_Biopsy_Resection_Site STRING OPTIONS(description="A description of the location on or within the human body where the surgical biopsy/resection procedure was performed (Not covered under HTAN Clinical Data Tier 1)"),
  Mismatch_Repair_System_Status STRING OPTIONS(description="The text that best describes the condition or state of MMR (mismatch repair system) in the patient"),
  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'"),
  Chewing_tobacco_daily_use_count STRING OPTIONS(description="The quantity of daily use of tobacco, in the form of a plug, usually flavored, for chewing rather than smoking."),
  Immunosuppression STRING OPTIONS(description="The indicator that describes whether or not immunosuppressive therapy was administered."),
  Mode_of_Cancer_Detection STRING OPTIONS(description="Text term used to describe the mode of cancer detection, like standard of care screening or random detection"),
  Id STRING OPTIONS(description="Unique identifier of entity e.g. a96059eb-81af-4b24-ae50-9242c0d8f819"),
  Education_Level STRING OPTIONS(description="Highest level of education that the patient completed (direct patient-derived information)"),
  Ecig_vape_use STRING OPTIONS(description="Use of non-traditional cigarette nicotine delivery device (electronic cigarette, ENDS - electronic nicotine delivery system)"),
  Rural_vs_Urban STRING OPTIONS(description="Density of population in the county of residence, based on census data (updated last on 4/28/20). Use patient zip code to find the county the patient lives in by going to https://www.unitedstateszipcodes.org/. Enter the zip code in the main text field and use the associated county on the right side of the result field. Go to https://www2.census.gov/programs-surveys/acs/data/covid_19/Data_Profiles_for_HHS/050-County_By_State/. Select the dp02_XX.csv file where XX = the two letter abbreviation for the appropriate state. On row 166 find the total population for the appropriate county.  If the total population is <2,500 enter a value of \"Rural Population\"; if 2,500 - 50,000 enter a value of \"Urban Cluster\"; or if >50,000 enter \"Urban Population\""),
  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 2 DATA R5 VERSIONED",
  description="This table contains second tier clinical information about HTAN patient cases, specifically disease-agnostic extensions to the GDC clinical data model. 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", "clinical_biospecimen_data"), ("status", "current")]
);

INSERT INTO `isb-cgc-bq.HTAN_versioned.clinical_tier2_r5` (COVID19_Current_Status, Cancer_Incidence_Location, COVID19_Occurrence_Indicator, Timepoint_Label, COVID19_Positive_Lab_Test_Indicator, Component, Lab_Tests_for_MMR_Status, Stop_Days_from_Index, Cancer_Incidence, Sentinel_Node_Positive_Assessment_Count, Ecig_vape_times_per_day, Known_Genetic_Predisposition_Mutation, COVID19_Cancer_Treatment_Followup, Prior_Sites_of_Radiation, Mutational_Signatures, Hereditary_Cancer_Predisposition_Syndrome, COVID19_Antibody_Testing, Sentinel_Lymph_Node_Count, COVID19_Complications_Severity, Satellite_Metastasis_Present_Indicator, Concomitant_Medication_Received_Type, Medically_Underserved_Area, Family_Member_Vital_Status_Indicator, Tumor_Extranodal_Extension_Indicator, entityId, Medically_Underserved_Score, Country_of_Birth, Second_hand_smoke_exposure_years, Cancer_Associated_Gene_Mutations, HTAN_Participant_ID, Ecig_vape_30_day_use_num, Type_of_smoke_exposure_cumulative_years, Extent_of_Tumor_Resection, Other_Biopsy_Resection_Site, Mismatch_Repair_System_Status, Start_Days_from_Index, Chewing_tobacco_daily_use_count, Immunosuppression, Mode_of_Cancer_Detection, Id, Education_Level, Ecig_vape_use, Rural_vs_Urban, HTAN_Center, Manifest_Id, Manifest_Version) VALUES (NULL, NULL, NULL, 'resection initial', NULL, 'ClinicalDataTier2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Yes', NULL, NULL, NULL, NULL, 'syn25882759', NULL, NULL, NULL, NULL, 'HTA1_261', NULL, NULL, 'Gross Total Resection', 'brain right frontal lobe', NULL, '31054', NULL, NULL, NULL, '3ff3e0be-714b-49c7-b6ee-0945caf180f2', NULL, NULL, NULL, 'HTAN HTAPP', 'syn42242137', 1), (NULL, NULL, NULL, 'resection recurrence', NULL, 'ClinicalDataTier2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Yes', NULL, NULL, NULL, NULL, 'syn25882760', NULL, NULL, NULL, NULL, 'HTA1_261', NULL, NULL, 'Optimal debulking', 'brain left temporal lobe', NULL, '31414', NULL, NULL, NULL, '513e3d3f-d236-4010-8509-d4e5b8bc87dc', NULL, NULL, NULL, 'HTAN HTAPP', 'syn42242137', 1), (NULL, NULL, NULL, 'resection recurrence', NULL, 'ClinicalDataTier2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Yes', NULL, NULL, NULL, NULL, 'syn25882764', NULL, NULL, NULL, NULL, 'HTA1_293', NULL, NULL, 'Subtotal Resection', 'brain left frontal lobe', NULL, '27183', NULL, NULL, NULL, '56b20b0c-5169-475c-afb2-7fd119d71aa1', NULL, NULL, NULL, 'HTAN HTAPP', 'syn42242137', 1), (NULL, NULL, NULL, 'radiation timepoint 1', NULL, 'ClinicalDataTier2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Brain', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn25882758', NULL, NULL, NULL, NULL, 'HTA1_261', NULL, NULL, NULL, NULL, NULL, '31085', NULL, NULL, NULL, 'd88f0893-2b0e-4f52-9aa7-c5fb1cac3af5', NULL, NULL, NULL, 'HTAN HTAPP', 'syn42242137', 1), (NULL, NULL, NULL, 'radiation timepoint 1', NULL, 'ClinicalDataTier2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Mantle', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn25882772', NULL, NULL, NULL, NULL, 'HTA1_415', NULL, NULL, NULL, NULL, NULL, '9300', NULL, NULL, NULL, 'e18bb03b-edea-4621-b5cb-1fe0e4cbe315', NULL, NULL, NULL, 'HTAN HTAPP', 'syn42242137', 1);