-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.srrs_clinical_tier2_r5`
(
  Days_to_Progression STRING OPTIONS(description="Number of days between the date used for index and the date the patient's disease progressed. If not applicable please enter 'Not Applicable'"),
  Last_Known_Disease_Status STRING OPTIONS(description="Text term that describes the last known state or condition of an individual's neoplasm."),
  Days_to_Last_Known_Disease_Status STRING OPTIONS(description="Time interval from the date of last follow up to the date of initial pathologic diagnosis, represented as a calculated number of days. If not applicable please enter 'Not Applicable'"),
  Year_of_Death STRING OPTIONS(description="Numeric value to represent the year of the death of an individual."),
  Progression_or_Recurrence_Type STRING OPTIONS(description="The text term used to describe the type of progressive or recurrent disease or relapsed disease."),
  Progression_or_Recurrence STRING OPTIONS(description="Yes/No/unknown indicator to identify whether a patient has had a new tumor event after initial treatment."),
  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"),
  Morphology STRING OPTIONS(description="The third edition of the International Classification of Diseases for Oncology, published in 2000 used principally in tumor and cancer registries for coding the site (topography) and the histology (morphology) of neoplasms. The study of the structure of the cells and their arrangement to constitute tissues and, finally, the association among these to form organs. In pathology, the microscopic process of identifying normal and abnormal morphologic characteristics in tissues, by employing various cytochemical and immunocytochemical stains. A system of numbered categories for representation of data."),
  Days_to_Progression_Free STRING OPTIONS(description="Number of days between the date used for index and the date the patient's disease was formally confirmed as progression-free. If not applicable please enter 'Not Applicable'"),
  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."),
  Race STRING OPTIONS(description="An arbitrary classification of a taxonomic group that is a division of a species. It usually arises as a consequence of geographical isolation withina a species and is characterized by shared heredity, physical attributes and behavior, and in the case of humans, by common history, nationality, or geographic distribution."),
  Site_of_Resection_or_Biopsy STRING OPTIONS(description="The text term used to describe the anatomic site of the resection or biopsy of the patient's malignant disease, as described by the World Health Organization's (WHO) International Classification of Diseases for Oncology (ICD-O)."),
  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'"),
  NCI_Atlas_Cancer_Site STRING OPTIONS(description="The primary tumor site used to calculate the incidence rate using the NCI Cancer Atlas, a digital atlas which provides geographical data related to cancer utilizing the Surveillance, Epidemiology, and End Results (SEER) Program cancer incidence rates for 2013 to 2017"),
  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."),
  Progression_or_Recurrence_Anatomic_Site STRING OPTIONS(description="The text term used to describe the anatomic site of resection; biopsy; tissue or organ of biospecimen origin; progression or recurrent disease; treatment"),
  Days_to_Death STRING OPTIONS(description="Number of days between the date used for index and the date from a person's date of death represented as a calculated number of days. If not applicable please enter 'Not Applicable'"),
  Age_at_Diagnosis STRING OPTIONS(description="Age at the time of diagnosis expressed in number of days since birth."),
  Ethnicity STRING OPTIONS(description="An individual's self-described social and cultural grouping, specifically whether an individual describes themselves as Hispanic or Latino. The provided values are based on the categories defined by the U.S. Office of Management and Business and used by the U.S. Census Bureau."),
  Cause_of_Death_Source STRING OPTIONS(description="The text term used to describe the source used to determine the patient's cause of death."),
  Treatment_Type STRING OPTIONS(description="Text term that describes the kind of treatment administered."),
  Tumor_Grade STRING OPTIONS(description="Numeric value to express the degree of abnormality of cancer cells, a measure of differentiation and aggressiveness."),
  Test_Result STRING OPTIONS(description="The text term used to describe the result of the molecular test. If the test result was a numeric value see test_value. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  Years_Smoked STRING OPTIONS(description="Numeric value (or unknown) to represent the number of years a person has been smoking."),
  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"),
  Days_to_Follow_Up STRING OPTIONS(description="Number of days between the date used for index and the date of the patient's last follow-up appointment or contact. If not applicable please enter 'Not Applicable'"),
  Vital_Status STRING OPTIONS(description="The survival state of the person registered on the protocol."),
  entityId STRING OPTIONS(description="Synapse ID of entity"),
  Primary_Diagnosis STRING OPTIONS(description="Text term used to describe the patient's histologic diagnosis, as described by the World Health Organization's (WHO) International Classification of Diseases for Oncology (ICD-O)."),
  Country_of_Birth STRING OPTIONS(description="Country where the patient was born."),
  Tumor_Largest_Dimension_Diameter STRING OPTIONS(description="Numeric value used to describe the maximum diameter or dimension of the primary tumor, measured in centimeters."),
  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."),
  Gender STRING OPTIONS(description="Text designations that identify gender. Gender is described as the assemblage of properties that distinguish people on the basis of their societal roles. [Identification of gender is based upon self-report and may come from a form, questionnaire, interview, etc.]"),
  Molecular_Analysis_Method STRING OPTIONS(description="The text term used to describe the method used for molecular analysis. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  Days_to_Recurrence STRING OPTIONS(description="Number of days between the date used for index and the date the patient's disease recurred. If not applicable please enter 'Not Applicable'"),
  HTAN_Participant_ID STRING OPTIONS(description="HTAN ID associated with a patient based on HTAN ID SOP (eg HTANx_yyy )"),
  Gene_Symbol STRING OPTIONS(description="The text term used to describe a gene targeted or included in molecular analysis. For rearrangements, this is should be used to represent the reference gene. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  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'"),
  Pack_Years_Smoked STRING OPTIONS(description="Numeric computed value to represent lifetime tobacco exposure defined as number of cigarettes smoked per day x number of years smoked divided by 20."),
  Tissue_or_Organ_of_Origin STRING OPTIONS(description="The text term used to describe the anatomic site of origin, of the patient's malignant disease, as described by the World Health Organization's (WHO) International Classification of Diseases for Oncology (ICD-O)."),
  Days_to_Last_Follow_up STRING OPTIONS(description="Time interval from the date of last follow up to the date of initial pathologic diagnosis, represented as a calculated number of days. If not applicable please enter 'Not Applicable'"),
  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)"),
  Cause_of_Death STRING OPTIONS(description="The cause of death"),
  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 SRRS CLINICAL TIER 2 DATA R5 VERSIONED",
  description="This table captures essential clinical second-tier data elements specific to SRRS (Standardized Repository of Reference Specimens) HTAN samples. HTAN 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/standards",
  labels=[("access", "open"), ("data_type", "clinical_data"), ("program", "htan"), ("source", "htan"), ("category", "clinical_biospecimen_data"), ("status", "current")]
);

INSERT INTO `isb-cgc-bq.HTAN_versioned.srrs_clinical_tier2_r5` (Days_to_Progression, Last_Known_Disease_Status, Days_to_Last_Known_Disease_Status, Year_of_Death, Progression_or_Recurrence_Type, Progression_or_Recurrence, Cancer_Incidence_Location, Morphology, Days_to_Progression_Free, Timepoint_Label, Component, Race, Site_of_Resection_or_Biopsy, Stop_Days_from_Index, NCI_Atlas_Cancer_Site, Cancer_Incidence, Progression_or_Recurrence_Anatomic_Site, Days_to_Death, Age_at_Diagnosis, Ethnicity, Cause_of_Death_Source, Treatment_Type, Tumor_Grade, Test_Result, Years_Smoked, Medically_Underserved_Area, Days_to_Follow_Up, Vital_Status, entityId, Primary_Diagnosis, Country_of_Birth, Tumor_Largest_Dimension_Diameter, Medically_Underserved_Score, Gender, Molecular_Analysis_Method, Days_to_Recurrence, HTAN_Participant_ID, Gene_Symbol, Start_Days_from_Index, Pack_Years_Smoked, Tissue_or_Organ_of_Origin, Days_to_Last_Follow_up, Id, Education_Level, Cause_of_Death, Rural_vs_Urban, HTAN_Center, Manifest_Id, Manifest_Version) VALUES (NULL, 'With tumor', '388', '2023.0', NULL, 'No', 'Douglas, Colorado', '2244842', NULL, 'Baseline', 'SRRSClinicalDataTier2', 'white', 'Lower lobe lung', NULL, NULL, '35.8', NULL, '27251.0', '26843', 'not hispanic or latino', NULL, 'Surgery, Chemotherapy', 'Not Reported', 'Negative', '15', 'Medically Underserved Area - No', '27230', 'Dead', NULL, 'Non-small cell carcinoma', NULL, '4.5cm', '60.8', 'male', 'IHC', 'Not Applicable', 'HTA15_30007', 'EGFR, KRAS, ALK', '26862', '7.5', 'Lower lobe lung', '388', '0766b753-2390-4231-989c-3e161aff5dac', 'Data not available', 'unknown', 'Urban Population (population >50000)', 'HTAN SRRS', 'syn51607133', 2), (NULL, 'unknown tumor status', '161', '2023.0', 'unknown', 'unknown', 'Archuleta, Colorado', '2253973', NULL, 'Baseline', 'SRRSClinicalDataTier2', 'white', 'Lower lobe lung', NULL, NULL, '31.9', 'unknown', '25108.0', '23882', 'not hispanic or latino', NULL, 'Surgery', 'G2', 'Not Applicable', '50', 'Medically Underserved Area - Yes', '24042', 'Dead', NULL, 'Squamous cell carcinoma NOS', NULL, '3.4cm', '50.1', 'male', 'Not Applicable', 'Not Applicable', 'HTA15_30001', 'Not Applicable', '24028', '100', 'Lower lobe lung', '161', '881485f9-4678-42d8-8e1b-f256372b9b8d', 'Data not available', 'unknown', 'Urban Cluster (population 2500 - 50000)', 'HTAN SRRS', 'syn51607133', 2), (NULL, 'Tumor free', '659', NULL, NULL, 'No', 'Arapahoe, Colorado', '2253608', NULL, 'Baseline', 'SRRSClinicalDataTier2', 'black or african american', 'Upper lobe lung', NULL, NULL, '45.1', NULL, NULL, '24639', 'not hispanic or latino', NULL, 'Surgery', 'G1', 'Not Applicable', '35', 'Medically Underserved Area - Yes', '25297', 'Alive', NULL, 'Squamous cell carcinoma NOS', NULL, '1.6cm', '58.1', 'female', 'Not Reported', 'Not Applicable', 'HTA15_30002', 'Not Applicable', '24685', '17.5', 'Upper lobe lung', '659', '09f16c0f-b20a-48d7-8281-b48a1a45cd1e', 'Data not available', 'Not Applicable', 'Urban Population (population >50000)', 'HTAN SRRS', 'syn51607133', 2), (NULL, 'unknown tumor status', '68', NULL, 'unknown', 'unknown', 'Adams, Colorado', '2254339', NULL, 'Baseline', 'SRRSClinicalDataTier2', 'white', 'Upper lobe lung', NULL, NULL, '51.5', 'unknown', NULL, '21238', 'not hispanic or latino', NULL, 'Surgery', 'G3', 'Positive', '30', 'Medically Underserved Area - Yes', '21305', 'Alive', NULL, 'Squamous cell carcinoma NOS', NULL, '2.5cm', '57.1', 'male', 'IHC', 'Not Applicable', 'HTA15_30005', 'EGFR, KRAS, BRAF, ERBB2, MET, TP53', '21277', 'Not Reported', 'Upper lobe lung', '68', '672737a2-dcd1-4768-8cb6-822131c904b5', 'Data not available', 'Not Applicable', 'Urban Population (population >50000)', 'HTAN SRRS', 'syn51607133', 2), (NULL, 'With tumor', '168', NULL, NULL, 'No', 'Middlesex, Massachusetts', '8140/3', NULL, 'Baseline', 'SRRSClinicalDataTier2', 'white', 'Rectosigmoid junction', NULL, NULL, '34.6', NULL, NULL, '22199', 'not hispanic or latino', NULL, 'Surgery', 'G2', 'Normal', '0', 'Medically Underserved Area - Yes', '22367', 'Alive', NULL, 'Adenocarcinoma NOS', NULL, '6.2cm', '61.9', 'male', 'IHC', '0', 'HTA15_51833', 'MLH1, MSH2, MSH6, PMS2', '22215', '0', 'Colon NOS', '168', 'a86d2eec-385e-4fab-9367-fb0fcc9bd251', 'Data not available', 'Not Applicable', 'Urban Population (population >50000)', 'HTAN SRRS', 'syn52799106', 4);