Make scripts are provided to run this application and the required MongoDB using docker. In order for these scripts to start the dev server, you must have a debugger application waiting to attach on port 9229
. This is easily accomplished by running these commands in the VSCode terminal, and updating the Debugger Auto Attach
setting in VSCode settings to yes
.
make
this will bootstrap everything, docker compose, and the servicemake debug
will only restart the clinical service, without docker composemake verify
To run local without engaging the debugger, run npm run local
. Since this will not run the docker-compose setup, this requires MongoDB to be running locally (connections configured in the .env file)
See Makefile
for more details and options.
Add new entity in the following files:
src/common-model/entities.ts
:
enum ClinicalEntitySchemaNames
type TypeEntitySchemaNameToIndenfiterType
ClinicalUniqueIdentifier: TypeEntitySchemaNameToIndenfiterType
src/common-model/functions.ts
:
getClinicalObjectsFromDonor
to return proper entity from donor, similar to primary diagnosis
src/clinical/clinical-entities.ts
:
ClinicalEntity
:
export interface NewEntity extends ClinicalEntity {
entityId: number | undefined;
}
interface Donor
to include the new entitysrc/clinical/donor-repo.ts
:
const newSchema = new mongoose.Schema(
{
id: { type: Number },
clinicalInfo: {},
},
{ _id: false },
);
newSchema
to const DonorSchema
newSchema.plugin(AutoIncrement, {
inc_field: 'submitter_entity_id',
start_seq: 1,
});
src/submission/submission-entities.ts
:
const BatchNameRegex: Record<ClinicalEntitySchemaNames, RegExp[]>
update src/submission/validation-clinical/utils.ts
- function getRelatedEntityByFK
update test/integration/stub-schema.json
if a new schema is added
src/submission/submission-to-clinical/stat-calculator.ts
getEmptyCoreStats
function to include new entityschemaNameToCoreCompletenessStat
to include new entitysrc/submission/submission-to-clinical/merge-submission.ts
mergeRecordsMapIntoDonor
, similiar to updatePrimaryDiagnosisInfo
mergeActiveSubmissionWithDonors
switch-case to make sure the new entity is updated when committing submission, similar to primary_diagnosisupdate sampleFiles/sample-schema.json
to include the new schema if you are using a local schema for development
add a new sample tsv to sampleFiles/clinical
If cross file validation is needed for the new entity, add submission validation for the new entity in the following file:
src/submission/validation-clinical/index.ts
:const availableValidators: { [k: string]: any } = {
[ClinicalEntitySchemaNames.DONOR]: donor,
[ClinicalEntitySchemaNames.SPECIMEN]: specimen,
[ClinicalEntitySchemaNames.PRIMARY_DIAGNOSIS]: primaryDiagnosis,
[ClinicalEntitySchemaNames.FOLLOW_UP]: follow_up,
[ClinicalEntitySchemaNames.NEW_ENTITY]: new_entity <--------- add here to trigger validation
}
schema_builder
to generate a new migration-stub-schema.json
when a adding a new schema.If file upload fails with the error TypeError: Cannot read property 'readFile' of undefined
, make sure you are running Node 12+
We use a tool called migrate-mongo: https://www.npmjs.com/package/migrate-mongo
npx migrate-mongo create <issue #>-<my-script-name>
npx migrate-mongo up
npx migrate-mongo down
npx migrate-mongo status
Notes:
argo-clinical/test/integration/submission$ npx ts-node ./migration_utils/schema_builder.ts
to generate the migration-stub-schema.jsonyou can see the compose directory for the simplified process it's recommended to use mysql 5.7, 5.6. or 5.5 mysql 8 has issues, but works nonetheless.
the job to import this: https://jenkins.qa.cancercollaboratory.org/job/ARGO/job/devops/job/rxnorm-import/
in clinical package json:
npm run build
npm i