-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.clinical_tier3_lung_r3`
(
  Component STRING OPTIONS(description="Category of metadata (e.g. Diagnosis, Biospecimen, scRNA-seq Level 1, etc.); provide the same one for all items/rows."),
  HTAN_Participant_ID STRING OPTIONS(description="HTAN ID associated with a patient based on HTAN ID SOP (eg HTANx_yyy )"),
  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."),
  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'"),
  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'"),
  Lung_Cancer_Detection_Method_Type STRING OPTIONS(description="The means, manner of procedure, or systematic course of actions performed in order to discover or identify lung cancer"),
  Lung_Cancer_Participant_Procedure_History STRING OPTIONS(description="Text name of a surgical or operative procedure used in a natural history protocol of a lung cancer participant."),
  Lung_Adjacent_Histology_Type STRING OPTIONS(description="The type of morphologic characteristics observed by microscope in the tissue next to a benign or malignant tissue growth"),
  Lung_Tumor_Location_Anatomic_Site STRING OPTIONS(description="Anatomic location of the tumor inside the lung"),
  Lung_Tumor_Lobe_Bronchial_Location STRING OPTIONS(description="Anatomic lobe and bronchial location of the tumor inside the lung"),
  Current_Lung_Cancer_Symptoms STRING OPTIONS(description="Reported lung cancer related symptoms person is currently experiencing"),
  Lung_Topography STRING OPTIONS(description="Lung PCA specific topography (not covered in previous tiers)"),
  Lung_Cancer_Harboring_Genomic_Aberrations STRING OPTIONS(description="Genomic aberrations in participants with lung cancer (specific lung cancer associated gene mutations not covered in Tiers 1 and 2)"),
  entityId STRING OPTIONS(description="Synapse ID of entity"),
  HTAN_Center STRING OPTIONS(description="Name of HTAN Center e.g. HTAN HTAPP"),
  Data_Release STRING OPTIONS(description="Inclusion in HTAN Data Release e.g. Release 1.0"),
  Manifest_Version INT64 OPTIONS(description="Latest version of metadata manifest"),
  Uuid STRING OPTIONS(description="Unique identifier of entity e.g. a96059eb-81af-4b24-ae50-9242c0d8f819")
)
OPTIONS(
  friendly_name="HTAN CLINICAL TIER 3 DATA - LUNG R3 VERSIONED",
  description="This table contains third-tier, lung 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 2023. 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_tier3_lung_r3` (Component, HTAN_Participant_ID, Timepoint_Label, Start_Days_from_Index, Stop_Days_from_Index, Lung_Cancer_Detection_Method_Type, Lung_Cancer_Participant_Procedure_History, Lung_Adjacent_Histology_Type, Lung_Tumor_Location_Anatomic_Site, Lung_Tumor_Lobe_Bronchial_Location, Current_Lung_Cancer_Symptoms, Lung_Topography, Lung_Cancer_Harboring_Genomic_Aberrations, entityId, HTAN_Center, Data_Release, Manifest_Version, Uuid) VALUES ('LungCancerTier3', 'HTA3_8002', 'baseline', '0', NULL, NULL, 'Lobectomy Left', NULL, 'Left', 'Upper lobe', NULL, NULL, NULL, 'syn24994797', 'HTAN BU', 'Release 2.0', 2, 'becc2e14-7d72-4ac1-8027-31f6561a3c90'), ('LungCancerTier3', 'HTA3_8005', 'baseline', '0', NULL, NULL, 'Lobectomy Left', NULL, 'Left', 'Upper lobe', NULL, NULL, NULL, 'syn24994800', 'HTAN BU', 'Release 2.0', 2, '57a9ca13-540a-4f49-a6a3-4940ca26cb74'), ('LungCancerTier3', 'HTA3_8006', 'baseline', '0', NULL, NULL, 'Lobectomy Left', NULL, 'Left', 'Upper lobe', NULL, NULL, NULL, 'syn24994801', 'HTAN BU', 'Release 2.0', 2, 'b7c64ec5-987e-4604-9dfa-f3d179191c6c'), ('LungCancerTier3', 'HTA3_8001', 'baseline', '0', NULL, NULL, 'Lobectomy Right', NULL, 'Right', 'Lower lobe', NULL, NULL, NULL, 'syn24994796', 'HTAN BU', 'Release 2.0', 2, '5b9f5040-f56a-4749-be40-7ce22e9bfa12'), ('LungCancerTier3', 'HTA3_8003', 'baseline', '0', NULL, NULL, 'Lobectomy Right', NULL, 'Right', 'Upper lobe', NULL, NULL, NULL, 'syn24994798', 'HTAN BU', 'Release 2.0', 2, 'e6689588-8231-4dc1-bbec-d85d51ba07b1');