EMR template

Intro

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

Quick start guide

  1. Initialize the project. Start with fork or clone of Beda EMR template.

  2. Initialize Beda EMR submodule.

git submodule update --init
  1. Copy local configuration file for development
cp contrib/emr-config/config.local.js contrib/emr-config/config.js
  1. Prepare to run
yarn
  1. Build language locales
yarn compile
  1. Run
yarn start

Now you have fhir-emr under your full control.

Next steps:

Running backend

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

Adding new code to EMR submodule

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"

Language locales

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

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.

Imports troubleshooting

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';