Skip to content
APIsIntegration GuidesPrescription analysis

Prescription analysis API

Introduction

These APIs make it possible to detect problems related to medications taken by a patient and to offer alternative treatments.

This guide will allow you to make your first calls very quickly!

The information below details the full application integration import and validation of the prescription, to integrate directly by API, please go to the dedicated documentation of interactions or contraindications

How it works ?

Authorisation

The application requests an identity token from the authentication API (see Identity token authentication)

Good to know: If you are just looking for the name of the drug or its name associated with a dosage and/or form, it will work the same way.

Recovery of virtual drug identifiers

Our algorithm uses virtual drugs as the main parameter, that is to say a view of the drug devoid of brand or laboratory names. All medications on the market are present in this form in our database.

Queries to our algorithms use these identifiers. To recover it, several possibilities:

  • Either you already have it following the use of another API such as Prescription Scan
  • Either you already use our database and you have this information in your application
  • Or you can very easily use our Autocomplete API to retrieve a drug identifier from a full drug name.

For this guide, we will use the latter way of doing things.

Analytics API call

Once equipped with the necessary virtual drug identifiers, you can call our GraphQL analytics API.

API call URLs

The base url is https://api.{env}.posos.co where {env} is the following environment: preprod for validation, production for live.

https://api.preprod.posos.co

Good to know: The service account private key is different for each environment. We will send you the production key once testing is complete.

Detailed operation

Authorization and API calls

This guide assumes that you have read and tested the API Calls and Identity Token Authentication pages. In the following, the retrieved identity token will simply be called token.

Recovery of virtual drug identifiers

As mentioned, we use the Autocompletion API to obtain the necessary identifiers. Follow the documentation and make an API call with the following URL parameters:

query: <the name of the medicine in full>
entity_type: DRUG
k:5
thresh: 0.4
drug_concept_levels: CLINICAL_DRUG
drug_concept_levels: BRANDED_DRUG
drug_concept_levels: INGREDIENT

Good to know: If you are just looking for the name of the drug or its name associated with a dosage and/or form, it will work the same way.

The virtual drug identifier (type = CLINICAL_DRUG) is found in the code field of the posos object of the list of codings contained in the result. The JSONPath to get it is $.candidates[0].codings.posos[0].code.

The recommended identifier for specialties (type = BRANDED_DRUG) is found in the code field of the CIS object of the list of codings contained in the result.

The recommended identifier for the ingredients (type = INGREDIENT) is found in the code field of the inn object of the list of codings contained in the result. If the inn object is empty, use the SMS object.

Examples

Test for example with simvastatin and clarithromycin:

Query

GET
/autocomplete-api/autocomplete
curl --request GET -s \
   --url "https://api.preprod.posos.co/autocomplete-api/autocomplete?query=simvastatin&entity_type=CLINICAL_DRUG&k=1&thresh=0.4&drug_concept_levels=CLINICAL_DRUG" \
   --header 'Authorization: Bearer <token>' \
   | jq -r '.candidates[0].codings.posos[0].code'

You should get the identifiers MV00001165 and MV00000271.

Analytics API call

Use your favorite GraphQL client to query our API at the following URL:

💡 Note: If you’re not sure which URL to use, it depends on the functionality you want to exploit. If in doubt, don’t hesitate to ask our team. Don’t forget to include the authentication header in your requests!

If you are not familiar with GraphQL, it is not too late to discover this very popular protocol.

Here is the query to make in GQL language:

Interactions

query GetInteractions($drugs: [DrugInput!]!) {
  getInteractions(drugs: $drugs) {
    interactions {
      designation
      type
      source {
        author
        url
      }
      left {
        clinicalDrug {
          code
          inn
          label
        }
      }
      right {
        clinicalDrug {
          code
          inn
          label
        }
      }
      warnings {
        guidelines
        modifiers
        risk
      }
    }
  }
}

Here is an interactive version:

Request

POST
/aort-api-v3/v1/graphql
curl --request POST -s \
   --url "https://api.preprod.posos.co/aort-api-v3/v1/graphql" \
   --data-raw $'{"query":"query getInteractions($drugs: DrugInput) {\n getInteractions(drugs: $drugs) {\n designation\n type\n source {\n author\n url\n }\n drugs {\n clinicalDrugs {\n code\n inn\n label\n }\n }\n warnings {\n risk\n guidelines\n modifiers\n }\n }\n}", variables: {{ "drugs": { "clinicalDrugs": [ "MV00001165", "MV00000271", ] } }}, "operationName:"getInteractions"}' \
   --header 'Authorization: Bearer <token>'

The response contains, for each drug passed as a parameter, the interactions detected with the other drugs in the request. Here, an important contraindication has been returned!

Here’s another example showing that the getInteractions access point returns interactions that include the route of administration when drugs are taken by the same route.

Interactions

query Interactions($drugs: [DrugInput!]!) {
  getInteractions(drugs: $drugs) {
    interactions {
      designation
      right {
        clinicalDrug {
          label
        }
      }
      left {
        clinicalDrug {
          label
        }
      }
      warnings {
        risk
      }
    }
  }
}