Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📝 Add ncit terms + remove next prefix #124

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 2 additions & 0 deletions src/esVars.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const esFileIndex = 'file_centric';
export const esBiospecimenIndex = 'biospecimen_centric';
2 changes: 1 addition & 1 deletion src/reports/biospecimen-data/configInclude.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { esBiospecimenIndex } from '../../env';
import { esBiospecimenIndex } from '../../esVars';
import { QueryConfig, ReportConfig, SheetConfig } from '../types';
evans-g-crsj marked this conversation as resolved.
Show resolved Hide resolved

const biospecimens: SheetConfig = {
Expand Down
9 changes: 3 additions & 6 deletions src/reports/biospecimen-data/configKf.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { esBiospecimenIndex } from '../../env';
import { esBiospecimenIndex } from '../../esVars';
import { QueryConfig, ReportConfig, SheetConfig } from '../types';
evans-g-crsj marked this conversation as resolved.
Show resolved Hide resolved

const biospecimens: SheetConfig = {
Expand All @@ -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' },
Expand Down
2 changes: 1 addition & 1 deletion src/reports/biospecimen-request/configInclude.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { esBiospecimenIndex } from '../../env';
import { esBiospecimenIndex } from '../../esVars';
import { BioRequestConfig, QueryConfig, ReportConfig, SheetConfig } from '../types';
evans-g-crsj marked this conversation as resolved.
Show resolved Hide resolved

const contact: SheetConfig = {
Expand Down
10 changes: 5 additions & 5 deletions src/reports/biospecimen-request/configKf.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { esBiospecimenIndex } from '../../env';
import { esBiospecimenIndex } from '../../esVars';
import { BioRequestConfig, QueryConfig, ReportConfig, SheetConfig } from '../types';
evans-g-crsj marked this conversation as resolved.
Show resolved Hide resolved

const contact: SheetConfig = {
Expand Down Expand Up @@ -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: [
Expand Down Expand Up @@ -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',
];

Expand Down
2 changes: 1 addition & 1 deletion src/reports/clinical-data/configInclude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
9 changes: 1 addition & 8 deletions src/reports/clinical-data/configKf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)' },
Expand Down Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion src/reports/family-clinical-data/configInclude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 1 addition & 5 deletions src/reports/family-clinical-data/configKf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)' },
Expand All @@ -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];
Expand Down
3 changes: 2 additions & 1 deletion src/reports/file-manifest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Request, Response } from 'express';

import EsInstance from '../../ElasticSearchClientInstance';
evans-g-crsj marked this conversation as resolved.
Show resolved Hide resolved
import { esFileIndex, PROJECT } from '../../env';
import { PROJECT } from '../../env';
import { reportGenerationErrorHandler } from '../../errors';
import { ProjectType } from '../types';
import generateTsvReport from '../utils/generateTsvReport';
Expand All @@ -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<void> => {
console.time('fileManifestReport');
Expand Down
3 changes: 2 additions & 1 deletion src/reports/utils/getAvailableBiospecimensFromSqon.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { buildQuery } from '@arranger/middleware';
import { Client } from '@elastic/elasticsearch';

import { ES_QUERY_MAX_SIZE, esBiospecimenIndex } from '../../env';
evans-g-crsj marked this conversation as resolved.
Show resolved Hide resolved
import { ES_QUERY_MAX_SIZE } from '../../env';
import { getExtendedConfigs, getNestedFields } from '../../utils/arrangerUtils';
import { executeSearch } from '../../utils/esUtils';
evans-g-crsj marked this conversation as resolved.
Show resolved Hide resolved
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.
Expand Down
3 changes: 2 additions & 1 deletion src/reports/utils/getFamilyIds.ts
Original file line number Diff line number Diff line change
@@ -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';
evans-g-crsj marked this conversation as resolved.
Show resolved Hide resolved

interface IFileInfo {
data_type: string;
Expand Down
3 changes: 2 additions & 1 deletion src/reports/utils/getFilesFromSqon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
evans-g-crsj marked this conversation as resolved.
Show resolved Hide resolved
import { getExtendedConfigs, getNestedFields } from '../../utils/arrangerUtils';
import { executeSearchAfterQuery } from '../../utils/esUtils';
import { Sqon } from '../../utils/setsTypes';
Expand Down
Loading