ePrescribing in EU and Ireland: FHIR-Based Electronic Prescriptions

Executive Summary

Electronic prescribing (ePrescribing) transforms medication ordering from paper-based, error-prone processes to digital workflows with built-in safety checks, formulary integration, and cross-border interoperability. Ireland’s national ePrescribing rollout, combined with EU cross-border initiatives, enables Irish patients to fill prescriptions anywhere in Europe using FHIR-based standards.

This guide covers Ireland’s ePrescribing infrastructure, FHIR MedicationRequest/MedicationDispense resources, EU cross-border ePrescribing (eHDSI), drug database integration, and production .NET implementation patterns.

What You’ll Learn:

  • Ireland’s ePrescribing programme (HSE)
  • FHIR MedicationRequest resource structure
  • Drug safety checks (interactions, allergies, contraindications)
  • EU cross-border ePrescribing via eHDSI
  • WHO ATC drug classification
  • Irish Medicines Board (HPRA) integration
  • Pharmacy dispensing workflow
  • Production .NET code examples

Tech Stack: FHIR R4 | .NET 10 | WHO ATC | SNOMED CT | HSE ePrescribing | eHDSI

The Paper Prescription Problem

Traditional Paper Prescriptions

Pain Points:

  1. Illegible Handwriting

    • 7,000+ deaths annually in US from medication errors
    • Pharmacists spend hours deciphering prescriptions
    • Common confusion: "mg" vs "mcg" (1000x difference!)
  2. No Safety Checks

    • Doctor doesn’t see drug-drug interactions
    • No allergy alerts
    • No contraindication warnings
    • Dosing errors (pediatric especially dangerous)
  3. Patient Burden

    • Must physically deliver prescription to pharmacy
    • Lost prescriptions = delay in treatment
    • Can’t fill prescription while traveling
  4. Fraud & Abuse

    • Prescription forgery
    • Duplicate prescriptions
    • Controlled substance diversion

ePrescribing Benefits

Safety:

  • Real-time drug interaction alerts
  • Allergy checking against patient record
  • Dosing guidelines (especially pediatric)
  • Formulary compliance

Efficiency:

  • No paper, no fax, no phone calls
  • Prescription at pharmacy before patient arrives
  • Electronic renewal requests
  • Automatic refill reminders

Clinical Decision Support:

  • Cost-effective alternatives suggested
  • Generic substitutions
  • Prior authorization automation
  • Therapeutic duplication alerts

Patient Convenience:

  • Choose any pharmacy
  • Fill prescription anywhere in EU
  • Track prescription status
  • Medication history always available

Ireland’s ePrescribing Programme

HSE National ePrescribing System

Current Status (2025):

  • Pilot in 15 acute hospitals
  • Rollout to all public hospitals by 2026
  • GP practices integration 2026-2027
  • Community pharmacy connectivity 2025-2026

Technology Stack:

  • FHIR R4-based
  • Integration with IHI (Individual Health Identifier)
  • Cloud-hosted (Azure Ireland region)
  • Healthlink network for pharmacy connections

Key Components

1. Hospital Prescribing

  • EMR integration (Cerner, Epic, InterSystems)
  • Clinical decision support
  • Discharge prescription generation

2. GP Prescribing

  • GP practice software integration (Socrates, Healthone)
  • Repeat prescription management
  • GMS (General Medical Services) card integration

3. Pharmacy Dispensing

  • Community pharmacy systems
  • Hospital pharmacy systems
  • Dispensing validation
  • Stock management integration

4. Patient Portal

  • View active prescriptions
  • Request renewals
  • Medication history
  • Allergy management
ePrescribing Workflow
Complete ePrescribing workflow

FHIR MedicationRequest – Complete Implementation

Production-Ready C# Code

using Hl7.Fhir.Model;
using Hl7.Fhir.Rest;
using System.Collections.Generic;
using System.Threading.Tasks;

public class EPrescribingService
{
    private readonly FhirClient _fhirClient;
    private readonly IDrugInteractionService _drugChecker;
    private readonly IAllergyService _allergyService;

    public async Task<MedicationRequest> CreatePrescriptionAsync(
        string patientIHI,
        string practitionerId,
        MedicationData medication)
    {
        // 1. Build FHIR MedicationRequest
        var request = new MedicationRequest
        {
            Status = MedicationRequest.medicationrequestStatus.Active,
            Intent = MedicationRequest.medicationRequestIntent.Order,
            Priority = MedicationRequest.medicationRequestPriority.Routine,

            // Medication using WHO ATC
            Medication = new CodeableConcept
            {
                Coding = new List<Coding>
                {
                    new Coding
                    {
                        System = "http://www.whocc.no/atc",
                        Code = medication.AtcCode,
                        Display = medication.Name
                    }
                },
                Text = medication.Name
            },

            // Patient (Irish IHI)
            Subject = new ResourceReference($"Patient/{patientIHI}"),

            // Prescriber
            Requester = new ResourceReference($"Practitioner/{practitionerId}"),

            // Prescription date
            AuthoredOn = DateTimeOffset.Now.ToString("yyyy-MM-ddTHH:mm:sszzz"),

            // Dosage
            DosageInstruction = new List<Dosage>
            {
                new Dosage
                {
                    Sequence = 1,
                    Text = medication.DosageText,
                    Timing = new Timing
                    {
                        Repeat = new Timing.RepeatComponent
                        {
                            Frequency = medication.Frequency,
                            Period = 1,
                            PeriodUnit = Timing.UnitsOfTime.D
                        }
                    },
                    Route = new CodeableConcept
                    {
                        Coding = new List<Coding>
                        {
                            new Coding("http://snomed.info/sct", "26643006", "Oral")
                        }
                    },
                    DoseAndRate = new List<Dosage.DoseAndRateComponent>
                    {
                        new Dosage.DoseAndRateComponent
                        {
                            DoseQuantity = new Quantity
                            {
                                Value = medication.DoseValue,
                                Unit = medication.DoseUnit,
                                System = "http://unitsofmeasure.org",
                                Code = medication.DoseUnit
                            }
                        }
                    }
                }
            },

            // Dispense request
            DispenseRequest = new MedicationRequest.DispenseRequestComponent
            {
                ValidityPeriod = new Period
                {
                    Start = DateTimeOffset.Now.ToString("yyyy-MM-dd"),
                    End = DateTimeOffset.Now.AddMonths(6).ToString("yyyy-MM-dd")
                },
                NumberOfRepeatsAllowed = medication.RefillsAllowed,
                Quantity = new Quantity
                {
                    Value = medication.QuantityValue,
                    Unit = medication.QuantityUnit
                },
                ExpectedSupplyDuration = new Duration
                {
                    Value = 30,
                    Unit = "days",
                    System = "http://unitsofmeasure.org",
                    Code = "d"
                }
            },

            // Clinical reason
            ReasonCode = new List<CodeableConcept>
            {
                new CodeableConcept
                {
                    Coding = new List<Coding>
                    {
                        new Coding
                        {
                            System = "http://snomed.info/sct",
                            Code = medication.IndicationCode,
                            Display = medication.IndicationText
                        }
                    }
                }
            }
        };

        // 2. Run safety checks BEFORE creating
        await PerformSafetyChecks(request, patientIHI);

        // 3. Create on FHIR server
        var created = await _fhirClient.CreateAsync(request);

        // 4. Notify pharmacy
        await NotifyPharmacy(created);

        return created;
    }

    private async Task PerformSafetyChecks(MedicationRequest request, string patientIHI)
    {
        var errors = new List<string>();

        // Check 1: Allergies
        var allergies = await _allergyService.GetPatientAllergies(patientIHI);
        var drugAllergy = allergies.FirstOrDefault(a => 
            a.IsContraindicatedFor(request.Medication));
        
        if (drugAllergy != null)
        {
            errors.Add($"CRITICAL: Patient allergic to {drugAllergy.AllergenName}");
        }

        // Check 2: Drug interactions
        var currentMeds = await GetCurrentMedications(patientIHI);
        var interactions = await _drugChecker.CheckInteractions(
            request.Medication, currentMeds);

        var severeInteractions = interactions.Where(i => i.Severity == "severe");
        if (severeInteractions.Any())
        {
            errors.Add($"SEVERE INTERACTION: {string.Join(", ", severeInteractions.Select(i => i.Description))}");
        }

        // Check 3: Dosing appropriateness
        if (!IsDoseAppropriate(request))
        {
            errors.Add("Dose outside recommended range");
        }

        // Check 4: Duplicate therapy
        var duplicates = currentMeds.Where(m => 
            m.TherapeuticClass == request.Medication.TherapeuticClass);
        if (duplicates.Any())
        {
            errors.Add($"WARNING: Duplicate therapy with {string.Join(", ", duplicates.Select(d => d.Name))}");
        }

        if (errors.Any(e => e.StartsWith("CRITICAL")))
        {
            throw new PrescriptionSafetyException(string.Join("; ", errors));
        }
    }
}

Pharmacy Dispensing Workflow

Receiving Prescription at Pharmacy

Steps:

  1. Prescription Arrival

    • Real-time notification via FHIR Subscription
    • Or: Patient presents with prescription ID
    • Pharmacist retrieves MedicationRequest from FHIR server
  2. Verification

    • Validate prescriber credentials
    • Check prescription hasn’t been filled
    • Verify patient identity (IHI + photo ID)
    • Confirm medication in stock
  3. Clinical Review

    • Pharmacist reviews dosing
    • Checks for interactions with OTC medications
    • Counsels patient on usage
    • Documents any concerns
  4. Dispensing

    • Fill prescription
    • Label with instructions
    • Create MedicationDispense FHIR resource

MedicationDispense FHIR Resource

public class PharmacyService
{
    public async Task<MedicationDispense> DispensePrescription(
        string prescriptionId,
        string pharmacistId,
        string pharmacyId)
    {
        // 1. Get original prescription
        var prescription = await _fhirClient.ReadAsync<MedicationRequest>(
            $"MedicationRequest/{prescriptionId}");

        // 2. Create dispense record
        var dispense = new MedicationDispense
        {
            Status = MedicationDispense.MedicationDispenseStatusCodes.Completed,
            
            // Link to prescription
            AuthorizingPrescription = new List<ResourceReference>
            {
                new ResourceReference($"MedicationRequest/{prescriptionId}")
            },
            
            // Medication dispensed
            Medication = prescription.Medication,
            
            // Patient
            Subject = prescription.Subject,
            
            // Performers
            Performer = new List<MedicationDispense.PerformerComponent>
            {
                new MedicationDispense.PerformerComponent
                {
                    Actor = new ResourceReference($"Practitioner/{pharmacistId}"),
                    Function = new CodeableConcept(
                        "http://terminology.hl7.org/CodeSystem/medicationdispense-performer-function",
                        "finalchecker",
                        "Final Checker"
                    )
                }
            },
            
            // Location
            Location = new ResourceReference($"Location/{pharmacyId}"),
            
            // When dispensed
            WhenHandedOver = DateTimeOffset.Now.ToString("yyyy-MM-ddTHH:mm:sszzz"),
            
            // Quantity
            Quantity = prescription.DispenseRequest.Quantity,
            
            // Days supply
            DaysSupply = prescription.DispenseRequest.ExpectedSupplyDuration,
            
            // Dosage instructions
            DosageInstruction = prescription.DosageInstruction
        };

        // 3. Submit to FHIR server
        var created = await _fhirClient.CreateAsync(dispense);

        // 4. Mark prescription as filled
        await MarkPrescriptionFilled(prescriptionId);

        return created;
    }
}

EU Cross-Border ePrescribing Architecture

Technical Implementation

Cross-Border ePrescribing Workflow - Irish patient prescription filled in Barcelona, Spain through EU eHDSI network
EU Cross-Border ePrescribing: Irish prescription dispensed in Spain via eHDSI

Irish Patient in Barcelona Scenario:

Data Transformation

Ireland uses FHIR R4, some countries use CDA:

  • Irish NCP converts FHIR → EU Patient Summary format
  • Spanish NCP may convert to local format
  • Round-trip: Local → EU format → Local

Key Challenge: Drug Coding

  • Ireland: WHO ATC codes
  • Spain: Local formulary codes
  • Translation needed at NCP layer

Security & Privacy

Patient Consent Required:

  • Explicit opt-in via MyHealth@EU portal
  • Or: Consent at GP visit
  • Logged in HSE IHI system

Audit Trail:

  • Every access logged (GDPR Article 30)
  • Patient can view access history
  • Cross-border access tracked separately

Authentication:

  • Pharmacist authenticated by local system
  • NCP-to-NCP uses mutual TLS
  • Patient identity verified with IHI + passport

Standards and References

Related Articles in This Series

Conclusion

Electronic prescribing represents one of healthcare IT’s most impactful improvements—reducing medication errors, improving patient safety, and enabling cross-border care. Ireland’s national ePrescribing programme, built on FHIR standards, positions Irish healthcare for seamless EU integration while delivering immediate safety and efficiency benefits.


Discover more from C4: Container, Code, Cloud & Context

Subscribe to get the latest posts sent to your email.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.