-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.clinical_tier1_demographics_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 )"),
  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."),
  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.]"),
  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."),
  Vital_Status STRING OPTIONS(description="The survival state of the person registered on the protocol."),
  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'"),
  Country_of_Residence STRING OPTIONS(description="Country of Residence at enrollment"),
  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."),
  Year_Of_Birth STRING OPTIONS(description="Numeric value to represent the calendar year in which an individual was born."),
  Occupation_Duration_Years STRING OPTIONS(description="The number of years a patient worked in a specific occupation."),
  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."),
  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."),
  Year_of_Death STRING OPTIONS(description="Numeric value to represent the year of the death of an individual."),
  Age_at_Index STRING OPTIONS(description="For GDC submission only - this is going to be always 0 since HTAN's index is the date of birth"),
  Cause_of_Death STRING OPTIONS(description="The cause of death"),
  Cause_of_Death_Source STRING OPTIONS(description="The text term used to describe the source used to determine the patient's cause of death."),
  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'"),
  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 1 DATA - DEMOGRAPHICS R3 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 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_tier1_demographics_r3` (Component, HTAN_Participant_ID, Ethnicity, Gender, Race, Vital_Status, Days_to_Birth, Country_of_Residence, Age_Is_Obfuscated, Year_Of_Birth, Occupation_Duration_Years, Premature_At_Birth, Weeks_Gestation_at_Birth, Year_of_Death, Age_at_Index, Cause_of_Death, Cause_of_Death_Source, Days_to_Death, entityId, HTAN_Center, Data_Release, Manifest_Version, Uuid) VALUES ('Demographics', 'HTA7_985', 'hispanic or latino', 'male', 'Other', 'Alive', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn26707337', 'HTAN HMS', 'Release 2.0', 5, 'fc08e4ab-bbc6-4783-9acf-a77d13d04498'), ('Demographics', 'HTA7_983', 'not hispanic or latino', 'female', 'asian', 'Dead', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2018.0', NULL, 'Cancer Related', 'Cancer Related', NULL, 'syn26707335', 'HTAN HMS', 'Release 2.0', 5, '23f8005c-cdf7-4519-b4d5-43b4f9b84df5'), ('Demographics', 'HTA7_934', 'not hispanic or latino', 'male', 'white', 'Dead', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2017.0', NULL, 'Cancer Related', 'Cancer Related', NULL, 'syn26546564', 'HTAN HMS', 'Release 2.0', 5, '33ebf208-dae4-413a-a4bf-7f303979ffa3'), ('Demographics', 'HTA7_947', 'not hispanic or latino', 'male', 'white', 'Dead', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2017.0', NULL, 'Cancer Related', 'Cancer Related', NULL, 'syn26546566', 'HTAN HMS', 'Release 2.0', 5, 'e092ff0e-a628-46f5-bccf-19aa2ec0dcce'), ('Demographics', 'HTA7_989', 'not hispanic or latino', 'male', 'white', 'Dead', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2018.0', NULL, 'Cancer Related', 'Cancer Related', NULL, 'syn26546567', 'HTAN HMS', 'Release 2.0', 5, 'b136ed16-9bfd-4afd-8181-9f583ce6c63c');