opensafely / opensafely/pharmacy-first-data-development

Blog: Using consultation id to reconstruct episode-level care in primary care EHR data

Open
#67 0 comments 0 reactions 1 assignee View on GitHub

@viv3ckj is already working on this.

Since Jan 23, 2026.

Dominant language
Python
Stars
0
Forks
0
Avg merge
1d 23h
Merged PRs (30d)
4

Description

Summary

We should write a short methods-focused blog explaining how consultation identifiers (consultation_id) can be used to link records from the same clinical encounter in primary care EHR data.

This blog is intended to be generalisable guidance for researchers. Pharmacy First will be used only as an example to show how consultation id-based linkage is used in practice.

The aim is to document:

  • how consultation IDs can be used for episode-level linkage,
  • what we observed when applying this in real data,
  • and the practical limitations researchers should be aware of.

Purpose of the blog

The blog should help future users who want to:

  • link diagnoses and medications within the same consultation,
  • reconstruct episode-level care across multiple tables,
  • avoid relying solely on date-based linkage.

It should focus on methodology and data behaviour, not service evaluation or policy analysis.


What the blog should cover
1. Why episode-level linkage matters
  • Brief explanation of the problem with record-level EHR data.
  • Limitations of same-day or time-window-based linkage.
2. Consultation identifiers in EHR data
  • What consultation_id is, as observed in the data.
  • How it can be used to group records across tables.
3. How we used consultation IDs
  • Linking records across:
    • clinical_events
    • medications
  • Consultation ID–based linkage as the primary approach.
  • Same-day linkage as a comparison.
4. What we observed in practice (illustrative example)
  • Using Pharmacy First consultations as an example:
    • Same-day linkage identifies more records.
    • Medication status fields (e.g. PGD) are not reliably populated.
  • Emphasis that this reflects recording practices, not clinical care.
5. Limitations and caveats
  • Incomplete population of consultation IDs.
  • Variation in recording practices.
  • Importance of checking behaviour in each use case.

Blog draft document

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.