> This page is for version 0.0.76.
> For other versions, use one of these documentation indexes:
> - 0.0.79 (default): https://docs.refer.health.gov.sg/0-0-79/llms.txt
> - 0.0.78: https://docs.refer.health.gov.sg/0-0-78/llms.txt
> - 0.0.77: https://docs.refer.health.gov.sg/0-0-77/llms.txt
> - 0.0.76: https://docs.refer.health.gov.sg/0-0-76/llms.txt
> - 0.0.75: https://docs.refer.health.gov.sg/0-0-75/llms.txt
> - 0.0.74: https://docs.refer.health.gov.sg/0-0-74/llms.txt
> - 0.0.73: https://docs.refer.health.gov.sg/0-0-73/llms.txt
> - 0.0.72: https://docs.refer.health.gov.sg/0-0-72/llms.txt
> - 0.0.71: https://docs.refer.health.gov.sg/0-0-71/llms.txt
> - 0.0.70: https://docs.refer.health.gov.sg/0-0-70/llms.txt
> - 0.0.69: https://docs.refer.health.gov.sg/0-0-69/llms.txt
> - 0.0.68: https://docs.refer.health.gov.sg/0-0-68/llms.txt
> - 0.0.67: https://docs.refer.health.gov.sg/0-0-67/llms.txt
> - 0.0.66: https://docs.refer.health.gov.sg/0-0-66/llms.txt
> - 0.0.65: https://docs.refer.health.gov.sg/0-0-65/llms.txt
> - 0.0.64: https://docs.refer.health.gov.sg/0-0-64/llms.txt
> - 0.0.63: https://docs.refer.health.gov.sg/0-0-63/llms.txt
> - 0.0.62: https://docs.refer.health.gov.sg/0-0-62/llms.txt
> - 0.0.61: https://docs.refer.health.gov.sg/0-0-61/llms.txt
> - 0.0.60: https://docs.refer.health.gov.sg/0-0-60/llms.txt
> - 0.0.59: https://docs.refer.health.gov.sg/0-0-59/llms.txt
> - 0.0.58: https://docs.refer.health.gov.sg/0-0-58/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.refer.health.gov.sg/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.refer.health.gov.sg/_mcp/server.

RefX uses timeline events to provide an audit trail of referrals. Every significant action from referral creation to note submission, appointment confirmation, amendment, and cancellation, etc. generates a structured event. These events allow both sender and receiver systems to reconstruct the entire journey of a referral and maintain compliance with audit and traceability requirements.

### How it works

Each referral record contains an array of `timelineEvents`, each including:

| Field           | Description                                                                |
| --------------- | -------------------------------------------------------------------------- |
| **type**        | The event type (e.g. `referral.created`, `appt.confirmed`, `note.created`) |
| **description** | A human-readable explanation, suitable for display in a user interface     |
| **system**      | Which system triggered the event (e.g. HAS, PartnersBuddy, Epic)           |
| **producedAt**  | Timestamp (in milliseconds since epoch) when the event occurred            |

### Implementation notes

* **Displaying events:**

  Use timeline events to build an **activity feed** within your system.

  Group them by date, and display the most recent actions at the top using the `description` field.

  Example:

  ```
  12 Jan 2025
  - HAS confirmed appointment at 9:00 AM
  - Dr. Tan added a note: “Please check blood sugar results before appt.”
  ```

  Try not to rely on the `type` field as there may be new timeline event types added in the future. Using the `description` field allows you to display meaningful information to users without needing to update your system for new event types.

* **Asynchronous updates:**
  Timeline events are the most reliable indicator of referral progress.
  If your system detects new events, re-fetch the referral details to reflect the latest state.

* **System mapping:**
  The `system` field helps distinguish between user-driven and automated actions.
  This is useful for debugging or understanding cross-system interactions.

* **Retention:**
  Timeline events are immutable and persist as part of the referral’s permanent record.
  They should not be deleted or edited once created.