How to use the fhir.STU3 function in fhir

To help you get started, we’ve selected a few fhir examples, based on popular ways it is used in public projects.

github jembi / hearth / lib / server.js View on Github external
const acceptedJSONContentTypes = ['application/json+fhir', 'application/fhir+json', 'application/json', 'text/json']
const acceptedXMLContentTypes = ['application/xml+fhir', 'application/fhir+xml', 'application/xml', 'text/xml']

process.title = 'Hearth'

let fhir = null
switch (config.getConf('server:fhirVersion')) {
  case 'dstu1':
    fhir = new FHIR(FHIR.DSTU1)
    break
  case 'dstu2':
    fhir = new FHIR(FHIR.DSTU2)
    break
  case 'stu3':
    fhir = new FHIR(FHIR.STU3)
    break
}

if (config.getConf('createIndexes')) {
  matchingIndexes.createMatchingIndexes((err) => {
    if (err) {
      logger.error(err)
    }
    logger.info('Matching Indexes created')
  })
}

moduleLoader.loadModules()
const fhirResources = moduleLoader.getLoadedModules()

// Load validation profiles
github jembi / hearth / lib / plugins / validator.js View on Github external
const FHIR = require('fhir')
const config = require('../config')

const profileLoader = require('../fhir/profile-loader')()

let fhir = null
switch (config.getConf('server:fhirVersion')) {
  case 'dstu1':
    fhir = new FHIR(FHIR.DSTU1)
    break
  case 'dstu2':
    fhir = new FHIR(FHIR.DSTU2)
    break
  case 'stu3':
    fhir = new FHIR(FHIR.STU3)
    break
}

module.exports = () => {
  return {
    hooks: {
      before: [
        {
          resourceType: '*',
          interactions: [ 'create', 'update' ],
          userType: '*',
          function: (interaction, ctx, resourceType, resource, callback) => {
            if (!config.getConf('validation:enabled')) {
              return callback(null, null)
            }

fhir

Library that assists in handling FHIR resources. Supports serialization between JSON and XML, validation and FhirPath evaluation.

Apache-2.0
Latest version published 11 months ago

Package Health Score

67 / 100
Full package analysis