-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.clinical_tier1_demographics_r5`
(
  Year_of_Death STRING OPTIONS(description="Numeric value to represent the year of the death of an individual."),
  Premature_At_Birth STRING OPTIONS(description="The yes/no/unknown indicator used to describe whether the patient was premature (less than 37 weeks gestation) at birth."),
  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."),
  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'"),
  Year_Of_Birth STRING OPTIONS(description="Numeric value to represent the calendar year in which an individual was born."),
  Days_to_Birth STRING OPTIONS(description="Number of days between the date used for index and the date from a person's date of birth represented as a calculated negative number of days. If not applicable please enter 'Not Applicable'"),
  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."),
  Occupation_Duration_Years STRING OPTIONS(description="The number of years a patient worked in a specific occupation."),
  Weeks_Gestation_at_Birth STRING OPTIONS(description="Numeric value used to describe the number of weeks starting from the approximate date of the biological mother's last menstrual period and ending with the birth of the patient."),
  Vital_Status STRING OPTIONS(description="The survival state of the person registered on the protocol."),
  Country_of_Residence STRING OPTIONS(description="Country of Residence at enrollment"),
  entityId STRING OPTIONS(description="Synapse ID of entity"),
  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.]"),
  Age_Is_Obfuscated STRING OPTIONS(description="The age of the patient has been modified for compliance reasons. The actual age differs from what is reported. Other date intervals for this patient may also be modified."),
  HTAN_Participant_ID STRING OPTIONS(description="HTAN ID associated with a patient based on HTAN ID SOP (eg HTANx_yyy )"),
  Id STRING OPTIONS(description="Unique identifier of entity e.g. a96059eb-81af-4b24-ae50-9242c0d8f819"),
  Cause_of_Death STRING OPTIONS(description="The cause of death"),
  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 - DEMOGRAPHICS R5 VERSIONED",
  description="This table contains demographic 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_demographics_r5` (Year_of_Death, Premature_At_Birth, Component, Race, Days_to_Death, Year_Of_Birth, Days_to_Birth, Ethnicity, Cause_of_Death_Source, Occupation_Duration_Years, Weeks_Gestation_at_Birth, Vital_Status, Country_of_Residence, entityId, Gender, Age_Is_Obfuscated, HTAN_Participant_ID, Id, Cause_of_Death, HTAN_Center, Manifest_Id, Manifest_Version) VALUES (NULL, 'Not Reported', 'Demographics', 'Other', NULL, '1959.0', '0', 'not hispanic or latino', 'Not Reported', NULL, NULL, 'Alive', NULL, NULL, 'female', NULL, 'HTA11_347', '301e179a-ed59-45b0-ab13-f0ea2a2da1d3', 'Not Reported', 'HTAN Vanderbilt', 'syn38868669', 9), ('Not Reported', 'unknown', 'Demographics', 'american indian or alaska native', NULL, NULL, '0', 'not hispanic or latino', 'Medical Record', NULL, NULL, 'Dead', NULL, 'syn29422471', 'female', 'False', 'HTA9_15', '15044263-4a75-4a78-a70c-371121b80d06', 'Not Reported', 'HTAN OHSU', 'syn39141967', 9), (NULL, NULL, 'Demographics', 'Other', NULL, NULL, NULL, 'hispanic or latino', NULL, NULL, NULL, 'Alive', NULL, 'syn26707337', 'male', NULL, 'HTA7_985', 'fc08e4ab-bbc6-4783-9acf-a77d13d04498', NULL, 'HTAN HMS', 'syn39143312', 5), ('0.0', 'Not Reported', 'Demographics', 'other', '17399.0', NULL, '0', 'hispanic or latino', 'Death Certificate', NULL, NULL, 'Dead', NULL, NULL, 'Male', 'False', 'HTA3_80018', '6b3f77b5-34ef-4a25-af01-e4ac599a3368', 'Cancer Related', 'HTAN BU', 'syn39147270', 19), (NULL, 'Not Reported', 'Demographics', 'american indian or alaska native', NULL, NULL, '0', 'not hispanic or latino', NULL, NULL, NULL, 'Alive', NULL, NULL, 'Male', 'False', 'HTA3_10094', '658ce6bb-95f7-4539-a89b-146b21538f76', 'Not Applicable', 'HTAN BU', 'syn39147270', 19);