Beda EMR is designed to be a framework for building EHR and EMR solutions on top of it. This article describes how you can build your own custom version of Beda EMR suitable for your needs.
We prepared Beda EMR template for quick project initialization. The template
- uses vitejs and yarn for building frontend;
- already includes all required dev dependencies;
- includes Beda EMR as dependency so you could use containers, components, utils, etc. for you EMR;
- has linter, prettier and husky configured for better development experience;
- includes basic lingui configuration
- includes custom aidbox types
- has storybook configured for development your custom components
-
Initialize the project. Start with fork or clone of Beda EMR template.
-
Initialize Beda EMR submodule.
git submodule update --init
- Copy local configuration file for development
cp contrib/emr-config/config.local.js contrib/emr-config/config.js
- Prepare to run
yarn
- Build language locales
yarn compile
- Run
yarn start
Now you have fhir-emr under your full control.
Next steps:
- you can copy the whole https://github.com/beda-software/fhir-emr/blob/master/src/containers/App/index.tsx into your workspace to adjust routes and adjust page components.
- you can replace the patient dashboard and theme as the next step of customization.
Copy envs
cp contrib/fhir-emr/.env.tpl contrib/fhir-emr/.env
add your aidbox license to .env
cd contrib/fhir-emr
docker-compose up
You can update code of EMR inside contrib/fhir-emr
directory.
But to see your changes you need to run
yarn prepare
Remember to push or make pull request for your changes in Beda EMR if you want them to be applied.
Then add updated submodule to your git commit
git add contrib/fhir-emr
git commit -m "Update submodule"
If you have new messages in your app that need to be translated use
yarn extract
then add the translations and run
yarn compile
Storybook works out of the box. If you need to create your own components you can create stories for them.
To run storybook use
yarn storybook
The main storybook for Beda EMR also publicly available here.
1. If you face typescript/eslint error like
Module '"@beda.software/emr/utils"' has no exported member 'getPersonAge'
Make sure that getPersonAge
was used somewhere in the Beda EMR or it was explicitly exported
export * from './relative-date.ts';
2. If you face next eslint error when you import interface or type
Unable to resolve path to module '@beda.software/emr/dist/components/Dashboard/types'.(eslintimport/no-unresolved)
Make sure to add type
when for your import
import type { Dashboard } from '@beda.software/emr/dist/components/Dashboard/types';