A SMART app for FHIR SDC Questionnaire
This is a SMART app that can be used in EHR (electonic health record) systems supporting SMART on FHIR to display FHIR SDC Questionnaire forms and collect data as FHIR QuestionnaireResponse resources.
There is a demo of this app running as a GitHub pages website, but to see it work with a SMART on FHIR context, try it out via the SMART App Gallery. (That will open a page containing the GitHub pages demo, but the SMART on FHIR connection will be established, so you will be able to save and load FHIR resources.)
For some sample forms to try, this repository comes with some forms under e2e-test/data which are used by the test code to test the app. The FHIR server in the SMART App Gallery gets reset nightly, so might not find Questionnaires there, but you can always use the Upload button to upload a new Questionnaire resource. If downloading one of the forms from GitHub, be sure click on the "Raw" button, which will open a page which only has the Questionnaire data. For example: https://raw.githubusercontent.com/lhncbc/lforms-fhir-app/master/e2e-tests/data/vital-sign-questionnaire.json will open a page for a vital signs Questionnaire which you can save to a local file and then use "Upload" to use it in the app.
Customizing the App
If you wish to install and build the app locally so that you can customize it, see below. Note that adding support for additional parts of the SDC specification will require edits to the LHC-Forms widget. (Pull requests are very welcome, but it might be better to open an issue first to see if we are already working on that feature.)
We have two kinds of dependencies in this project: tools and Angular framework code. The tools help us manage and test the application.
- We get the tools we depend upon via
npm, the Node package manager (npm).
- We get the Angular code via
bower, a client-side code package manager (bower).
- In order to run the end-to-end tests, you will also need to have the Java Development Kit (JDK) installed on your machine. Check out the section on end-to-end testing for more info.
We have preconfigured
npm to automatically run
bower so we can simply do:
Behind the scenes this will also call
bower install. After that, you should find out that you have
two new folders in your project.
node_modules- contains the npm packages for the tools we need
app/bower_components- contains the Angular framework files
Note that the
bower_components folder would normally be installed in the root folder but
angular-seed changes this location through the
.bowerrc file. Putting it in the
makes it easier to serve the files by a web server.
Run the Application
We have preconfigured the project with a simple development web server. The simplest way to start this server is:
Now browse to the app at
Running End-to-End Tests
angular-seed app comes with end-to-end tests, again written in Jasmine. These tests
are run with the Protractor End-to-End test runner. It uses native events and has
special features for Angular applications.
- The configuration is found at
- The end-to-end tests are found in
Protractor simulates interaction with our web app and verifies that the application responds correctly. Therefore, our web server needs to be serving up the application, so that Protractor can interact with it.
Before starting Protractor, open a separate terminal window and run:
In addition, since Protractor is built upon WebDriver, we need to ensure that it is installed and
angular-seed project is configured to do this automatically before running the
end-to-end tests, so you don't need to worry about it. If you want to manually update the WebDriver,
you can run:
npm run update-webdriver
Once you have ensured that the development web server hosting our application is up and running, you can run the end-to-end tests using the supplied npm script:
npm run protractor
This script will execute the end-to-end tests against the application being hosted on the development server.