NHS Services

Introduction 🔗︎ click to copy

Mydex Data Services CIC provides an API known as the 'Master Reference Data Services' or MRD. This API provides access to a variety of non-personal, general purpose datasets that may be of use when integrating with the rest of the Mydex platform or simply a valuable managed API service for a range of datasets that can be subscribed to.

The following services / datasets are available:

These services can work with each other within MRD so searching on one can bring together content from other services to enable the creation of modular information blocks that can be presented as a coherent experience and provide integrated information

The NHS are the curators and publishers of this data. The Mydex MRD service takes regular updates of the source content which it hosts itself to enable it to be offered for integration into MRD subscribers own services and applications.

Mydex manages the data pipeline and automated process for ensuring Mydex MRD service remains up to date acting as a managed service for its subscribers to reduce their own development and management costs of using NHS Data seamlessly within their own applications.

Mydex's MRD Services also offers search capability for data using keywords and filters. Mydex's MRD API also allows filtering to:

Subscribers to MRD use these managed lists, directories and look-ups to embed content into their own apps and services such as delivering personalised lists based on an individual's profile set in the subscribers application or service.

This guide explains:

If you encounter issues either getting authenticated to or using the MRD API, please contact support@mydex.org. Our team is ready and always happy to help you with any issues.

Authenticating with OAuth2.0 🔗︎ click to copy

The Mydex MRD API requires authentication using the industry standard OAuth2.0 protocol. Please see our online documentation for more information on this: https://dev.mydex.org/mrd-api/mrd-authentication.html

Returning data via a specified route 🔗︎ click to copy

Available services 🔗︎ click to copy

Currently available NHS services available via the Mydex Master Reference Data service offering are as follows:

Making a request 🔗︎ click to copy

All services operate in the same way and have the same features. We will take Medicines as an example for how to make a request, but the same applies for each of the services listed above.

The most basic request that can be made is to the root route:

This will return a list of candidate routes that can be requested. Making a request to any of the routes listed will return the data linked to that route.

Some example requests for service data are as follows:

A simple request like this can be made to any route and it will return that data. There are also options (flags) available for stripping html tags and replacing links to our own MRD api with links to the NHS website which we will cover next.

[You can see examples of how these impact the data under the heading Flag setting examples below]

Flag settings 🔗︎ click to copy

There are two possible flag settings which can be set independently of each other or together. These settings are:

These flags can be applied in the request as per the examples below:

Note: If both flags are set, the order in which they appear in the request does not matter.

No flags set: What is returned by default? 🔗︎ click to copy

By default, other Mydex MRD API endpoints are made available for use directly within the response. This means that links can be made across different services to build a dynamic range of data payloads.

For any api links to services that are currently hosted by the MRD api, they are, by default, made available in the return payload. Currently that includes:

In any text fields containing such links, an index replaces the link, and the link itself can be found in an array added to the payload along with the text. Standalone url fields are updated with the MRD api endpoint as appropriate.

What does no_html do? 🔗︎ click to copy

Setting this flag removes all the html tags from any text field and stores any links in an array links[] along with the text field.

What does nhs_links do? 🔗︎ click to copy

Any links to the nhs_api are updated to the nhs website. No links to the MRD api endpoint will be returned in the payload.


Flag setting examples🔗︎ click to copy

Here you can see some snippets of data to show how the different flag settings change parts of the content we return to you from your request.

Urls

The data contains url fields that can contain links to various NHS api services. Below you can see an example of how one of these fields is updated with each combination of flag-setting.

Default no flags
"url": "https://api-mrd.mydex.org/medicines/paxlovid/",
?no_html=true
"url": "https://api-mrd.mydex.org/medicines/paxlovid/",
?nhs_links=true
"url": "https://www.nhs.uk/medicines/paxlovid/",
?nhs_links=true&no_html=true
"url": "https://www.nhs.uk/medicines/paxlovid/",

Text

The data contains text fields that are typically html and can contain links to various NHS website locations. Below you can see an example of how one of these fields is updated with each combination of flag-setting.

Default no flags
"text": "<p>Most adults aged 18 years old and over can take clonazepam tablets and liquid.</p><p>Most children from 1 month old can take it for epilepsy.</p><h2>Who may not be able to take clonazepam</h2><p>Clonazepam is not suitable for some people.</p><p>To make sure it's safe for you, tell your doctor before starting to take clonazepam if you:</p><ul><li>have ever had an allergic reaction to clonazepam or any other medicine</li><li>have <a index-link=[0]>myasthenia gravis</a>, a condition that causes muscle weakness</li><li>have <a index-link=[1]>sleep apnoea</a>, a condition that causes breathing problems when you're asleep</li><li>have lung, liver or kidney problems</li><li>have spinal or cerebellar ataxia, where you may become shaky and unsteady and have slurred speech</li><li>have ever had problems with alcohol or drugs</li><li>have recently had a loss or bereavement, depression or thoughts of harming yourself or suicide</li><li>have been diagnosed with a <a index-link=[2]>personality disorder</a></li><li>are trying to get pregnant, are already pregnant or breastfeeding</li><li>are going to be put to sleep (have a <a index-link=[3]>general anaesthetic</a>) for an operation or dental treatment</li></ul>",
"links": [
   {
      "key": "index-link=[0]",
      "mrd_api_link": "https://api-mrd.mydex.org/conditions/myasthenia-gravis/"
   },
   {
      "key": "index-link=[1]",
      "mrd_api_link": "https://api-mrd.mydex.org/conditions/sleep-apnoea/"
   },
   {
      "key": "index-link=[2]",
      "mrd_api_link": "https://api-mrd.mydex.org/mental-health/conditions/personality-disorder/"
   },
   {
      "key": "index-link=[3]",
      "mrd_api_link": "https://api-mrd.mydex.org/conditions/general-anaesthesia/"
   }
]
?no_html=true
"text": "Most adults aged 18 years old and over can take clonazepam tablets and liquid. Most children from 1 month old can take it for epilepsy. Who may not be able to take clonazepam Clonazepam is not suitable for some people. To make sure it's safe for you, tell your doctor before starting to take clonazepam if you: have ever had an allergic reaction to clonazepam or any other medicine have myasthenia gravis, a condition that causes muscle weakness have sleep apnoea, a condition that causes breathing problems when you're asleep have lung, liver or kidney problems have spinal or cerebellar ataxia, where you may become shaky and unsteady and have slurred speech have ever had problems with alcohol or drugs have recently had a loss or bereavement, depression or thoughts of harming yourself or suicide have been diagnosed with a personality disorder are trying to get pregnant, are already pregnant or breastfeeding are going to be put to sleep (have a general anaesthetic) for an operation or dental treatment",
"links": [
   {
      "mrd_api_link": "https://api-mrd.mydex.org/conditions/myasthenia-gravis/"
   },
   {
      "mrd_api_link": "https://api-mrd.mydex.org/conditions/sleep-apnoea/"
   },
   {
      "mrd_api_link": "https://api-mrd.mydex.org/mental-health/conditions/personality-disorder/"
   },
   {
      "mrd_api_link": "https://api-mrd.mydex.org/conditions/general-anaesthesia/"
   }
]
?nhs_links=true
"text": "<p>Most adults aged 18 years old and over can take clonazepam tablets and liquid.</p><p>Most children from 1 month old can take it for epilepsy.</p><h2>Who may not be able to take clonazepam</h2><p>Clonazepam is not suitable for some people.</p><p>To make sure it's safe for you, tell your doctor before starting to take clonazepam if you:</p><ul><li>have ever had an allergic reaction to clonazepam or any other medicine</li><li>have <a href=\"https://www.nhs.uk/conditions/myasthenia-gravis/\">myasthenia gravis</a>, a condition that causes muscle weakness</li><li>have <a href=\"https://www.nhs.uk/conditions/sleep-apnoea/\">sleep apnoea</a>, a condition that causes breathing problems when you're asleep</li><li>have lung, liver or kidney problems</li><li>have spinal or cerebellar ataxia, where you may become shaky and unsteady and have slurred speech</li><li>have ever had problems with alcohol or drugs</li><li>have recently had a loss or bereavement, depression or thoughts of harming yourself or suicide</li><li>have been diagnosed with a <a href=\"https://www.nhs.uk/mental-health/conditions/personality-disorder/\">personality disorder</a></li><li>are trying to get pregnant, are already pregnant or breastfeeding</li><li>are going to be put to sleep (have a <a href=\"https://www.nhs.uk/conditions/general-anaesthesia/\">general anaesthetic</a>) for an operation or dental treatment</li></ul>"
?nhs_links=true&no_html=true
"text": "Most adults aged 18 years old and over can take clonazepam tablets and liquid. Most children from 1 month old can take it for epilepsy. Who may not be able to take clonazepam Clonazepam is not suitable for some people. To make sure it's safe for you, tell your doctor before starting to take clonazepam if you: have ever had an allergic reaction to clonazepam or any other medicine have myasthenia gravis, a condition that causes muscle weakness have sleep apnoea, a condition that causes breathing problems when you're asleep have lung, liver or kidney problems have spinal or cerebellar ataxia, where you may become shaky and unsteady and have slurred speech have ever had problems with alcohol or drugs have recently had a loss or bereavement, depression or thoughts of harming yourself or suicide have been diagnosed with a personality disorder are trying to get pregnant, are already pregnant or breastfeeding are going to be put to sleep (have a general anaesthetic) for an operation or dental treatment",
"links": [
   "https://www.nhs.uk/conditions/myasthenia-gravis/",
   "https://www.nhs.uk/conditions/sleep-apnoea/",
   "https://www.nhs.uk/mental-health/conditions/personality-disorder/",
   "https://www.nhs.uk/conditions/general-anaesthesia/"
]

Returning data by searching/filtering on one or more keywords🔗︎ click to copy

* This feature is currently in development for Medicines and Pregnancy *. For Conditions, Live Well and Mental Health, please refer to their respective documentation:

Please Note: Mydex also offers a Cross-Service search capability for unified search results across the different MRD services you are subscribed to. Click here to find out more.