-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.clinical_tier1_exposure_r5`
(
  Smoke_Exposure_Duration STRING OPTIONS(description="Text term used to describe the length of time the patient was exposed to an environmental factor."),
  Type_of_Tobacco_Used STRING OPTIONS(description="The text term used to describe the specific type of tobacco used by the patient."),
  Component STRING OPTIONS(description="Category of metadata (e.g. Diagnosis, Biospecimen, scRNA-seq Level 1, etc.); provide the same one for all items/rows."),
  Alcohol_Type STRING OPTIONS(description="Type of alcohol use"),
  Alcohol_Intensity STRING OPTIONS(description="Category to describe the patient's current level of alcohol use as self-reported by the patient."),
  Respirable_Crystalline_Silica_Exposure STRING OPTIONS(description="The yes/no/unknown indicator used to describe whether a patient was exposured to respirable crystalline silica, a widespread, naturally occurring, crystalline metal oxide that consists of different forms including quartz, cristobalite, tridymite, tripoli, ganister, chert and novaculite."),
  Smokeless_Tobacco_Quit_Age STRING OPTIONS(description="Smokeless tobacco quit age"),
  Type_of_Smoke_Exposure STRING OPTIONS(description="The text term used to describe the patient's specific type of smoke exposure."),
  Years_Smoked STRING OPTIONS(description="Numeric value (or unknown) to represent the number of years a person has been smoking."),
  Alcohol_Exposure STRING OPTIONS(description="Indicate if individual has alcohol exposure"),
  Coal_Dust_Exposure STRING OPTIONS(description="The yes/no/unknown indicator used to describe whether a patient was exposed to fine powder derived by the crushing of coal."),
  Smoking_Frequency STRING OPTIONS(description="The text term used to generally decribe how often the patient smokes."),
  entityId STRING OPTIONS(description="Synapse ID of entity"),
  Time_between_Waking_and_First_Smoke STRING OPTIONS(description="The text term used to describe the approximate amount of time elapsed between the time the patient wakes up in the morning to the time they smoke their first cigarette."),
  Alcohol_Drinks_Per_Day STRING OPTIONS(description="Numeric value used to describe the average number of alcoholic beverages a person consumes per day."),
  Cigarettes_per_Day STRING OPTIONS(description="The average number of cigarettes smoked per day."),
  HTAN_Participant_ID STRING OPTIONS(description="HTAN ID associated with a patient based on HTAN ID SOP (eg HTANx_yyy )"),
  Smoking_Exposure STRING OPTIONS(description="Indicate if individual has smoking exposure"),
  Tobacco_Smoking_Status STRING OPTIONS(description="Category describing current smoking status and smoking history as self-reported by a 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'"),
  Radon_Exposure STRING OPTIONS(description="The yes/no/unknown indicator used to describe whether the patient was exposed to radon."),
  Environmental_Tobacco_Smoke_Exposure STRING OPTIONS(description="The yes/no/unknown indicator used to describe whether a patient was exposed to smoke that is emitted from burning tobacco, including cigarettes, pipes, and cigars. This includes tobacco smoke exhaled by smokers."),
  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."),
  Tobacco_Smoking_Onset_Year STRING OPTIONS(description="The year in which the participant began smoking."),
  Id STRING OPTIONS(description="Unique identifier of entity e.g. a96059eb-81af-4b24-ae50-9242c0d8f819"),
  Alcohol_History STRING OPTIONS(description="A response to a question that asks whether the participant has consumed at least 12 drinks of any kind of alcoholic beverage in their lifetime."),
  Asbestos_Exposure STRING OPTIONS(description="The yes/no/unknown indicator used to describe whether the patient was exposed to asbestos."),
  Tobacco_Use_per_Day STRING OPTIONS(description="Numeric value that represents the number of times the patient uses tobacco each day."),
  Tobacco_Smoking_Quit_Year STRING OPTIONS(description="The year in which the participant quit smoking."),
  Alcohol_Days_Per_Week STRING OPTIONS(description="Numeric value used to describe the average number of days each week that a person consumes an alcoholic beverage."),
  Secondhand_Smoke_as_Child STRING OPTIONS(description="The text term used to indicate whether the patient was exposed to secondhand smoke as a child."),
  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 1 DATA - EXPOSURE R5 VERSIONED",
  description="This table contains environmental exposure clinical information about HTAN patient cases based on the NCI Genomic Data Commons (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_tier1_exposure_r5` (Smoke_Exposure_Duration, Type_of_Tobacco_Used, Component, Alcohol_Type, Alcohol_Intensity, Respirable_Crystalline_Silica_Exposure, Smokeless_Tobacco_Quit_Age, Type_of_Smoke_Exposure, Years_Smoked, Alcohol_Exposure, Coal_Dust_Exposure, Smoking_Frequency, entityId, Time_between_Waking_and_First_Smoke, Alcohol_Drinks_Per_Day, Cigarettes_per_Day, HTAN_Participant_ID, Smoking_Exposure, Tobacco_Smoking_Status, Start_Days_from_Index, Radon_Exposure, Environmental_Tobacco_Smoke_Exposure, Pack_Years_Smoked, Tobacco_Smoking_Onset_Year, Id, Alcohol_History, Asbestos_Exposure, Tobacco_Use_per_Day, Tobacco_Smoking_Quit_Year, Alcohol_Days_Per_Week, Secondhand_Smoke_as_Child, HTAN_Center, Manifest_Id, Manifest_Version) VALUES (NULL, NULL, 'Exposure', NULL, NULL, NULL, NULL, NULL, NULL, 'Not Reported', NULL, NULL, 'syn25882923', NULL, NULL, NULL, 'HTA1_331', 'No - Smoking Exposure', NULL, 'Not Reported', NULL, 'No', NULL, NULL, 'ee56d275-90cd-4fed-97d9-607b5118031c', NULL, NULL, NULL, NULL, NULL, NULL, 'HTAN HTAPP', 'syn42236049', 1), (NULL, NULL, 'Exposure', NULL, NULL, NULL, NULL, NULL, NULL, 'Not Reported', NULL, NULL, 'syn26486560', NULL, NULL, NULL, 'HTA7_1', 'Not Reported', NULL, '0', NULL, NULL, NULL, NULL, '5291c9d3-19cd-457a-bb64-6306557a0458', NULL, NULL, NULL, NULL, NULL, NULL, 'HTAN HMS', 'syn39143395', 5), (NULL, NULL, 'Exposure', NULL, NULL, NULL, NULL, NULL, 'Not Reported', 'Not Reported', NULL, NULL, 'syn26486561', NULL, NULL, NULL, 'HTA7_6', 'Yes - Smoking Exposure', NULL, '0', NULL, NULL, '0.375', NULL, '89614bfa-f42e-43a5-93f4-21fc0baf89f1', NULL, NULL, NULL, NULL, NULL, NULL, 'HTAN HMS', 'syn39143395', 5), (NULL, NULL, 'Exposure', NULL, NULL, NULL, NULL, NULL, NULL, 'Not Reported', NULL, NULL, 'syn26486562', NULL, NULL, NULL, 'HTA7_8', 'Not Reported', NULL, '0', NULL, NULL, NULL, NULL, '74a7adc1-7d5c-4ad6-9dd7-8707045a9d73', NULL, NULL, NULL, NULL, NULL, NULL, 'HTAN HMS', 'syn39143395', 5), (NULL, NULL, 'Exposure', NULL, NULL, NULL, NULL, NULL, 'Not Reported', 'Not Reported', NULL, NULL, 'syn26486563', NULL, NULL, NULL, 'HTA7_10', 'Yes - Smoking Exposure', NULL, '0', NULL, NULL, '2.0', NULL, 'bb8075b8-6170-4e67-9641-5f67a9fb6d98', NULL, NULL, NULL, NULL, NULL, NULL, 'HTAN HMS', 'syn39143395', 5);