https://github.com/dermatologist/fhirformjs
NPM module to convert FHIR Questionnaire JSON to JSON Schema for form rendering.
https://github.com/dermatologist/fhirformjs
fhir fhir-client fhir-parser hacktoberfest npm-package questionnaire
Last synced: about 2 months ago
JSON representation
NPM module to convert FHIR Questionnaire JSON to JSON Schema for form rendering.
- Host: GitHub
- URL: https://github.com/dermatologist/fhirformjs
- Owner: dermatologist
- License: mit
- Created: 2018-07-01T13:28:40.000Z (over 7 years ago)
- Default Branch: develop
- Last Pushed: 2024-12-09T23:28:15.000Z (10 months ago)
- Last Synced: 2024-12-13T10:38:20.603Z (10 months ago)
- Topics: fhir, fhir-client, fhir-parser, hacktoberfest, npm-package, questionnaire
- Language: TypeScript
- Homepage: https://nuchange.ca
- Size: 2.8 MB
- Stars: 19
- Watchers: 4
- Forks: 8
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Citation: CITATION.cff
Awesome Lists containing this project
README
# fhirformjs
[](https://www.npmjs.com/package/fhirformjs)
[](https://www.npmjs.com/package/fhirformjs)
[](https://nuchange.ca)
[](https://www.npmjs.com/package/fhirformjs)
[](https://dermatologist.github.io/fhirformjs/)## About
Creating, maintaining and using forms for health data capture is vital, and [FHIRForm](https://github.com/E-Health/fhirform) is a framework for that. FHIRFormJS is one of its components (an npm module) that helps create input forms corresponding to a [FHIR questionnaire](https://www.hl7.org/fhir/questionnaire.html). FHIRFormJS does not render forms but converts FHIR questionnaire into a schema and lets other libraries (such as [react-jsonschema-form](https://github.com/rjsf-team/react-jsonschema-form) ) do the heavy lifting. An output mapper that maps the output from a react-jsonschema-form to a [QuestionnaireResponse](https://www.hl7.org/fhir/questionnaireresponse.html) is also available. [Checkout this example React app](https://github.com/dermatologist/fhir-questionnaire-render-react) to see how it is used. This is a modern alternative to [LHC-Forms](https://lhncbc.github.io/lforms/)FHIRFormJS is WIP (not production ready). Pull requests are welcome (See CONTRIBUTING.md) and add issues and feature requests by clicking on the 'issues' tab. :point_up:
## Installation
```
npm i --save fhirformjs
```## Usage example (In a React component)
* FHIRFormJS is framework independent and can be used with other frameworks such as Vue / Angular.
* *Testq1 is a FHIR Questionnaire object*
```
import { FhirJsonForm, FhirJsonResp } from 'fhirformjs'
import Form from "@rjsf/core"
const resp = FhirJsonForm(Testq1)
let formData = {}
let respData = {}
function handleSubmit(data){
respData = FhirJsonResp(resp.model, data, resp.schema)
console.log(JSON.stringify(respData))
}
return (
handleSubmit(e.formData)}
/>
);
```
### Update
**since v0.8.0: Backend API**
```
import { FhirBackend } from 'fhirformjs'
const backend = new FhirBackend('https://lforms-fhir.nlm.nih.gov/baseR4');
console.log(backend.getTableOfContents())
console.log(backend.getQuestionnaire('2050148'))
```
### [See an example](https://github.com/dermatologist/fhir-questionnaire-render-react) :point_left:## Give us a star ⭐️
If you find this project useful, give us a star. It helps others discover the project.## Author
* [Bell Eapen](https://nuchange.ca) [](https://twitter.com/beapen)
## Contributor(s)
* [Marco Ferreira](https://rco.cc) [](https://twitter.com/marfife)