Getting started : Backend service

What is it?

A MIDATA backend service is a nodeJS script running on the MIDATA server. The execution of the script may be triggered by FHIR Subscriptions or FHIR Messages. A backend service may be stand-alone (with no frontend) or it may be part of an application.

How do I start?

MIDATA runs multiple instances of the MIDATA platform for different purposes. At test.midata.coop you find the development and testing instance.

  • Submit your request for a developer account on the test platform. Please note that the issuing of a developer account is conditioned to the pre-existence of a contract and/or a partnership agreement between MIDATA and the requesting party.
  • Then register your application on the test platform.
  • To have access to some data configure the access filter for your application.
  • Setup default Subscriptions for your service. If your service is part of an app or plugin subscriptions may also be created with the API.
  • Download the example plugin.
  • In the API debugger you can test all your queries and ideas before you implement them.
  • Run the service on your local computer and test it inside the portal running at the server.
  • Look at statistics to improve your application and track errors.
  • If everything runs fine contact MIDATA and send your code to deploy it to the productive system.

Libraries

Code that runs directly on the MIDATA server must be written in Javascript for node.js

A midata-nodejs library that contains also testing functionality can be found at:

https://github.com/MIDATAcooperative/midata-nodejs

Authentication

A user session will be directly passed to your script when the script is started by the server.

You can access the session token using the midata library:

const midata = require('midata-nodejs');
const token = midata.token();

Linking with research projects

The use of your application may be recommended by research projects. You may mark your application as only useable if the user participates with a research project.

Debugging

If you use the MIDATA library from above you can use the API debugger to redirect any events for your script to the instance running on your local PC.

You can use the API debugger to send FHIR messages to your backend script.