3.0.0-beta.4 • Published 8 months ago

ehrcraft-form-api v3.0.0-beta.4

Weekly downloads
1
License
(MIT OR Apache-2....
Repository
github
Last release
8 months ago

EHR Craft Form

This is the definitions of the JS classes used within the EHR Craft Form renderer developed by DIPS AS. The purpose of this library is to be able to write form scripts using typed classes defined with Typescript.

Warning: The library is in early beta and intended for internal use.

Versions

  • 1.5.0 - Added callback on ctx
  • 2.0.0 - Attribute names from upper camelcase to lower camelcase.
  • 2.1.0 - Fixed attribute name value to lower case for DvBoolean.
  • 2.3.x - Added support for terminology and system-configuration search

Adding API 2

  • 3.0.0-alpha1 - adding initial support for the new API; aka api2

Usage

The script engine only runs vanilla JS, thus we need to remove the references to this library when running insinde the form renderer.

To generated vanilla JS from typescript we use the library and setup define by this Yeoman generator: https://www.npmjs.com/package/generator-ehrcraft-script

The following typescript is a boilerplate to get started.

import { API, Container } from "ehrcraft-form-api/dist/api";
import { DvCodedText, DvDateTime, DvQuantity } from "ehrcraft-form-api";

function main(api: API) {
  console.log("Your main function was invoked");
  const t = new DvCodedText();
    t.Value = "Test";
}
// THIS method is invoked from the generated script by generator-ehrcraft-script 
main(api);

The example below illustrates the complete main function with all context objects injected. To make this work the following must be injected in the generated/compiled javascript: main(api,ctx,terminology,config);

import { API, CTX, SystemConfiguration, TerminologyService } from "ehrcraft-form-api";
const f_systolic = "<defined id of the form element for systolic blood pressure>";
export function main(api: API, ctx: CTX, term: TerminologyService, conf: SystemConfiguration){

  api.addListener(f_systolic, "OnChanged", (id, value, parent) => {
    // do something when systolic is changed 
  });


}
3.0.0-beta.4

8 months ago

2.3.0

1 year ago

2.3.4

1 year ago

2.3.3

1 year ago

2.3.5

1 year ago

2.3.8

1 year ago

2.3.7

1 year ago

2.3.9

1 year ago

3.0.0-beta.1

2 years ago

3.0.0-beta.0

2 years ago

3.0.0-beta.3

2 years ago

3.0.0-beta.2

2 years ago

2.2.0

2 years ago

2.1.0

2 years ago

2.0.0

3 years ago

1.5.0

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.0

4 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago