-
Notifications
You must be signed in to change notification settings - Fork 19
Flux Notes Data Sources
Patient data in Flux Notes can come from a variety of sources, hardcoded or otherwise. To ensure that we approach loading data into Flux Notes in a modular way, we have a variety of data source classes in src/dataaccess
- Hardcoded Patient JSON
- FHIR API Data Source
- REST API Data Source
- SMART on FHIR Data Source
Each of these data sources extend the IDataSource
class (src/dataaccess/IDataSource.jsx
), which serves as an interface to define the function that a Flux Notes data should implement for data to load correctly.
All data sources provide Flux Notes Object Model as output and accept it as input. What differentiates them from each other is what data format and protocol they use on the other side to retrieve and store data external to the application. The name of the data source should reflect the expected format and protocol for data between the application and the external data source.
For example, if the incoming data is FHIR DSTU2 coming from a REST API, an appropriate name would be FhirDstu2RestApiDataSource.jsx
which clearly indicates the incoming format and protocol of the data.
- Create a new file
src/dataaccess/NewDataSource.jsx
(with a descriptive name) and make a class that extendsIDataSource
:
import IDataSource from './IDataSource';
class NewDataSource extends IDataSource {
}
export default NewDataSource;
- Define
this._gestalt
in the constructor and implementgetGestalt
. This object defines which CRUD operations support async or synchronous access for the data source:
import IDataSource from './IDataSource';
class NewDataSource extends IDataSource {
constructor() {
super();
this._gestalt = {
create: {
async: false,
sync: false
},
read: {
async: false,
sync: true
},
update: {
async: false,
sync: false
},
delete: {
async: false,
sync: false
}
};
}
getGestalt() {
return this._gestalt;
}
}
export default NewDataSource;
- Implement
getPatient
At the very least,getGestalt
andgetPatient
must be implemented for the data source to load into Flux Notes:
import IDataSource from './IDataSource';
import PatientRecord from '../patient/PatientRecord';
class NewDataSource extends IDataSource {
constructor() {
super();
this._gestalt = {
create: {
async: false,
sync: false
},
read: {
async: false,
sync: true
},
update: {
async: false,
sync: false
},
delete: {
async: false,
sync: false
}
};
}
getGestalt() {
return this._gestalt;
}
getPatient(id, callback) {
/* get the patient JSON in the correct format */
return new PatientRecord(/* your JSON*/);
}
}
export default NewDataSource;
Cases my arise where incoming FHIR in a given data source needs to be passed through a mapper to accurately align the JSON with what the Flux Notes Object Model expects (e.g. putting mCODE profiles on incoming FHIR)
The fhir-mapper library allows for the authoring of mappers for any format of incoming FHIR to have mCODE profiles. The project README lists the current implemented mappers, as well as includes a guide for developing a new mapper.
Once the mapper exists in fhir-mapper
it can easily be pulled into a data source to apply the mapping to data:
import IDataSource from './IDataSource';
import PatientRecord from '../patient/PatientRecord';
import { someMapper } from 'fhir-mapper';
class NewDataSource extends IDataSource {
constructor() {
super();
this._gestalt = {
create: {
async: false,
sync: false
},
read: {
async: false,
sync: true
},
update: {
async: false,
sync: false
},
delete: {
async: false,
sync: false
}
};
}
getGestalt() {
return this._gestalt;
}
getPatient(id, callback) {
const resources = /* list of FHIR resources from the JSON */;
const results = someMapper.execute(resources); // mapped results that can be replaced in the JSON
return new PatientRecord(/* your JSON*/);
}
}
export default NewDataSource;
Copyright © 2017 The MITRE Corporation | Approved for Public Release; Distribution Unlimited. Case Number 16‑1988
- Home
- About Flux Notes
- Active Treatment Summary Objects
- Data Standards for Breast Cancer
- Database decision
- Declarative Shortcut Format
- Demo Script
- Deployment Plan - Lite Mode
- Dragon Software Information and Troubleshooting
- Flux Notes Lite Demo Script
- How To Create New Shortcuts
- Interaction Between REACT.js Components in Flux
- JavaScript and HTML Code Style Guide
- Key Application Features
- Minimap Evaluation
- Naming Convention for Visual Components
- NLP Server: Provisioning and Troubleshooting
- Pre Release Testing Script
- Profiling and Performance
- Redux Implementation Guide
- Shorthand Context Problem
- Testing
- Third Party Libraries Changes
- Demo Scenarios -- (out of date)