From dc50fbae9fb71bdef26c674241aa2e2122da670a Mon Sep 17 00:00:00 2001 From: Joyce Quach Date: Mon, 8 Apr 2024 11:18:12 -0400 Subject: [PATCH] Fix typos and remove unused imports while updating VS Code Workspace spell check ignore list --- .../resources/Questionnaire-R4-IPledge.json | 2 +- .../Questionnaire-R4-PhysicalExam.json | 20 ++--- .../Questionnaire-R4-Subjective.json | 12 +-- .../ValueSet-R4-condition-clinical.json | 2 +- .../resources/Questionnaire-R4-Turalio.json | 88 +++++++++++-------- src/config.ts | 8 +- src/fhir/questionnaireUtilities.ts | 2 +- src/fhir/utilities.ts | 1 - src/hooks/hookResources.ts | 2 +- src/hooks/rems.patientview.ts | 2 +- src/lib/etasu.ts | 6 +- src/lib/vsac_cache.ts | 83 ++++++++--------- src/rems-cds-hooks | 2 +- src/services/questionnaire.service.ts | 19 ---- test/fixtures/patient.json | 30 ++----- test/server.test.ts | 2 +- test/vsac_cache.test.ts | 30 +++---- tsconfig.json | 2 +- 18 files changed, 145 insertions(+), 168 deletions(-) diff --git a/src/cds-library/CRD-DTR/IPledge/R4/resources/Questionnaire-R4-IPledge.json b/src/cds-library/CRD-DTR/IPledge/R4/resources/Questionnaire-R4-IPledge.json index f869aaea..1f17f6a3 100644 --- a/src/cds-library/CRD-DTR/IPledge/R4/resources/Questionnaire-R4-IPledge.json +++ b/src/cds-library/CRD-DTR/IPledge/R4/resources/Questionnaire-R4-IPledge.json @@ -379,7 +379,7 @@ }, { "linkId": "6.5", - "text": "4. I understand that some patients while taking isotretinoin or soon after stopping isotetrinoin, have become depressed or developed other serious mental problems. Symptoms of depression include sad, anxious or empty mood, irritability, acting on dangerous impulses, anger, loss of pleasure or interest in social or sport activities, sleeping too much or too little, changes in weight or appetite, school or work performance going down, or trouble concentrating. Some patients taking isotretinoin have had thoughts about hurting themselves or putting an end to their own lives (suicidal thoughts). Some people tried to end their own lives, and some people have ended their own lives. There were reports that some of these people did not appear depressed. There have been reports of patients on isotretinoin becoming aggressive or violent. Some people have had other signs of depression while taking isotretinoin (see #7).", + "text": "4. I understand that some patients while taking isotretinoin or soon after stopping isotretinoin, have become depressed or developed other serious mental problems. Symptoms of depression include sad, anxious or empty mood, irritability, acting on dangerous impulses, anger, loss of pleasure or interest in social or sport activities, sleeping too much or too little, changes in weight or appetite, school or work performance going down, or trouble concentrating. Some patients taking isotretinoin have had thoughts about hurting themselves or putting an end to their own lives (suicidal thoughts). Some people tried to end their own lives, and some people have ended their own lives. There were reports that some of these people did not appear depressed. There have been reports of patients on isotretinoin becoming aggressive or violent. Some people have had other signs of depression while taking isotretinoin (see #7).", "type": "boolean", "required": true }, diff --git a/src/cds-library/CRD-DTR/Shared/R4/resources/Questionnaire-R4-PhysicalExam.json b/src/cds-library/CRD-DTR/Shared/R4/resources/Questionnaire-R4-PhysicalExam.json index 8a0ae2e1..40369de4 100644 --- a/src/cds-library/CRD-DTR/Shared/R4/resources/Questionnaire-R4-PhysicalExam.json +++ b/src/cds-library/CRD-DTR/Shared/R4/resources/Questionnaire-R4-PhysicalExam.json @@ -1,16 +1,16 @@ { "resourceType": "Questionnaire", "id": "physical-exam", - "name": "Physican Exam Module", + "name": "Physical Exam Module", "url": "http://hl7.org/fhir/Questionnaire/physical-exam", "meta": { "profile": [ "http://hl7.org/fhir/StructureDefinition/cqf-questionnaire", "http://hl7.org/fhir/us/davinci-dtr/StructureDefinition/dtr-questionnaire-r4" ] - }, + }, "status": "draft", - "item":[ + "item": [ { "linkId": "OBJ.PE", "code": [ @@ -32,7 +32,7 @@ "system": "http://loinc.org" } ], - "type": "string", + "type": "string", "text": "General Appearance" }, { @@ -44,7 +44,7 @@ "system": "http://loinc.org" } ], - "type": "string", + "type": "string", "text": "Head and Face" }, { @@ -104,7 +104,7 @@ "system": "http://loinc.org" } ], - "type": "string", + "type": "string", "text": "Cardiovascular System" }, { @@ -172,12 +172,12 @@ "code": [ { "code": "71401-4", - "display": "Extremeties", + "display": "Extremities", "system": "http://loinc.org" } ], "type": "string", - "text": "Extremeties" + "text": "Extremities" }, { "linkId": "PE.14", @@ -249,5 +249,5 @@ } ] } - ] -} \ No newline at end of file + ] +} diff --git a/src/cds-library/CRD-DTR/Shared/R4/resources/Questionnaire-R4-Subjective.json b/src/cds-library/CRD-DTR/Shared/R4/resources/Questionnaire-R4-Subjective.json index 6493ef6c..e0114ef8 100644 --- a/src/cds-library/CRD-DTR/Shared/R4/resources/Questionnaire-R4-Subjective.json +++ b/src/cds-library/CRD-DTR/Shared/R4/resources/Questionnaire-R4-Subjective.json @@ -9,15 +9,15 @@ "http://hl7.org/fhir/StructureDefinition/cqf-questionnaire", "http://hl7.org/fhir/us/davinci-dtr/StructureDefinition/dtr-questionnaire-r4" ] - }, + }, "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/cqf-library", "valueCanonical": "http://hl7.org/fhir/us/davinci-dtr/Library/BasicClinicalInfo-prepopulation" } - ], + ], "status": "draft", - "item":[ + "item": [ { "linkId": "SUB", "text": "Subjective", @@ -78,7 +78,7 @@ "linkId": "MED.1.4", "text": "Frequency", "type": "open-choice", - "answerValueSet":"http://hl7.org/fhir/ValueSet/timing-abbreviation" + "answerValueSet": "http://hl7.org/fhir/ValueSet/timing-abbreviation" }, { "linkId": "MED.1.5", @@ -107,9 +107,9 @@ "text": "Allergy", "type": "open-choice", "repeats": true, - "anwerOption": [] + "answerOption": [] } ] } ] -} \ No newline at end of file +} diff --git a/src/cds-library/CRD-DTR/Shared/R4/resources/ValueSet-R4-condition-clinical.json b/src/cds-library/CRD-DTR/Shared/R4/resources/ValueSet-R4-condition-clinical.json index a3566410..5c938610 100644 --- a/src/cds-library/CRD-DTR/Shared/R4/resources/ValueSet-R4-condition-clinical.json +++ b/src/cds-library/CRD-DTR/Shared/R4/resources/ValueSet-R4-condition-clinical.json @@ -53,7 +53,7 @@ "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/valueset-definition", - "valueString": "The subject is experiencing a re-occurence or repeating of a previously resolved condition, e.g. urinary tract infection, pancreatitis, cholangitis, conjunctivitis." + "valueString": "The subject is experiencing a re-occurrence or repeating of a previously resolved condition, e.g. urinary tract infection, pancreatitis, cholangitis, conjunctivitis." } ], "system": "http://terminology.hl7.org/CodeSystem/condition-clinical", diff --git a/src/cds-library/CRD-DTR/Turalio/R4/resources/Questionnaire-R4-Turalio.json b/src/cds-library/CRD-DTR/Turalio/R4/resources/Questionnaire-R4-Turalio.json index 7142bd5c..2b095c5e 100644 --- a/src/cds-library/CRD-DTR/Turalio/R4/resources/Questionnaire-R4-Turalio.json +++ b/src/cds-library/CRD-DTR/Turalio/R4/resources/Questionnaire-R4-Turalio.json @@ -4,9 +4,7 @@ "name": "TuralioRemsPatientEnrollment", "title": "Turalio Rems Patient Enrollment", "status": "draft", - "subjectType": [ - "Patient" - ], + "subjectType": ["Patient"], "date": "2020-05-20", "publisher": "Da Vinci DTR", "extension": [ @@ -230,7 +228,7 @@ "code": "White", "display": "White" } - } + } ] }, { @@ -466,14 +464,16 @@ } } ], - "item" : [ + "item": [ { "linkId": "3.1.1", "text": "Laboratory Test", "type": "string", - "initial": [{ - "valueString": "AST or SGOT" - }], + "initial": [ + { + "valueString": "AST or SGOT" + } + ], "readOnly": true }, { @@ -524,14 +524,16 @@ } } ], - "item" : [ + "item": [ { "linkId": "3.1.1", "text": "Laboratory Test", "type": "string", - "initial": [{ - "valueString": "ALT or SGPT" - }], + "initial": [ + { + "valueString": "ALT or SGPT" + } + ], "readOnly": true }, { @@ -582,14 +584,16 @@ } } ], - "item" : [ + "item": [ { "linkId": "3.1.1", "text": "Laboratory Test", "type": "string", - "initial": [{ - "valueString": "GGT" - }], + "initial": [ + { + "valueString": "GGT" + } + ], "readOnly": true }, { @@ -640,14 +644,16 @@ } } ], - "item" : [ + "item": [ { "linkId": "3.1.1", "text": "Laboratory Test", "type": "string", - "initial": [{ - "valueString": "Total Bilirubin" - }], + "initial": [ + { + "valueString": "Total Bilirubin" + } + ], "readOnly": true }, { @@ -698,14 +704,16 @@ } } ], - "item" : [ + "item": [ { "linkId": "3.1.1", "text": "Laboratory Test", "type": "string", - "initial": [{ - "valueString": "Direct Bilirubin" - }], + "initial": [ + { + "valueString": "Direct Bilirubin" + } + ], "readOnly": true }, { @@ -756,14 +764,16 @@ } } ], - "item" : [ + "item": [ { "linkId": "3.1.1", "text": "Laboratory Test", "type": "string", - "initial": [{ - "valueString": "Alkaline Phosphatase" - }], + "initial": [ + { + "valueString": "Alkaline Phosphatase" + } + ], "readOnly": true }, { @@ -814,14 +824,16 @@ } } ], - "item" : [ + "item": [ { "linkId": "3.1.1", "text": "Laboratory Test", "type": "string", - "initial": [{ - "valueString": "Albumin" - }], + "initial": [ + { + "valueString": "Albumin" + } + ], "readOnly": true }, { @@ -872,14 +884,16 @@ } } ], - "item" : [ + "item": [ { "linkId": "3.1.1", "text": "Laboratory Test", "type": "string", - "initial": [{ - "valueString": "PT/INR" - }], + "initial": [ + { + "valueString": "PT/INR" + } + ], "readOnly": true }, { @@ -1169,4 +1183,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/src/config.ts b/src/config.ts index 595d3fc8..74c8617a 100644 --- a/src/config.ts +++ b/src/config.ts @@ -3,12 +3,12 @@ import 'dotenv/config'; import * as env from 'env-var'; // Set up whitelist -const whitelist_env = env.get('WHITELIST').asArray() || false; +const whitelistEnv = env.get('WHITELIST').asArray() || false; -// If no whitelist is present, disable cors -// If it's length is 1, set it to a string, so * works +// If no whitelist is present, disable CORS +// If its length is 1, set it to a string, so * works // If there are multiple, keep them as an array -const whitelist = whitelist_env && whitelist_env.length === 1 ? whitelist_env[0] : whitelist_env; +const whitelist = whitelistEnv && whitelistEnv.length === 1 ? whitelistEnv[0] : whitelistEnv; export default { server: { port: env.get('PORT').asInt(), diff --git a/src/fhir/questionnaireUtilities.ts b/src/fhir/questionnaireUtilities.ts index 64b30207..c64572e2 100644 --- a/src/fhir/questionnaireUtilities.ts +++ b/src/fhir/questionnaireUtilities.ts @@ -98,7 +98,7 @@ export class QuestionnaireUtilities { } } } - // On load of new library, finds ValueSets in codefilters and + // On load of new library, finds ValueSets in code filters and // loads them as well static async processLibraryCodeFilters(library: Library) { const returnValue = this.vsacCache.cacheLibrary(library); diff --git a/src/fhir/utilities.ts b/src/fhir/utilities.ts index f572c505..72d79676 100644 --- a/src/fhir/utilities.ts +++ b/src/fhir/utilities.ts @@ -121,7 +121,6 @@ export class FhirUtilities { } static async populateDB() { - // prepopulateDB const medications = [ { name: 'Turalio', diff --git a/src/hooks/hookResources.ts b/src/hooks/hookResources.ts index 8d828a64..42f4ee91 100644 --- a/src/hooks/hookResources.ts +++ b/src/hooks/hookResources.ts @@ -21,7 +21,7 @@ export interface CardRule { cardDetails?: string; } export const CARD_DETAILS = 'Documentation Required, please complete form via Smart App link.'; -// TODO: this codemap should be replaced with a system similar to original CRD's questionnaire package operation +// TODO: this codemap should be replaced with a system similar to original CRD questionnaire package operation // the app doesn't necessarily have to use CQL for this. export const codeMap: { [key: string]: CardRule[] } = { '2183126': [ diff --git a/src/hooks/rems.patientview.ts b/src/hooks/rems.patientview.ts index 57f278af..9be0cd3c 100644 --- a/src/hooks/rems.patientview.ts +++ b/src/hooks/rems.patientview.ts @@ -169,7 +169,7 @@ const handler = (req: TypedRequestBody, res: any) => { } } - // if not in the list of metReuirements, add it as well + // if not in the list of metRequirements, add it as well if (!found) { card.addLink(createSmartLink(requirement.name, requirement.appContext, request)); smartLinkCount++; diff --git a/src/lib/etasu.ts b/src/lib/etasu.ts index 4923b7f6..f4558116 100644 --- a/src/lib/etasu.ts +++ b/src/lib/etasu.ts @@ -23,10 +23,6 @@ import { import { FilterQuery } from 'mongoose'; const router = Router(); -// const medicationCollection = db.collection('medication-requirements'); -// const metRequirementsCollection = db.collection('met-requirements'); -// const remsCaseCollection = db.collection('rems-case'); - // etasu endpoints router.get('/:drug', async (req: Request, res: Response) => { res.send(await medicationCollection.findOne({ name: req.params.drug })); @@ -262,7 +258,7 @@ const createMetRequirementAndNewCase = async ( return res; } - // iterate through all other reqs again to create corresponding false metReqs / assign to existing + // iterate through all other requirements again to create corresponding false metRequirements / assign to existing for (const requirement2 of drug.requirements) { // skip if the req found is the same as in the outer loop and has already been processed // && If the requirement is not the patient Status Form (when requiredToDispense == false) diff --git a/src/lib/vsac_cache.ts b/src/lib/vsac_cache.ts index 087fa4e0..927d20a6 100644 --- a/src/lib/vsac_cache.ts +++ b/src/lib/vsac_cache.ts @@ -32,33 +32,33 @@ class VsacCache { /** * - * @param library The library to cache valuesets for - * @param forceReload flag to force reaching valuesets already cached - * @returns Map of caching results url: {valueSet, error, cached} + * @param library The library to cache ValueSets for + * @param forceReload flag to force reaching ValueSets already cached + * @returns Map of caching results url: {ValueSet, error, cached} */ async cacheLibrary(library: Library, forceReload = false) { - const valueSets = this.collectLibraryValuesets(library); - return await this.cacheValuesets(valueSets, forceReload); + const valueSets = this.collectLibraryValueSets(library); + return await this.cacheValueSets(valueSets, forceReload); } /** * - * @param obj Questionnaire|item object to cache valuesets for - * @param forceReload flag to force reaching valuesets already cached + * @param obj Questionnaire|item object to cache ValueSets for + * @param forceReload flag to force reaching ValueSets already cached * @returns Map of caching results url: {valueSet, error, cached} */ async cacheQuestionnaireItems(obj: any, forceReload = false) { - const valueSets = this.collectQuestionnaireValuesets(obj); - return await this.cacheValuesets(valueSets, forceReload); + const valueSets = this.collectQuestionnaireValueSets(obj); + return await this.cacheValueSets(valueSets, forceReload); } /** * - * @param library The fhir Library to download valuesets from - * @returns a Set that includes all of the valueset urls found in the Library + * @param library The fhir Library to download ValueSets from + * @returns a Set that includes all of the ValueSet urls found in the Library */ - collectLibraryValuesets(library: Library) { + collectLibraryValueSets(library: Library) { // ensure only unique values return new Set(fhirpath.evaluate(library, 'Library.dataRequirement.codeFilter.valueSet')); } @@ -66,35 +66,35 @@ class VsacCache { /** * * @param obj the Questionnaire object or item to collect answerValueSet urls from - * @returns a Set that includes all of the valuesets in the passed object. This returns values for sub items as well + * @returns a Set that includes all of the ValueSets in the passed object. This returns values for sub items as well */ - collectQuestionnaireValuesets(obj: any) { + collectQuestionnaireValueSets(obj: any) { const items = obj.item; - let valuesets = new Set(); + let valueSets = new Set(); items.forEach(async (item: any) => { if (item.answerValueSet) { - valuesets.add(item.answerValueSet); + valueSets.add(item.answerValueSet); } if (item.item) { - valuesets = new Set([...valuesets, ...this.collectQuestionnaireValuesets(item)]); + valueSets = new Set([...valueSets, ...this.collectQuestionnaireValueSets(item)]); } }); // ensure only unique values - return valuesets; + return valueSets; } /** * - * @param valueSets The valusets to cache - * @param forceReload flag to force downloading and caching of the valuesets - * @returns a Map with the return values from caching the valuesets. + * @param valueSets The ValueSets to cache + * @param forceReload flag to force downloading and caching of the ValueSets + * @returns a Map with the return values from caching the ValueSets. */ - async cacheValuesets(valueSets: Set | [], forceReload = false) { + async cacheValueSets(valueSets: Set | [], forceReload = false) { const values = Array.from(valueSets); const results: ValueSet[] = []; await Promise.all( values.map(async vs => { - const vsResource = await this.downloadAndCacheValueset(vs, forceReload); + const vsResource = await this.downloadAndCacheValueSet(vs, forceReload); if (vsResource) { results.push(vsResource); } @@ -107,16 +107,16 @@ class VsacCache { * * @param idOrUrl the Url to download * @param forceReload flag to force recaching already cached values - * @returns Map that contains results url: {cached, valueSet, error} + * @returns Map that contains results url: {cached, ValueSet, error} */ - async downloadAndCacheValueset(idOrUrl: string, forceReload = false) { + async downloadAndCacheValueSet(idOrUrl: string, forceReload = false) { const isVsCached = await this.isCached(idOrUrl); if (forceReload || !isVsCached) { - const vs = await this.downloadValueset(idOrUrl); + const vs = await this.downloadValueSet(idOrUrl); if (vs.error) { console.log('Error Downloading ', idOrUrl, typeof vs.error); } else if (vs.valueSet) { - await this.storeValueSet(this.getValuesetId(idOrUrl), vs.valueSet); + await this.storeValueSet(this.getValueSetId(idOrUrl), vs.valueSet); vs.cached = true; } return vs.valueSet; @@ -128,11 +128,11 @@ class VsacCache { /** * * @param idOrUrl the url to download - * @returns Map that contains results url: {valueset, error} + * @returns Map that contains results url: {ValueSet, error} */ - async downloadValueset(idOrUrl: string) { + async downloadValueSet(idOrUrl: string) { const retValue: ValueSetMapEntry = {}; - const vsUrl = this.gtValuesetURL(idOrUrl); + const vsUrl = this.gtValueSetURL(idOrUrl); const headers: any = { Accept: 'application/json+fhir' }; @@ -140,11 +140,12 @@ class VsacCache { // this will only add headers to vsac urls const isBaseUrlVsac = this.baseUrl.find(str => vsUrl.startsWith(str)); if (isBaseUrlVsac) { - headers['Authorization'] = 'Basic ' + Buffer.from('apikey:' + this.apiKey).toString('base64'); + headers['Authorization'] = + 'Basic ' + Buffer.from('API key:' + this.apiKey).toString('base64'); isVsac = true; } - // this will try to download valuesets that are not in vsac as well based on the - // connonical url passed in. + // this will try to download ValueSets that are not in vsac as well based on the + // canonical url passed in. let url = vsUrl; if (isBaseUrlVsac) { url = vsUrl + '/$expand'; @@ -164,7 +165,7 @@ class VsacCache { retValue.error = error; } } else { - retValue.error = 'Cannot download non vsac valuesets: ' + url; + retValue.error = 'Cannot download non VSAC ValueSets: ' + url; } return retValue; @@ -176,15 +177,15 @@ class VsacCache { * @returns true or false */ async isCached(idOrUrl: string): Promise { - const id = this.getValuesetId(idOrUrl); + const id = this.getValueSetId(idOrUrl); // Query our collection for this observation return await ValueSetModel.findOne({ id: id.toString() }); } /** - * Stores a valueset in the cache. This currently only works for new inserts and will not update + * Stores a ValueSet in the cache. This currently only works for new inserts and will not update * any resources currently cached. This will be updated with a move to Mongo. - * @param vs the valueset to cache + * @param vs the ValueSet to cache */ async storeValueSet(id: string, vs: ValueSet) { if (!vs.id) { @@ -198,7 +199,7 @@ class VsacCache { * @param idOrUrl the url to cache * @returns identifier used to cache the vs */ - getValuesetId(idOrUrl: string) { + getValueSetId(idOrUrl: string) { // is this a url or an id if (idOrUrl.startsWith('http://') || idOrUrl.startsWith('https://')) { const url = new URL(idOrUrl); @@ -213,7 +214,7 @@ class VsacCache { * @param idOrUrl the url to cache * @returns identifier used to cache the vs */ - gtValuesetURL(idOrUrl: string) { + gtValueSetURL(idOrUrl: string) { // is this a url or an id if (idOrUrl.startsWith('http://') || idOrUrl.startsWith('https://')) { return idOrUrl; @@ -223,8 +224,8 @@ class VsacCache { return path; } /** - * Clear all of the cached valuesets - * This currently does not work since merging and updating to use tingo. Drop collection in tingo is broken + * Clear all of the cached ValueSets + * This currently does not work since merging and updating to use TingoDB. Drop collection in TingoDB is broken * */ clearCache() { diff --git a/src/rems-cds-hooks b/src/rems-cds-hooks index 94a78e8c..eb7fd1e1 160000 --- a/src/rems-cds-hooks +++ b/src/rems-cds-hooks @@ -1 +1 @@ -Subproject commit 94a78e8cd27734938ec41858f8d0ca4028da5f21 +Subproject commit eb7fd1e1dc68d9d14b1de6e01a57262accfaa7c1 diff --git a/src/services/questionnaire.service.ts b/src/services/questionnaire.service.ts index d183570f..2bc52529 100644 --- a/src/services/questionnaire.service.ts +++ b/src/services/questionnaire.service.ts @@ -26,22 +26,3 @@ module.exports.questionnairePackage = async (args: any, context: any, logger: an throw result; } }; - -// module.exports.questionnairePackage = (args: any, context: any, logger: any) => { -// logger.info('Running Questionnaire Package /:id/$questionnaire-package'); -// return new Promise((resolve, reject) => { -// const { id } = args; -// const doc = QuestionnaireModel.findOne({ id: id.toString() }, { _id: 0 }).exec(); -// doc.then(async result => { -// if (result) { -// const unprocessedQ: Questionnaire = result.toObject(); -// const parameters = await QuestionnaireUtilities.createPackageFromQuestionnaire( -// unprocessedQ -// ); -// resolve(parameters); -// } else { -// reject(result); -// } -// }); -// }); -// }; diff --git a/test/fixtures/patient.json b/test/fixtures/patient.json index ddd20dde..733af784 100644 --- a/test/fixtures/patient.json +++ b/test/fixtures/patient.json @@ -30,24 +30,16 @@ { "use": "official", "family": "Chalmers", - "given": [ - "Peter", - "James" - ] + "given": ["Peter", "James"] }, { "use": "usual", - "given": [ - "Jim" - ] + "given": ["Jim"] }, { "use": "maiden", "family": "Windsor", - "given": [ - "Peter", - "James" - ], + "given": ["Peter", "James"], "period": { "end": "2002" } @@ -93,10 +85,8 @@ { "use": "home", "type": "both", - "text": "534 Erewhon St PeasantVille, Rainbow, Vic 3999", - "line": [ - "534 Erewhon St" - ], + "text": "534 Erewhon St PleasantVille, Rainbow, Vic 3999", + "line": ["534 Erewhon St"], "city": "PleasantVille", "district": "Rainbow", "state": "Vic", @@ -128,9 +118,7 @@ } ] }, - "given": [ - "Bénédicte" - ] + "given": ["Bénédicte"] }, "telecom": [ { @@ -141,9 +129,7 @@ "address": { "use": "home", "type": "both", - "line": [ - "534 Erewhon St" - ], + "line": ["534 Erewhon St"], "city": "PleasantVille", "district": "Rainbow", "state": "Vic", @@ -161,4 +147,4 @@ "managingOrganization": { "reference": "Organization/1" } -} \ No newline at end of file +} diff --git a/test/server.test.ts b/test/server.test.ts index fa527904..8b57a17b 100644 --- a/test/server.test.ts +++ b/test/server.test.ts @@ -79,7 +79,7 @@ describe('REMSServer class', () => { serverListen.close(); }); - it('should be able to initilize a server', () => { + it('should be able to initialize a server', () => { const newServer = initialize(config); expect(newServer).to.be.instanceOf(REMSServer); expect(newServer).to.have.property('app'); diff --git a/test/vsac_cache.test.ts b/test/vsac_cache.test.ts index 887855e6..9436db86 100644 --- a/test/vsac_cache.test.ts +++ b/test/vsac_cache.test.ts @@ -22,7 +22,7 @@ describe('VsacCache', () => { // the server for CI testing with someones api credentials it('should be able to collect valueset references from Library Resources', async () => { - const valueSets = client.collectLibraryValuesets(library); + const valueSets = client.collectLibraryValueSets(library); expect(valueSets).to.deep.equal( new Set([ 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1219.85', @@ -32,13 +32,13 @@ describe('VsacCache', () => { }); it('should be able to collect valueset references from Questionnaire Resources', async () => { - const valueSets = client.collectQuestionnaireValuesets(questionnaire); + const valueSets = client.collectQuestionnaireValueSets(questionnaire); expect(valueSets).to.deep.equal( new Set(['http://terminology.hl7.org/ValueSet/yes-no-unknown-not-asked']) ); }); - it('should be able to cache valuesets in Library Resources', async function () { + it('should be able to cache ValueSets in Library Resources', async function () { const mockRequest = nock('http://cts.nlm.nih.gov/fhir'); mockRequest @@ -48,7 +48,7 @@ describe('VsacCache', () => { .get('/ValueSet/2.16.840.1.113762.1.4.1219.35/$expand') .reply(200, generateValueset('2.16.840.1.113762.1.4.1219.35')); - const valueSets = client.collectLibraryValuesets(library); + const valueSets = client.collectLibraryValueSets(library); valueSets.forEach(async function (vs) { expect(await client.isCached(vs)).to.be.false; }); @@ -63,13 +63,13 @@ describe('VsacCache', () => { } }); - it('should be able to cache valuesets in Questionnaire Resources', async () => { + it('should be able to cache ValueSet in Questionnaire Resources', async () => { const mockRequest = nock('http://terminology.hl7.org/'); mockRequest .get('/ValueSet/yes-no-unknown-not-asked') .reply(200, generateValueset('yes-no-unknown-not-asked')); - const valueSets = client.collectQuestionnaireValuesets(questionnaire); + const valueSets = client.collectQuestionnaireValueSets(questionnaire); valueSets.forEach(async vs => { expect(await client.isCached(vs)).to.be.false; }); @@ -83,7 +83,7 @@ describe('VsacCache', () => { } }); - it.skip('should be not load valuesets already cached unless forced', async () => { + it.skip('should be not load ValueSets already cached unless forced', async () => { const mockRequest = nock('http://terminology.hl7.org'); const vs = 'http://terminology.hl7.org/ValueSet/yes-no-unknown-not-asked'; @@ -91,23 +91,23 @@ describe('VsacCache', () => { .get('/ValueSet/yes-no-unknown-not-asked') .reply(200, generateValueset('yes-no-unknown-not-asked')); try { - client.collectQuestionnaireValuesets(questionnaire); + client.collectQuestionnaireValueSets(questionnaire); expect(await client.isCached(vs)).to.be.false; - await client.downloadAndCacheValueset(vs); + await client.downloadAndCacheValueSet(vs); expect(await client.isCached(vs)).to.be.true; mockRequest .get('/ValueSet/yes-no-unknown-not-asked') .reply(200, generateValueset('yes-no-unknown-not-asked')); - let update = await client.downloadAndCacheValueset(vs); + let update = await client.downloadAndCacheValueSet(vs); expect(update).to.be.undefined; mockRequest .get('/ValueSet/yes-no-unknown-not-asked') .reply(200, generateValueset('yes-no-unknown-not-asked')); - update = await client.downloadAndCacheValueset(vs, true); + update = await client.downloadAndCacheValueSet(vs, true); expect(update).to.be.true; } finally { @@ -115,14 +115,14 @@ describe('VsacCache', () => { } }); - it('should be able to handle errors downloading valuesests', async () => { + it('should be able to handle errors downloading ValueSets', async () => { const mockRequest = nock('http://terminology.hl7.org/'); const vs = 'http://terminology.hl7.org/ValueSet/yes-no-unknown-not-asked'; mockRequest.get('/ValueSet/yes-no-unknown-not-asked').reply(404, ''); expect(await client.isCached(vs)).to.be.null; let err; try { - err = await client.downloadAndCacheValueset(vs); + err = await client.downloadAndCacheValueSet(vs); expect(err).to.be.undefined; } catch (e) { @@ -133,9 +133,9 @@ describe('VsacCache', () => { } }); - it('Should not attempt to download non-vsac valuesets if configured to do so', async () => { + it('Should not attempt to download non-vsac ValueSets if configured to do so', async () => { client.onlyVsac = true; - const err = await client.downloadAndCacheValueset('http://localhost:9999/vs/1234'); + const err = await client.downloadAndCacheValueSet('http://localhost:9999/vs/1234'); expect(err).to.be.undefined; }); }); diff --git a/tsconfig.json b/tsconfig.json index 64fa6021..ead45709 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,7 +21,7 @@ "jsx": "react-jsx", "paths": { "*": [ - "src/typings/*" + "./src/typings/*" ] } },