From 77e4f110f1e70494b9d37f764cdfb5fcafafc905 Mon Sep 17 00:00:00 2001 From: SanjeevLakhwani Date: Thu, 30 Jan 2025 08:39:27 -0500 Subject: [PATCH] Split up individual.ts Split up individual.ts --- src/js/features/reference/types.ts | 2 +- src/js/types/clinphen/experiments.ts | 37 ++++++ src/js/types/{ => clinphen}/ontology.ts | 0 src/js/types/clinphen/phenopackets.ts | 31 +++++ src/js/types/clinphen/resources.ts | 97 +++++++++++++++ src/js/types/individual.ts | 156 +----------------------- 6 files changed, 169 insertions(+), 154 deletions(-) create mode 100644 src/js/types/clinphen/experiments.ts rename src/js/types/{ => clinphen}/ontology.ts (100%) create mode 100644 src/js/types/clinphen/phenopackets.ts create mode 100644 src/js/types/clinphen/resources.ts diff --git a/src/js/features/reference/types.ts b/src/js/features/reference/types.ts index 656957a2..6b3e7a8d 100644 --- a/src/js/features/reference/types.ts +++ b/src/js/features/reference/types.ts @@ -1,4 +1,4 @@ -import type { OntologyTerm } from '@/types/ontology'; +import type { OntologyTerm } from '@/types/clinphen/ontology'; // See also: https://github.com/bento-platform/bento_reference_service/blob/main/bento_reference_service/models.py diff --git a/src/js/types/clinphen/experiments.ts b/src/js/types/clinphen/experiments.ts new file mode 100644 index 00000000..e88d98ac --- /dev/null +++ b/src/js/types/clinphen/experiments.ts @@ -0,0 +1,37 @@ +import type { OntologyTerm } from '@/types/clinphen/ontology'; +import type { Instrument } from '@/types/clinphen/resources'; + +type ExperimentResult = { + id: number; + identifier: string; + description: string; + filename: string; + url: string; + genome_assembly_id: string; + file_format: string; + data_output_type: string; + creation_date: string; + created: string; + updated: string; +}; + +export type Experiment = { + id: string; + experiment_results?: ExperimentResult[]; + instrument: Instrument; + biosample_individual: { + id: string; + }; + study_type: string; + experiment_type: string; + experiment_ontology: OntologyTerm[]; + molecule?: string; + molecule_ontology?: OntologyTerm[]; + library_strategy?: string; + library_source?: string; + library_selection?: string; + created: string; + updated: string; + biosample: string; + dataset: string; +}; diff --git a/src/js/types/ontology.ts b/src/js/types/clinphen/ontology.ts similarity index 100% rename from src/js/types/ontology.ts rename to src/js/types/clinphen/ontology.ts diff --git a/src/js/types/clinphen/phenopackets.ts b/src/js/types/clinphen/phenopackets.ts new file mode 100644 index 00000000..29f5433b --- /dev/null +++ b/src/js/types/clinphen/phenopackets.ts @@ -0,0 +1,31 @@ +import type { OntologyTerm } from '@/types/clinphen/ontology'; +import type { + Biosample, + Disease, + Interpretation, + Measurement, + MedicalAction, + MetaData, +} from '@/types/clinphen/resources'; + +type PhenotypicFeature = { + type: OntologyTerm; + created: string; + updated: string; + excluded: boolean; + phenopacket: string; +}; + +export type Phenopacket = { + id: string; + phenotypic_features?: PhenotypicFeature[]; + interpretations?: Interpretation[]; + diseases?: Disease[]; + created: string; + updated: string; + measurements?: Measurement[]; + medical_actions?: MedicalAction[]; + meta_data: MetaData; + dataset: string; + biosamples?: Biosample[]; +}; diff --git a/src/js/types/clinphen/resources.ts b/src/js/types/clinphen/resources.ts new file mode 100644 index 00000000..a57df589 --- /dev/null +++ b/src/js/types/clinphen/resources.ts @@ -0,0 +1,97 @@ +import type { Experiment } from '@/types/clinphen/experiments'; +import type { OntologyTerm } from '@/types/clinphen/ontology'; + +export type Instrument = { + id: number; + identifier: string; + created: string; + updated: string; +}; + +export type Biosample = { + id: string; + experiments?: Experiment[]; + created: string; + updated: string; + sampled_tissue?: { + id: string; + label: string; + }; + procedure?: { + code: OntologyTerm; + }; +}; + +export type Diagnosis = { + id: string; + genomic_interpretations: unknown[]; + disease: unknown | null; + extra_properties: unknown | null; +}; + +export type Interpretation = { + id: string; + created: string; + updated: string; + progress_status: string; + summary: string; + diagnosis: Diagnosis; +}; + +export type Disease = { + id: number; + created: string; + updated: string; + term: OntologyTerm; + excluded: boolean; +}; + +export type MeasurementValue = { + quantity?: { + unit: OntologyTerm; + value: number; + }; + complex_value?: { + typed_quantities: { + type: OntologyTerm; + quantity: { + unit: OntologyTerm; + value: number; + }; + }[]; + }; +}; + +export type Measurement = { + assay: OntologyTerm; + value?: MeasurementValue; +}; + +export type Treatment = { + agent: OntologyTerm; +}; + +export type MedicalAction = { + treatment?: Treatment; + adverse_events?: OntologyTerm[]; + treatment_target?: OntologyTerm; +}; + +export type MetaDataResource = { + id: string; + name: string; + namespace_prefix: string; + url: string; + version: string; + iri_prefix: string; + created: string; + updated: string; +}; + +export type MetaData = { + resources: MetaDataResource[]; + created: string; + updated: string; + created_by: string; + phenopacket_schema_version: string; +}; diff --git a/src/js/types/individual.ts b/src/js/types/individual.ts index 0a3b3e76..d23e880a 100644 --- a/src/js/types/individual.ts +++ b/src/js/types/individual.ts @@ -1,156 +1,6 @@ -import type { OntologyTerm } from './ontology'; - -type ExperimentResult = { - id: number; - identifier: string; - description: string; - filename: string; - url: string; - genome_assembly_id: string; - file_format: string; - data_output_type: string; - creation_date: string; - created: string; - updated: string; -}; - -type Instrument = { - id: number; - identifier: string; - created: string; - updated: string; -}; - -type Experiment = { - id: string; - experiment_results?: ExperimentResult[]; - instrument: Instrument; - biosample_individual: { - id: string; - }; - study_type: string; - experiment_type: string; - experiment_ontology: OntologyTerm[]; - molecule?: string; - molecule_ontology?: OntologyTerm[]; - library_strategy?: string; - library_source?: string; - library_selection?: string; - created: string; - updated: string; - biosample: string; - dataset: string; -}; - -type Biosample = { - id: string; - experiments?: Experiment[]; - created: string; - updated: string; - sampled_tissue?: { - id: string; - label: string; - }; - procedure?: { - code: OntologyTerm; - }; -}; - -type PhenotypicFeature = { - type: OntologyTerm; - created: string; - updated: string; - excluded: boolean; - phenopacket: string; -}; - -type Diagnosis = { - id: string; - genomic_interpretations: unknown[]; - disease: unknown | null; - extra_properties: unknown | null; -}; - -type Interpretation = { - id: string; - created: string; - updated: string; - progress_status: string; - summary: string; - diagnosis: Diagnosis; -}; - -type Disease = { - id: number; - created: string; - updated: string; - term: OntologyTerm; - excluded: boolean; -}; - -type MeasurementValue = { - quantity?: { - unit: OntologyTerm; - value: number; - }; - complex_value?: { - typed_quantities: { - type: OntologyTerm; - quantity: { - unit: OntologyTerm; - value: number; - }; - }[]; - }; -}; - -type Measurement = { - assay: OntologyTerm; - value?: MeasurementValue; -}; - -type Treatment = { - agent: OntologyTerm; -}; - -type MedicalAction = { - treatment?: Treatment; - adverse_events?: OntologyTerm[]; - treatment_target?: OntologyTerm; -}; - -type MetaDataResource = { - id: string; - name: string; - namespace_prefix: string; - url: string; - version: string; - iri_prefix: string; - created: string; - updated: string; -}; - -type MetaData = { - resources: MetaDataResource[]; - created: string; - updated: string; - created_by: string; - phenopacket_schema_version: string; -}; - -type Phenopacket = { - id: string; - phenotypic_features?: PhenotypicFeature[]; - interpretations?: Interpretation[]; - diseases?: Disease[]; - created: string; - updated: string; - measurements?: Measurement[]; - medical_actions?: MedicalAction[]; - meta_data: MetaData; - dataset: string; - biosamples?: Biosample[]; -}; +import type { OntologyTerm } from './clinphen/ontology'; +import type { Biosample } from './clinphen/resources'; +import type { Phenopacket } from '@/types/clinphen/phenopackets'; export type IndividualRootObject = { id: string;