How to download test results

I want to write some software that allows blood test results to be searched, filtered and downloaded so that they can be uploaded into an LLM for analysis. I will either use NodeJS or Java to call the APIs.

Please can someone point me to the REST APIs which will allow this.

Hi James,

Thank you for query on the NHSE API developer community.

Looks like a very interesting project. In principle it may be possible, but it depends heavily on which type if Blood test results, where those results are held, and your legal basis for accessing them.

I am not aware of a single NHS API that allows bulk downloading of all blood test results for analysis at national level. The closest one that could be of interest is: https://digital.nhs.uk/developer/api-catalogue/lab-results-adaptor

Depending on where the pathology results are sourced from, the Lab Results Adaptor may be relevant, as it is specifically intended to help expose laboratory/pathology results in a standard interoperable format rather than just event notifications. However, it is not a generic public API for arbitrary blood result download, and access would depend on the owning organisation, source pathology systems, and governance approvals.

You may also want to explore the following routes depending on where the test results you need are actually held, as approval and access are typically controlled by the owning service rather than via a single national API:

GP-held test results : Engage with the relevant GP systems integration route (for example GP Connect / GP supplier integrations such as EMIS or TPP, depending on the source system and use case)

Hospital / pathology-held test results: Engage with the relevant provider organisation, pathology services, LIMS supplier, or EPR integration team, as these are generally locally managed integrations

Hope this helps.

Thanks,

NHS England API Platform team

Please note: The API Platform team can only address queries relevant to the NHS England API platform, including security, rate limiting, logging, monitoring and alerting. For any API, CIS2, NHS Login specific queries, please reach out the relevant API / Service teams.

Hello

Thanks for the reply.

I am talking about the test results I can see via the NHS App. I want to write an app that allows a patient to access the test results visible in the NHS App and provide filtering, grouping and download functionality so that they can be uploaded into an LLM for analysis. The NHS App currently gives no facility to filter, group or download test results.

The Labs Test Adaptor you refer is a beta API - is this the API that the NHS App uses - I would guess not?

It appears that I need access to the Observations provided by the Fast Healthcare Interoperability Resources (FHIR):

https://digital.nhs.uk/developer/api-catalogue/gp-connect-patient-facing-access-record-fhir

>In principle it may be possible, but it depends heavily on which type if Blood test results, >where those results are held, and your legal basis for accessing them.

The legal basis for accessing them is the legal basis that any person has for accessing their own records (I guess GDPR is the relevant law). The app will just be a transport mechanism that allows a patient to upload their data into an LLM of their choice.

The app would be packaged as a docker container which has an internal web server serving a React app. As far as I can tell, the React app would need to redirect to the NHS login page where they are authenticated. Once authentication is done using public key and callback urls hosted perhaps on a Cloudflare worker, the JWT token will be returned to the user’s browser and passed to a backend server in the Docker container that would access the FHIR API to get their data. The server in the Docker container would then upload the data to either local or cloud based LLM that the user decides to use.

I would envisage that the app would be run on a patient’s own computer to minimise costs. A simple batch or shell script would install docker and run a docker compose script that sets up the environment on the patient’s machine.

Does all this sound plausible?