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
| SfmIndicator (Basic) | C | | Basic | There are no (further) constraints on this element Element idBasic Short descriptionResource for non-supported content Alternate namesZ-resource, Extension-resource, Custom-resource DefinitionBasic is used for handling concepts not yet defined in FHIR, narrative-only resources that don't map to an existing resource, and custom resources not appropriate for inclusion in the FHIR specification.
Data typeBasic Constraints- dom-2: If the resource is contained in another resource, it SHALL NOT contain nested Resources
contained.contained.empty() - dom-4: If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated
contained.meta.versionId.empty() and contained.meta.lastUpdated.empty() - dom-3: If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource
contained.where((('#'+id in (%resource.descendants().reference | %resource.descendants().as(canonical) | %resource.descendants().as(uri) | %resource.descendants().as(url))) or descendants().where(reference = '#').exists() or descendants().where(as(canonical) = '#').exists() or descendants().where(as(canonical) = '#').exists()).not()).trace('unmatched', id).empty() - dom-6: A resource should have narrative for robust management
text.div.exists() - dom-5: If a resource is contained in another resource, it SHALL NOT have a security label
contained.meta.security.empty() Mappings- rim: Entity. Role, or Act
- rim: Act, Entity or Role
|
| id | Σ | 0..1 | id | There are no (further) constraints on this element Element idBasic.id Short descriptionLogical id of this artifact DefinitionThe logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.
CommentsThe only time that a resource does not have an id is when it is being submitted to the server using a create operation.
Data typeid |
| meta | Σ | 0..1 | Meta | There are no (further) constraints on this element Element idBasic.meta Short descriptionMetadata about the resource DefinitionThe metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content might not always be associated with version changes to the resource.
Data typeMeta |
| implicitRules | Σ ?! | 0..1 | uri | There are no (further) constraints on this element Element idBasic.implicitRules Short descriptionA set of rules under which this content was created DefinitionA reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.
CommentsAsserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of it's narrative along with other profiles, value sets, etc.
Data typeuri |
| language | | 0..1 | codeBinding | There are no (further) constraints on this element Element idBasic.language Short descriptionLanguage of the resource content DefinitionThe base language in which the resource is written.
CommentsLanguage is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource. Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute).
Data typecode BindingCommonLanguages (preferred) Binding extensions |
| text | | 0..1 | Narrative | There are no (further) constraints on this element Element idBasic.text Short descriptionText summary of the resource, for human interpretation Alternate namesnarrative, html, xhtml, display DefinitionA human-readable narrative that contains a summary of the resource and can be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.
CommentsContained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied). This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded information is added later.
Data typeNarrative Mappings |
| contained | | 0..* | Resource | There are no (further) constraints on this element Element idBasic.contained Short descriptionContained, inline Resources Alternate namesinline resources, anonymous resources, contained resources DefinitionThese resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.
CommentsThis should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. Contained resources may have profiles and tags In their meta elements, but SHALL NOT have security labels.
Data typeResource Mappings |
| extension | | 0..* | Extension | Element idBasic.extension Short descriptionAdditional content defined by implementations Alternate namesextensions, user content DefinitionMay be used to represent additional information that is not part of the basic definition of the resource. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.
CommentsThere can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone.
Data typeExtension SlicingUnordered, Open, by url(Value) Mappings |
| patientPid | S | 0..1 | Extension | Element idBasic.extension:patientPid Short descriptionPatient identifier with change Alternate namesextensions, user content DefinitionThe patient identifier (PID) for the patient whose medication data has changed.
CommentsThere can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone.
Data typeExtension Extension URLhttp://ehelse.no/fhir/StructureDefinition/sfm-indicator-patient-pid-extension Mappings |
| events | | 0..* | Extension | Element idBasic.extension:events Short descriptionIndicator event types Alternate namesextensions, user content DefinitionThe type(s) of events that triggered this indicator. Multiple events can be associated with a single indicator.
CommentsThere can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone.
Data typeExtension Extension URLhttp://ehelse.no/fhir/StructureDefinition/sfm-indicator-events-extension Mappings |
| modifierExtension | ?! | 0..* | Extension | There are no (further) constraints on this element Element idBasic.modifierExtension Short descriptionExtensions that cannot be ignored Alternate namesextensions, user content DefinitionMay be used to represent additional information that is not part of the basic definition of the resource and that modifies the understanding of the element that contains it and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.
Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).
RequirementsModifier extensions allow for extensions that cannot be safely ignored to be clearly distinguished from the vast majority of extensions which can be safely ignored. This promotes interoperability by eliminating the need for implementers to prohibit the presence of extensions. For further information, see the definition of modifier extensions.
CommentsThere can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone.
Data typeExtension Mappings |
| identifier | Σ | 0..* | Identifier | There are no (further) constraints on this element Element idBasic.identifier Short descriptionBusiness identifier DefinitionIdentifier assigned to the resource for business purposes, outside the context of FHIR.
Data typeIdentifier Mappings- w5: FiveWs.identifier
- rim: ./identifier
|
| code | S Σ ?! | 1..1 | CodeableConceptFixed Value | Element idBasic.code Short descriptionKind of Resource DefinitionIdentifies the 'type' of resource - equivalent to the resource name for other resources.
RequirementsMust be able to distinguish different types of Basic resources.
CommentsBecause resource references will only be able to indicate 'Basic', the type of reference will need to be specified in a Profile identified as part of the resource. Refer to the resource notes section for information on appropriate terminologies for this code.
This element is labeled as a modifier because it defines the meaning of the resource and cannot be ignored.
Data typeCodeableConcept BindingCodes for identifying types of resources not yet defined by FHIR.
BasicResourceTypes (example) Fixed value{
"coding": [
{
"code": "Indicator"
}
]
}Mappings- w5: FiveWs.what[x]
- rim: ./code
|
| subject | Σ | 0..1 | Reference(Resource) | There are no (further) constraints on this element Element idBasic.subject Short descriptionIdentifies the focus of this resource DefinitionIdentifies the patient, practitioner, device or any other resource that is the "focus" of this resource.
RequirementsNeeded for partitioning the resource by Patient.
CommentsOptional as not all potential resources will have subjects. Resources associated with multiple subjects can handle this via extension.
Data typeReference(Resource) Mappings- w5: FiveWs.subject[x]
- rim: ./participation[typeCode='SBJ'] (possibly through a ControlAct and Role)
- w5: FiveWs.subject
|
| created | Σ | 0..1 | date | There are no (further) constraints on this element Element idBasic.created Short descriptionWhen created DefinitionIdentifies when the resource was first created.
RequirementsAllows ordering resource instances by time.
Data typedate Mappings- w5: FiveWs.recorded
- rim: ./participation[typeCode='AUT']/time (possibly through a ControlAct and Role)
|
| author | Σ | 0..1 | Reference(Practitioner | PractitionerRole | Patient | RelatedPerson | Organization) | There are no (further) constraints on this element Element idBasic.author Short descriptionWho created DefinitionIndicates who was responsible for creating the resource instance.
RequirementsNeeded for partitioning the resource.
Data typeReference(Practitioner | PractitionerRole | Patient | RelatedPerson | Organization) Mappings- w5: FiveWs.author
- rim: ./participation[typeCode='SUB'] (possibly through a ControlAct and Role)
|
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.