
Bridge the Gap: IEC 81001-5-1 and Architectural Documentation as Code
How to leverage 'Documentation as Code' to meet the rigorous architectural and security requirements of IEC 81001-5-1 in healthcare software development.
In healthcare, auditing isn’t an afterthought—it’s a core requirement. Standards like HIPAA and GDPR mandate that every access to Protected Health Information (PHI) must be recorded. However, simply dumping logs into a text file makes compliance reporting a nightmare.
As architects, we should treat audit data as first-class citizens. That means moving beyond simple logs and towards a FHIR-native Audit Trail that aligns with international standards like IHE ATNA (Audit Trail and Node Authentication).
Standardized auditing isn’t just a HAPI FHIR feature; it’s a core component of the IHE (Integrating the Healthcare Enterprise) framework. By using AuditEvent resources, your server becomes “Audit-Capable,” allowing it to talk to a centralized Audit Record Repository (ARR).
In the hapi-fhir-groovy architecture, I’ve implemented an AuditEventInterceptor that automatically captures operations and maps them to FHIR AuditEvent resources.
Instead of just writing to a database, we use an Audit Sink abstraction. This allows you to route audit events to different destinations:
In your application.yaml, ensure the audit feature is toggled on:
hapi:
fhir:
audit_enabled: true
The interceptor captures the four W’s:
Patient/123).Because we store audits as FHIR resources, you can query them using standard FHIR REST syntax:
GET /AuditEvent?entity=Patient/123&date=ge2026-03-16
Sometimes you need to audit more than just REST calls. You might want to audit background exports or custom logic. You can use the AuditEventContextService to manually trigger an audit event:
@Autowired
private AuditEventContextService auditService;
public void processData(Patient patient) {
// ... custom logic ...
auditService.captureAuditEvent(
"custom-operation",
patient,
AuditEvent.AuditEventAction.E,
"Processed research data"
);
}
AuditEvent (specifically the agent and source fields) ensures you know exactly which system and which user modified a record.By making auditing FHIR-native, you transform a compliance burden into an architectural asset. You can build dashboards, trigger security alerts, and automate compliance exports using the same tools you use for clinical data.
For implementation details, check doc/auditevent.md.