Skip to main content

Lens

A Lens is a conceptual piece of code packaged as a FHIR Library resource that encodes clinical or context-specific knowledge, applying transformation rules based on patient data.

Purpose​

Lenses determine how ePI content should be adapted for individual patients by:

  • Highlighting relevant sections
  • Collapsing irrelevant sections
  • Adding supplementary content
  • Enriching with interactive elements

Packaging​

FHIR Library Resource​

Lenses follow the Lens Profile:

  • JavaScript code encoded in Base64 (UTF-8)
  • Stored as Library.content.data
  • LEE decodes from Base64 → UTF-8 before execution
  • Contains metadata (author, version, purpose)

Creation Tool​

Packaged using the FHIR Lens bundler tool.

Execution Inputs​

Lenses receive three inputs from LEE:

  1. p(ePI): Semantically annotated ePI
  2. IPS: Patient clinical data
  3. PV: User context and preferences

Lens Operations​

Lenses code is a JavaScript module that implements at least the enhance() function, which applies transformation rules to the p(ePI) based on the IPS and PV, and returns the updated html code representing the whole composition of the ePI. Lenses can also implement an optional explanation() function to provide reasoning behind their decisions. The input elements (epi, ips, pv and html code to process), are injected in to the lens object, so the lens can access them directly from its called functions, any modifications to these attributes will be descarted.

Regulatory Constraints​

Critical Limitation: Lenses cannot:

  • Remove original ePI content
  • Change approved text
  • Delete HTML elements

They can only:

  • Modify CSS classes for visual presentation
  • Add supplementary HTML elements

Performance Requirements​

Client-Side Execution​

  • Must run efficiently on patient phones
  • Lightweight algorithms only
  • No heavy computation

Server-Side Execution​

  • Must scale for many concurrent users
  • Fast response times required
  • Ephemeral (not cached)

Design Principle​

Rely on Preprocessors for heavy computation (NLP, semantic analysis). Lenses execute lightweight logic based on preprocessor annotations.

Lens Types​

  • Clinical Lenses: Based on medical conditions
  • Demographic Lenses: Age, gender-specific
  • Preference Lenses: Language, literacy level
  • Summary Lenses: Provide condensed views
  • Multimedia Lenses: Add rich media content