Skip to content
Open
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:erbium
FROM node:gallium-bullseye-slim

# install dependencies
ADD package.json yarn.lock /src/hearth/
Expand Down
30 changes: 15 additions & 15 deletions lib/fhir/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ function buildOperationOutcome (severity, code, detailsText, diagnostics) {
resourceType: 'OperationOutcome',
issue: [
{
severity: severity,
code: code,
severity,
code,
details: {
text: detailsText
},
Expand Down Expand Up @@ -57,7 +57,7 @@ module.exports = exports = (mongo) => {

const buildHTTPOutcome = (httpStatus, severity, code, detailsText, diagnostics) => {
return {
httpStatus: httpStatus,
httpStatus,
resource: buildOperationOutcome(severity, code, detailsText, diagnostics)
}
}
Expand Down Expand Up @@ -96,9 +96,9 @@ module.exports = exports = (mongo) => {
doc.meta.security = []
}
doc.meta.security.push({
system: system,
code: code,
display: display
system,
code,
display
})
}

Expand Down Expand Up @@ -348,7 +348,7 @@ module.exports = exports = (mongo) => {
*/
// end jsdoc

formatResource: formatResource,
formatResource,

bundleResults: (type, entries, total, callingUrl) => {
const url = URI(callingUrl)
Expand All @@ -358,7 +358,7 @@ module.exports = exports = (mongo) => {
meta: {
lastUpdated: moment().format(dateFormat)
},
type: type,
type,
total: ((total !== null) ? total : entries.length),
link: [
{
Expand Down Expand Up @@ -408,11 +408,11 @@ module.exports = exports = (mongo) => {
})
},

buildOperationOutcome: buildOperationOutcome,
buildHTTPOutcome: buildHTTPOutcome,
buildOperationOutcome,
buildHTTPOutcome,
internalServerErrorOutcome: () => buildOperationOutcome('fatal', 'exception', 'Internal server error'),

isValidReferenceString: isValidReferenceString,
isValidReferenceString,

/**
* Extracts an attachment from a document and stores it seperately, removing it from the document
Expand Down Expand Up @@ -540,11 +540,11 @@ module.exports = exports = (mongo) => {
* @param {Function} callback (err, array<String>) with array an list of resources,
* e.g. ['Practitioner/123']
*/
lookupPractitionersForOrganization: lookupPractitionersForOrganization,
lookupPractitionersForOrganization,

breakTheGlassCategory: 'http://hl7.org/fhir/security-label#break-the-glass',

addSecurityLabel: addSecurityLabel,
addSecurityLabel,

addSubsettedSecurityLabel: (doc) => {
addSecurityLabel(doc, 'http://hl7.org/fhir/ValueSet/v3-SecurityIntegrityObservationValue', 'SUBSETTED', 'subsetted')
Expand Down Expand Up @@ -619,15 +619,15 @@ module.exports = exports = (mongo) => {
}
},

generateID: generateID,
generateID,

/**
* Validate a value as a FHIR id datatype
*
* @param {String} id The value to validate
* @return {Boolean}
*/
validateID: validateID
validateID

}
}
Expand Down
30 changes: 15 additions & 15 deletions lib/fhir/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ module.exports = (mongo, modules) => {
}

const c = db.collection(resourceType)
c.findOne({ id: id }, (err, resource) => {
c.findOne({ id }, (err, resource) => {
if (err) {
return callback(err)
}

if (!resource) {
const c = db.collection(`${resourceType}_history`)
c.findOne({ id: id }, (err, resource) => {
c.findOne({ id }, (err, resource) => {
if (err) {
return callback(err)
}
Expand Down Expand Up @@ -144,7 +144,7 @@ module.exports = (mongo, modules) => {

const c = db.collection(resourceType)

c.findOne({ id: id, 'meta.versionId': vid }, (err, resource) => {
c.findOne({ id, 'meta.versionId': vid }, (err, resource) => {
if (err) {
return callback(err)
}
Expand All @@ -162,7 +162,7 @@ module.exports = (mongo, modules) => {

if (!resource) {
const cHistory = db.collection(`${resourceType}_history`)
cHistory.findOne({ id: id, 'meta.versionId': vid }, (err, resource) => {
cHistory.findOne({ id, 'meta.versionId': vid }, (err, resource) => {
if (err) {
return callback(err)
}
Expand Down Expand Up @@ -499,7 +499,7 @@ module.exports = (mongo, modules) => {
}

const location = `/fhir/${resourceType}/${resource.id}/_history/${resource.meta.versionId}`
callback(null, { httpStatus: 201, location: location, id: resource.id })
callback(null, { httpStatus: 201, location, id: resource.id })
})
})
})
Expand Down Expand Up @@ -540,7 +540,7 @@ module.exports = (mongo, modules) => {
}
const c = db.collection(resourceType)

c.findOne({ id: id }, {}, (err, result) => {
c.findOne({ id }, {}, (err, result) => {
if (err) {
return callback(err)
}
Expand Down Expand Up @@ -573,7 +573,7 @@ module.exports = (mongo, modules) => {
}

c.findOneAndReplace({
id: id
id
}, resource, options, (err, result) => {
if (err) {
return callback(err)
Expand All @@ -586,7 +586,7 @@ module.exports = (mongo, modules) => {
}

const location = `/fhir/${resourceType}/${resource.id}/_history/${resource.meta.versionId}`
callback(null, { httpStatus: 201, location: location, etag: resource.meta.versionId, id: resource.id })
callback(null, { httpStatus: 201, location, etag: resource.meta.versionId, id: resource.id })
})
}

Expand All @@ -609,9 +609,9 @@ module.exports = (mongo, modules) => {
const location = `/fhir/${resourceType}/${id}/_history/${resource.meta.versionId}`
callback(null, {
httpStatus: 200,
location: location,
location,
etag: resource.meta.versionId,
id: id
id
})
})
})
Expand Down Expand Up @@ -648,13 +648,13 @@ module.exports = (mongo, modules) => {
}

const c = db.collection(resourceType)
c.findOneAndDelete({ id: id }, (err, result) => {
c.findOneAndDelete({ id }, (err, result) => {
if (err) {
return callback(err)
}

if (!result.value) {
return callback(null, { httpStatus: 204, id: id })
return callback(null, { httpStatus: 204, id })
}

const historyDoc = result.value
Expand Down Expand Up @@ -685,12 +685,12 @@ module.exports = (mongo, modules) => {
return handleErrorAndBadRequest(err, badRequest, callback)
}

callback(null, { httpStatus: 204, id: id })
callback(null, { httpStatus: 204, id })
})
})
})
} else {
cHistory.remove({ id: id }, (err) => {
cHistory.remove({ id }, (err) => {
if (err) {
return callback(err)
}
Expand All @@ -700,7 +700,7 @@ module.exports = (mongo, modules) => {
return handleErrorAndBadRequest(err, badRequest, callback)
}

callback(null, { httpStatus: 204, id: id })
callback(null, { httpStatus: 204, id })
})
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/fhir/module-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = exports = (mongo) => {
})
},

getLoadedModules: getLoadedModules
getLoadedModules
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/fhir/query-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ module.exports = (mongo) => {
}

return {
path: path,
path,
condition: conditionalMatch ? conditionalMatch[1] : null // 2nd index - no brackets
}
}
Expand Down Expand Up @@ -402,6 +402,6 @@ module.exports = (mongo) => {

return {
private: exposedPrivateFuncsForTesting,
buildQuery: buildQuery
buildQuery
}
}
4 changes: 2 additions & 2 deletions lib/fhir/query-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ module.exports = (mongo) => {
* @param {String} value The date value to transform
* @returns {Date} The transformed date
*/
transformDate: transformDate,
transformDate,

tokenToSystemValue: (fieldToMatch, token, propertyDefObj) => {
const match = (fieldToMatch, token) => {
Expand Down Expand Up @@ -360,7 +360,7 @@ module.exports = (mongo) => {
return null
},

paramAsReference: paramAsReference,
paramAsReference,

/**
* Build a mongo query clause that allows for date or period searching.
Expand Down
4 changes: 2 additions & 2 deletions lib/fhir/query-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const extensionConf = require('../../config/queryparam-extensions.json')

module.exports = () => {
return {
standardFHIRParams: standardFHIRParams,
standardFHIRSearchParams: standardFHIRSearchParams,
standardFHIRParams,
standardFHIRSearchParams,

validateQueryParams: (resourceType, queryParams, customSupported, callback) => {
const supportedParams = Object.assign({}, searchParamsMap[resourceType], customSupported, extensionConf[resourceType])
Expand Down
20 changes: 10 additions & 10 deletions lib/fhir/resources/matching.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module.exports = (mongo) => {
url: 'http://hl7.org/fhir/StructureDefinition/match-grade',
valueCode: scoreToString(score)
},
score: score
score
}
}
return matchesMap[key]
Expand Down Expand Up @@ -210,9 +210,9 @@ module.exports = (mongo) => {
return {
name: 'Matching',

algorithms: algorithms,
createEliminateMatchingOnSelfQuery: createEliminateMatchingOnSelfQuery,
appendToQuery: appendToQuery,
algorithms,
createEliminateMatchingOnSelfQuery,
appendToQuery,

match: (resourceType, queryResource, count, callback) => {
const resourceId = queryResource.id
Expand Down Expand Up @@ -252,12 +252,12 @@ module.exports = (mongo) => {
case 'levenshtein': {
const workerContext = {
workerName: `mpi_query_${path}`,
resourceType: resourceType,
queryResource: queryResource,
path: path,
algorithm: algorithm,
weight: weight,
discriminatorQuery: discriminatorQuery
resourceType,
queryResource,
path,
algorithm,
weight,
discriminatorQuery
}

promises.push(matchingWorker.startMatchingWorker(workerContext))
Expand Down
4 changes: 2 additions & 2 deletions lib/fhir/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ module.exports = (mongo, modules, callback) => {
const pushReverts = (revertType, successStatusArray) => {
if (successStatusArray.indexOf(outcome.httpStatus) > -1) {
revert[revertType].push({
resourceType: resourceType,
resourceType,
id: outcome.id
})
}
Expand Down Expand Up @@ -102,7 +102,7 @@ module.exports = (mongo, modules, callback) => {
}

const processEntry = (baseCtx, entry, revert, isTransaction, callback) => {
const parsedUrl = url.parse(entry.request.url, true) // eslint-disable-line node/no-deprecated-api
const parsedUrl = url.parse(entry.request.url, true) // eslint-disable-line n/no-deprecated-api

const entryCtx = {
authenticatedUser: baseCtx.authenticatedUser,
Expand Down
2 changes: 1 addition & 1 deletion lib/fhir/services/matching-worker/matching-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ module.exports = (mongo) => {
}

return {
startMatchingWorker: startMatchingWorker
startMatchingWorker
}
}
2 changes: 1 addition & 1 deletion lib/fhir/services/terminology-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = (mongo) => {
'codeSystem.system': system,
'codeSystem.concept': {
$elemMatch: {
code: code
code
}
}
}
Expand Down
Loading