diff --git a/src/env.ts b/src/env.ts index a2fc230..55169af 100644 --- a/src/env.ts +++ b/src/env.ts @@ -17,11 +17,8 @@ export const ES_QUERY_MAX_SIZE: number = Number(process.env.ES_QUERY_MAX_SIZE) | // Project export const PROJECT: string = process.env.PROJECT || 'kids-first'; -export const esFileIndex = process.env.ES_FILE_INDEX || 'file_centric'; export const esFileAlias = process.env.ES_FILE_ALIAS || 'file'; -export const esBiospecimenIndex = process.env.ES_BIOSPECIMEN_INDEX || 'biospecimen_centric'; - // Keycloak configs export const KEYCLOAK_URL = process.env.KEYCLOAK_URL || 'https://kf-keycloak-qa.kf-strides.org/auth'; export const KEYCLOAK_REALM = process.env.KEYCLOAK_REALM || 'kidsfirstdrc'; diff --git a/src/esVars.ts b/src/esVars.ts new file mode 100644 index 0000000..afb32f6 --- /dev/null +++ b/src/esVars.ts @@ -0,0 +1,2 @@ +export const esFileIndex = 'file_centric'; +export const esBiospecimenIndex = 'biospecimen_centric'; diff --git a/src/reports/biospecimen-data/configInclude.ts b/src/reports/biospecimen-data/configInclude.ts index b95702a..3e76ab0 100644 --- a/src/reports/biospecimen-data/configInclude.ts +++ b/src/reports/biospecimen-data/configInclude.ts @@ -1,4 +1,4 @@ -import { esBiospecimenIndex } from '../../env'; +import { esBiospecimenIndex } from '../../esVars'; import { QueryConfig, ReportConfig, SheetConfig } from '../types'; const biospecimens: SheetConfig = { diff --git a/src/reports/biospecimen-data/configKf.ts b/src/reports/biospecimen-data/configKf.ts index 01f5e74..3ff2f18 100644 --- a/src/reports/biospecimen-data/configKf.ts +++ b/src/reports/biospecimen-data/configKf.ts @@ -1,4 +1,4 @@ -import { esBiospecimenIndex } from '../../env'; +import { esBiospecimenIndex } from '../../esVars'; import { QueryConfig, ReportConfig, SheetConfig } from '../types'; const biospecimens: SheetConfig = { @@ -22,14 +22,11 @@ const biospecimens: SheetConfig = { { field: 'volume_unit', header: 'Volume Unit' }, { field: 'collection_method_of_sample_procurement', header: 'Method of Sample Procurement' }, { field: 'diagnoses.mondo_display_term', header: 'Histological Diagnosis (MONDO)' }, - { field: 'diagnoses.diagnosis_ncit', header: 'Histological Diagnosis (NCIT)' }, + { field: 'diagnoses.ncit_display_term', header: 'Histological Diagnosis (NCIT)' }, { field: 'diagnoses.source_text', header: 'Histological Diagnosis (Source Text)' }, { field: 'diagnoses.source_text_tumor_location', header: 'Tumor Location (Source Text)' }, - //FIXME { field: '', header: 'Tumor Descriptor (Source Text)' }, - { field: 'collection_ncit_anatomy_site_id', header: 'Anatomical Site (NCIT)' }, + { field: 'collection_ncit_anatomy_site', header: 'Anatomical Site (NCIT)' }, { field: 'collection_anatomy_site', header: 'Anatomical Site (Source Text)' }, - // TODO: Add this back when it's ready { field: 'ncit_id_tissue_type', header: 'Tissue Type (NCIT)' }, - // TODO: Add this back when it's ready { field: 'tissue_type_source_text', header: 'Tissue Type (Source Text)' }, { field: 'consent_type', header: 'Consent Type' }, { field: 'dbgap_consent_code', header: 'dbGaP Consent Code' }, { field: 'files.sequencing_experiment.sequencing_center_id', header: 'Sequencing Center ID' }, diff --git a/src/reports/biospecimen-request/configInclude.ts b/src/reports/biospecimen-request/configInclude.ts index 6e2dc01..9520224 100644 --- a/src/reports/biospecimen-request/configInclude.ts +++ b/src/reports/biospecimen-request/configInclude.ts @@ -1,4 +1,4 @@ -import { esBiospecimenIndex } from '../../env'; +import { esBiospecimenIndex } from '../../esVars'; import { BioRequestConfig, QueryConfig, ReportConfig, SheetConfig } from '../types'; const contact: SheetConfig = { diff --git a/src/reports/biospecimen-request/configKf.ts b/src/reports/biospecimen-request/configKf.ts index a77738c..7bc08d1 100644 --- a/src/reports/biospecimen-request/configKf.ts +++ b/src/reports/biospecimen-request/configKf.ts @@ -1,4 +1,4 @@ -import { esBiospecimenIndex } from '../../env'; +import { esBiospecimenIndex } from '../../esVars'; import { BioRequestConfig, QueryConfig, ReportConfig, SheetConfig } from '../types'; const contact: SheetConfig = { @@ -41,10 +41,10 @@ const generateStudyTab: (study_code: string) => SheetConfig = (study_code) => { field: 'volume_unit', header: 'Volume Unit' }, { field: 'collection_method_of_sample_procurement', header: 'Method of Sample Procurement' }, { field: 'diagnoses.mondo_display_term', header: 'Histological Diagnosis (MONDO)' }, - { field: 'diagnoses.diagnosis_ncit', header: 'Histological Diagnosis (NCIT)' }, + { field: 'diagnoses.ncit_display_term', header: 'Histological Diagnosis (NCIT)' }, { field: 'diagnoses.source_text', header: 'Histological Diagnosis (Source Text)' }, { field: 'diagnoses.source_text_tumor_location', header: 'Tumor Location (Source Text)' }, - { field: 'collection_ncit_anatomy_site_id', header: 'Anatomical Site (NCIT)' }, + { field: 'collection_ncit_anatomy_site', header: 'Anatomical Site (NCIT)' }, { field: 'collection_anatomy_site', header: 'Anatomical Site (Source Text)' }, ], sort: [ @@ -90,10 +90,10 @@ const wantedFields = [ 'volume_unit', 'collection_method_of_sample_procurement', 'diagnoses.mondo_display_term', - 'diagnoses.diagnosis_ncit', + 'diagnoses.ncit_display_term', 'diagnoses.source_text', 'diagnoses.source_text_tumor_location', - 'collection_ncit_anatomy_site_id', + 'collection_ncit_anatomy_site', 'collection_anatomy_site', ]; diff --git a/src/reports/clinical-data/configInclude.ts b/src/reports/clinical-data/configInclude.ts index 630f98f..efc04a7 100644 --- a/src/reports/clinical-data/configInclude.ts +++ b/src/reports/clinical-data/configInclude.ts @@ -77,7 +77,7 @@ const diagnoses: SheetConfig = { columns: [ { field: 'participant_id', header: 'Participant ID' }, { field: 'external_id', header: 'External Participant ID' }, - { field: 'diagnosis.mondo_id_diagnosis', header: ' Diagnosis (MONDO)' }, + { field: 'diagnosis.mondo_display_term', header: ' Diagnosis (MONDO)' }, { field: 'diagnosis.source_text', header: 'Condition (Source Text)' }, { field: 'diagnosis.age_at_event_days', diff --git a/src/reports/clinical-data/configKf.ts b/src/reports/clinical-data/configKf.ts index 00c02b6..1fe7282 100644 --- a/src/reports/clinical-data/configKf.ts +++ b/src/reports/clinical-data/configKf.ts @@ -70,18 +70,11 @@ const diagnoses: SheetConfig = { { field: 'external_id', header: 'External Participant ID' }, { field: 'families_id', header: 'Family ID' }, { field: 'is_proband', header: 'Proband' }, - //TODO { field: '?', header: 'Diagnosis Category' }, - { field: 'diagnosis.mondo_display_term', header: 'Diagnosis (MONDO)' }, - { field: 'diagnosis.ncit_display_term', - additionalFields: ['diagnosis.ncit_code'], header: 'Diagnosis (NCIT)', - transform: (displayTerm: string, row: { diagnosis: { ncit_code: string } }) => - displayTerm || row?.diagnosis?.ncit_code || '', }, - { field: 'diagnosis.source_text', header: 'Diagnosis (Source Text)' }, { field: 'diagnosis.age_at_event_days', header: 'Age at Diagnosis (Days)' }, { field: 'diagnosis.source_text_tumor_location', header: 'Tumor Location (Source Text)' }, @@ -113,7 +106,7 @@ const familyRelationship: SheetConfig = { export const queryConfigs: QueryConfig = { indexName: 'participant', - alias: 'next_participant_centric', + alias: 'participant_centric', }; export const sheetConfigs: SheetConfig[] = [participants, phenotypes, diagnoses, familyRelationship]; diff --git a/src/reports/family-clinical-data/configInclude.ts b/src/reports/family-clinical-data/configInclude.ts index 7d3fffc..5f2b159 100644 --- a/src/reports/family-clinical-data/configInclude.ts +++ b/src/reports/family-clinical-data/configInclude.ts @@ -99,7 +99,7 @@ const diagnoses: SheetConfig = { { field: 'participant_id', header: 'Participant ID' }, { field: 'external_id', header: 'External Participant ID' }, { field: 'families_id', header: 'Family ID' }, - { field: 'diagnosis.mondo_id_diagnosis', header: ' Diagnosis (MONDO)' }, + { field: 'diagnosis.mondo_display_term', header: ' Diagnosis (MONDO)' }, { field: 'diagnosis.source_text', header: 'Condition (Source Text)' }, { field: 'diagnosis.age_at_event_days', diff --git a/src/reports/family-clinical-data/configKf.ts b/src/reports/family-clinical-data/configKf.ts index 4ba3d55..2dfbd17 100644 --- a/src/reports/family-clinical-data/configKf.ts +++ b/src/reports/family-clinical-data/configKf.ts @@ -90,14 +90,10 @@ const diagnoses: SheetConfig = { { field: 'external_id', header: 'External Participant ID' }, { field: 'families_id', header: 'Family ID' }, { field: 'is_proband', header: 'Proband' }, - //TODO { field: '?', header: 'Diagnosis Category' }, { field: 'diagnosis.mondo_display_term', header: 'Diagnosis (MONDO)' }, { field: 'diagnosis.ncit_display_term', - additionalFields: ['diagnosis.ncit_code'], header: 'Diagnosis (NCIT)', - transform: (displayTerm: string, row: { diagnosis: { ncit_code: string } }) => - displayTerm || row?.diagnosis?.ncit_code || '', }, { field: 'diagnosis.source_text', header: 'Diagnosis (Source Text)' }, { field: 'diagnosis.age_at_event_days', header: 'Age at Diagnosis (Days)' }, @@ -108,7 +104,7 @@ const diagnoses: SheetConfig = { export const queryConfigs: QueryConfig = { indexName: 'participant', - alias: 'next_participant_centric', + alias: 'participant_centric', }; export const sheetConfigs: SheetConfig[] = [participants, phenotypes, diagnoses]; diff --git a/src/reports/file-manifest/index.ts b/src/reports/file-manifest/index.ts index 4e9848f..c4d3704 100644 --- a/src/reports/file-manifest/index.ts +++ b/src/reports/file-manifest/index.ts @@ -2,7 +2,7 @@ import { Request, Response } from 'express'; import EsInstance from '../../ElasticSearchClientInstance'; -import { esFileIndex, PROJECT } from '../../env'; +import { PROJECT } from '../../env'; import { reportGenerationErrorHandler } from '../../errors'; import { ProjectType } from '../types'; import generateTsvReport from '../utils/generateTsvReport'; @@ -11,6 +11,7 @@ import getFilesFromSqon from '../utils/getFilesFromSqon'; import getInfosByConfig from '../utils/getInfosByConfig'; import configInclude from './configInclude'; import configKf from './configKf'; +import { esFileIndex } from '../../esVars'; const fileManifestReport = async (req: Request, res: Response): Promise => { console.time('fileManifestReport'); diff --git a/src/reports/utils/getAvailableBiospecimensFromSqon.ts b/src/reports/utils/getAvailableBiospecimensFromSqon.ts index 572258d..37785da 100644 --- a/src/reports/utils/getAvailableBiospecimensFromSqon.ts +++ b/src/reports/utils/getAvailableBiospecimensFromSqon.ts @@ -1,11 +1,12 @@ import { buildQuery } from '@arranger/middleware'; import { Client } from '@elastic/elasticsearch'; -import { ES_QUERY_MAX_SIZE, esBiospecimenIndex } from '../../env'; +import { ES_QUERY_MAX_SIZE } from '../../env'; import { getExtendedConfigs, getNestedFields } from '../../utils/arrangerUtils'; import { executeSearch } from '../../utils/esUtils'; import { Sqon } from '../../utils/setsTypes'; import { resolveSetsInSqon } from '../../utils/sqonUtils'; +import { esBiospecimenIndex } from '../../esVars'; /** * Retrieve all available biospecimen from a sqon of a list of biospecimen ids. diff --git a/src/reports/utils/getFamilyIds.ts b/src/reports/utils/getFamilyIds.ts index f1ce9b5..c057704 100644 --- a/src/reports/utils/getFamilyIds.ts +++ b/src/reports/utils/getFamilyIds.ts @@ -1,8 +1,9 @@ import { Client } from '@elastic/elasticsearch'; import noop from 'lodash/noop'; -import { ES_PAGESIZE, ES_QUERY_MAX_SIZE, esFileIndex } from '../../env'; +import { ES_PAGESIZE, ES_QUERY_MAX_SIZE } from '../../env'; import { executeSearch, executeSearchAfterQuery } from '../../utils/esUtils'; +import { esFileIndex } from '../../esVars'; interface IFileInfo { data_type: string; diff --git a/src/reports/utils/getFilesFromSqon.ts b/src/reports/utils/getFilesFromSqon.ts index a52e645..49c9acd 100644 --- a/src/reports/utils/getFilesFromSqon.ts +++ b/src/reports/utils/getFilesFromSqon.ts @@ -2,7 +2,8 @@ import { buildQuery } from '@arranger/middleware'; import { Client } from '@elastic/elasticsearch'; import noop from 'lodash/noop'; -import { ES_PAGESIZE, esFileAlias, esFileIndex } from '../../env'; +import { ES_PAGESIZE, esFileAlias } from '../../env'; +import { esFileIndex } from '../../esVars'; import { getExtendedConfigs, getNestedFields } from '../../utils/arrangerUtils'; import { executeSearchAfterQuery } from '../../utils/esUtils'; import { Sqon } from '../../utils/setsTypes';