Indications

Available in SFM version 4

The SFM Indicator API can be used to retrieve a list of patients whose medication lists have been changed locally in SFM since a specified date/time. This is useful, for example, in a nursing home when a doctor updates SFM locally and the nurse needs to be alerted to update the medication list in the administration module before dispensing.

The indicator is primarily intended to ensure that all patients' medication lists are up to date before medication is dispensed. Accordingly, it is expected to be called at medication-dispensing times (e.g., up to six times per day).

Endpoint

The endpoint is accessed via:

GET /fhir/Basic?_tag=indicator

Purpose

The Indicators module is responsible for reacting to relevant domain events and creating audit trail indicators. This is part of the event-driven ecosystem, consuming events published to RabbitMQ via MassTransit from the EventOutboxPublisher and producing a side-effect persisted in the local Indicators database.

An Indicator represents a flag, notification, or reminder that some noteworthy change has occurred to a patient's data—requiring attention, awareness, or review by clinicians or external systems.

Indicators are stored locally in a dedicated Indicators table and exposed via a FHIR-compatible API, allowing for efficient integration with user-facing systems or decision-support tools.

Each Indicator is created when an event occurs and stored with:

  • OccurredOnUtc – when the event actually happened.
  • CreatedOnUtc – when the event was saved in the database.
  • PatientId
  • EventType - Ex: ReseptRenewal, TreatmentCreated

The API filters Indicators using CreatedOnUtc to make sure no events are missed, even if they were processed later.

Query Parameters

| Parameter | Type | Required | Description | | --- | --- | --- | --- | | _tag=indicator | string | ✅ | Required to specify the resource type. Always set to indicator. | | identifier | string | Optional | Patient identifier(s) in FHIR format (e.g., urn:oid:... | | from| string | Optional | Start date for filtering indicator events (format:yyyy-MM-dd or yyyy-MM-ddTHH:mm:ss). Defaults to *today* if omitted. | | type| string | Optional | One ofSimplified(default) orVerbose`. Dictates the result detail level. |

Profile

sfm-Indicator

idΣ0..1id
metaΣ0..1Meta
implicitRulesΣ ?!0..1uri
language0..1codeBinding
text0..1Narrative
contained0..*Resource
patientPidS0..1Extension
events0..*Extension
modifierExtension?!0..*Extension
identifierΣ0..*Identifier
codeS Σ ?!1..1CodeableConceptFixed Value
subjectΣ0..1Reference(Resource)
createdΣ0..1date
authorΣ0..1Reference(Practitioner | PractitionerRole | Patient | RelatedPerson | Organization)

Retrieval on Datashare

The actual retrieval of indicator data is performed using a named query on Basic. Parameters may include patient identifiers and a date filter:

GET [base]/Basic?_tag=indicator&from=2024-01-01
POST [base]/Basic/_search
_query=Indicator&type=Simplified&from=2024-01-01&identifier=urn:oid:2.16.578.1.12.4.1.4.1|31126711509

Note that SFM will return all matching entries based on the given parameters, and the number of items may grow during a typical session.

Example Request

Simplified View

Note that the use of _search is allowed so patient identifiers are not logged anywhere.

Example 1 – Multiple Patients
POST 
Command 'host' could not render: There is no placeholder called 'host'
/Basic/_search Authorization: Bearer
Command 'token' could not render: There is no placeholder called 'token'
Content-Type: application/x-www-form-urlencoded _query=Indicator&type=Simplified&from=2024-01-01&identifier=urn:oid:2.16.578.1.12.4.1.4.1|31126711509,urn:oid:2.16.578.1.12.4.1.4.2|58129218310

Fetches simplified indicators for patients 31126711509 and 58129218310 from 2024-01-01 onward.

Example 2 – Single Patient
POST 
Command 'host' could not render: There is no placeholder called 'host'
/Basic/_search Authorization: Bearer
Command 'token' could not render: There is no placeholder called 'token'
Content-Type: application/x-www-form-urlencoded _query=Indicator&type=Simplified&from=2024-01-01&identifier=urn:oid:2.16.578.1.12.4.1.4.1|31126711509

Fetches simplified indicators for patient 31126711509 starting from 2024-01-01.

Verbose View

Example 1 – Multiple Patients
POST 
Command 'host' could not render: There is no placeholder called 'host'
/Basic/_search Authorization: Bearer
Command 'token' could not render: There is no placeholder called 'token'
Content-Type: application/x-www-form-urlencoded _query=Indicator&type=Verbose&from=2023-11-01&identifier=urn:oid:2.16.578.1.12.4.1.4.1|31126711509,urn:oid:2.16.578.1.12.4.1.4.2|58129218310

Returns detailed (verbose) indicator data for the listed patients since 2023-11-01.

Example 2 – Single Patient
POST 
Command 'host' could not render: There is no placeholder called 'host'
/Basic/_search Authorization: Bearer
Command 'token' could not render: There is no placeholder called 'token'
Content-Type: application/x-www-form-urlencoded _query=Indicator&type=Verbose&from=2023-11-01&identifier=urn:oid:2.16.578.1.12.4.1.4.1|31126711509

Returns detailed indicator data for patient 31126711509 since 2023-11-01.

Supported Identifiers

You can use the following identifier formats:

| Identifier Type | Example | | --- | --- | | FNR | urn:oid:2.16.578.1.12.4.1.4.1 | | **DNR** | urn:oid:2.16.578.1.12.4.1.4.2 | | XXXID | `urn:oid:2.16.578.1.12.4.1.4.14 |

Multiple identifiers can be sent:

identifier=urn:oid:...|12345678901,urn:oid:...|98765432109

Example Response

{
  "resourceType": "Bundle",
  "id": "41b9819f-9444-40f1-8d02-e5f2d011dcd6",
  "meta": {
    "lastUpdated": "2025-06-02T17:40:07.5973486+00:00"
  },
  "type": "searchset",
  "total": 1,
  "entry": [
    {
      "fullUrl": "http://datashare.dev1.forskrivning.no/Basic/ec38e3ab-bfd8-4ca5-87bf-5a93f5f07985",
      "resource": {
        "resourceType": "Basic",
        "id": "a224eff3-94ac-462c-bcf8-f54293386c74",
        "meta": {
          "profile": [
            "http://ehelse.no/fhir/StructureDefinition/sfm-indicator"
          ]
        },
        "extension": [
          {
            "url": "http://ehelse.no/fhir/StructureDefinition/sfm-indicator-patient-pid-extension",
            "valueString": "31126711509"
          }
        ],
        "code": {
          "coding": [
            {
              "code": "Indicator"
            }
          ]
        },
        "created": "2025-06-02"
      }
    }
  ]
}

Usage Examples

Search by Date Only

POST /fhir/Basic/_search
_query=Indicator&type=Simplified&from=2024-01-01

Search by Single Patient Identifier

POST /fhir/Basic/_search
_query=Indicator&type=Simplified&from=2024-01-01&identifier=urn:oid:2.16.578.1.12.4.1.4.1|31126711509

Search by Multiple Patient Identifiers

POST /fhir/Basic/_search
_query=Indicator&type=Simplified&from=2024-01-01&identifier=urn:oid:2.16.578.1.12.4.1.4.1|31126711509,urn:oid:2.16.578.1.12.4.1.4.2|58129218310

Search with Verbose View

POST /fhir/Basic/_search
_query=Indicator&type=Verbose&from=2024-01-01&identifier=urn:oid:2.16.578.1.12.4.1.4.1|31126711509

All requests require appropriate authorization headers:

Host: (host)
Content-Type: application/x-www-form-urlencoded
Accept: application/json
Authorization: Bearer (token)

Behavior Notes

  • If no identifier is provided → all indicator records are returned.
  • If identifiers don't match any patients → response is 404 Not Found.
  • If from is missing or invalid → defaults to today's date.
  • If type is not Verbose → default is Simplified.
  • Filtering always uses CreatedOnUtc to ensure no delayed events are missed.

EPJ could make use of the lastUpdate datetime to make the next request so that no event is lost. Or, they can simply save the request time from their side.