npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fhirball

v0.1.3

Published

An Express router for a nodejs+MongoDB FHIR server

Downloads

265

Readme

fhirball

fhirball

An Express router for a nodejs+MongoDB FHIR server. Provides a RESTful API that partially implements the FHIR DSTU 1 proposal. Service configuration is defined using a Conformance resource. The server performs only trivial validation - if you post well-formed resources then you can read well-formed resources!

Prerequisites

Node.js 10+, MongoDB 2.6+

Use

To install fhirball:

$ npm install fhirball
$ npm install express

To use fhirball create a javascript file and reference express and fhirball packages:

var express = require('express');
var fhirball = require('fhirball');

Declare the conformance statement for the server. The conformance statement is parsed on startup and used to generate resource interactions and searches. SearchParams use extensions to define the document paths to be searched and whether an index should be created to support the search. For example, to create a Master Patient Index with basic audit capability:

var conformance = {
    resourceType: 'Conformance',
    publisher: 'Fhirball',
    date: new Date(),
    software: {
        name: 'fhirball',
        version: '0.0.7'
    },
    implementation: {
        description: 'Master Patient Index service',
        url: 'http://127.0.0.1:1337/fhir/'
    },
    fhirVersion: '0.0.82',
    rest: [
        {
            mode: 'server',
            resource: [
                {
                    type: 'Patient',
                    operation: [
                        {code: 'read'},
                        {code: 'vread'},
                        {code: 'update'},
                        {code: 'delete'},
                        {code: 'history-instance'},
                        {code: 'create'},
                        {code: 'history-type'},
                        {code: 'search-type'}
                    ],
                    searchParam: [
                        {
                            name: 'birthdate',
                            type: 'date',
                            documentation: 'The patient\'s date of birth',
                            extension: [
                                {
                                    url: 'http://fhirball.com/fhir/Conformance#search-path',
                                    valueString: 'Patient.birthDate'
                                },
                                {
                                    url: 'http://fhirball.com/fhir/Conformance#search-contentType',
                                    valueString: 'date'
                                },
                                {
                                    url: 'http://fhirball.com/fhir/Conformance#search-index',
                                    valueBoolean: true
                                }
                            ]
                        },
                        {
                            name: 'name',
                            type: 'string',
                            documentation: 'A portion of the family name of the patient. Case-sensitive.',
                            extension: [
                                {
                                    url: 'http://fhirball.com/fhir/Conformance#search-path',
                                    valueString: 'Patient.name'
                                },
                                {
                                    url: 'http://fhirball.com/fhir/Conformance#search-contentType',
                                    valueString: 'HumanName'
                                },
                                {
                                    url: 'http://fhirball.com/fhir/Conformance#search-index',
                                    valueBoolean: true
                                }
                            ]
                        },
                        {
                            name: 'identifier',
                            type: 'token',
                            documentation: 'A patient identifier',
                            extension: [
                                {
                                    url: 'http://fhirball.com/fhir/Conformance#search-path',
                                    valueString: 'Patient.identifier'
                                },
                                {
                                    url: 'http://fhirball.com/fhir/Conformance#search-contentType',
                                    valueString: 'Identifier'
                                },
                                {
                                    url: 'http://fhirball.com/fhir/Conformance#search-index',
                                    valueBoolean: true
                                }
                            ]
                        }
                    ]             
                },
                {
                    type: 'SecurityEvent',
                    operation: [
                        {code: 'read'},
                        {code: 'create'},
                        {code: 'search-type'}
                    ],
                    searchParam: [
                    ]
                }
            ]

        }
    ]
};

Declare fhirball options, a mongodb connection string, the conformance statement and the content-type (currently must be application/json)

var options = {
    db: 'mongodb://localhost/fhirball-demo',
    conformance: conformance,
    'content-type': 'application/json'
};

Create and start app using fhirball router to provide FHIR api:

var app = express();
app.use('/fhir/', new fhirball.Router(options));

//start the app
app.listen(1337);
console.log(conformance.implementation.description,'listening for requests on port 1337');

Test

To execute unit tests:

npm install
mocha --recursive ./test/spec

To execute integration tests, performing CRUD operations on each sample resource:

mocha --recursive ./test/e2e

Integration tests assume a mongod instance running on localhost.

Copyright

Copyright 2014-2015, 2020 Black Pear Software Ltd.

This material contains content from HL7. Unless otherwise noted in the filename, sample FHIR resources in test/e2e/data are © HL7.org 2011+ and used under license (http://www.hl7.org/implement/standards/fhir/license.html)

License

fhirball is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

fhirball is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Acknowledgements

Supported by Black Pear Software

Additional contributions from freshEHR

HL7 FHIR Powered by MongoDB