> For the complete documentation index, see [llms.txt](https://community-test.logicnets.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://community-test.logicnets.com/release-9/design-considerations-and-frameworks/frameworks/assessment-framework/fhir-report-export-for-the-assessment-framework-beta.md).

# FHIR Report Export for the Assessment Framework (BETA)

## Description

To improve the exchange of structured data using a widely adopted standard, LogicNets has added to the Assessment Framework the option to export the collected data in HL7 FHIR ([Fast Healthcare Interoperability Resources](https://hl7.org/fhir/r4/index.html)) format. For more information about the LogicNets FHIR Converter, see [FHIR Converter](/release-9/platform-documentation/process-node-parts/fhir-converter.md).

**Used With:** This part is used in the Assessment Framework.

## Configuration

To see the FHIR report, you need the FHIR Data Exchange License. Additionally, in the Framework settings, set the *Generate FHIR Report on exit* setting to ‘Yes’ to enable report generation.

![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-d382faba533e70cafd1465b7414301490557f090%2Fe563b862-65f2-4d70-8b48-dc3f06948003.png?alt=media)

## Default Template

You can also use the *Custom FHIR Template* setting to allow a child project/protocol to use a custom template. This must point to a JSON file that is accessible by the runtime, and we advise putting the template in the documents folder of the project; for example, 'documents/custom\_FHIR.json'. If the system experiences problems reading the template, it stores the details of the problems in *temp.fhir.fhir\_report\_template\_read\_errors*.

![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-83a312f7f5e123df51809e29b12c47b8ae27800c%2Ff51ea8ab-4a7d-46d0-a649-887877f3ac1a.png?alt=media)

The default template is as follows:

```
{
    "resourceType": "Bundle",
    "type": "document",
    "identifier": {
        "system": "urn:ietf:rfc:3986",
        "value": "$(_fhir_export.fhir_report_id)"
    },
    "timestamp": "$(_fhir_export.fhir_report_stamp)",
    "entry": [
        {
            "resource": {
                "resourceType": "Composition",
                "id": "$(_fhir_export.fhir_composition_id)",
                "status": "$(_fhir_export.status)",
                "type": {
                    "coding": [
                        {
                            "system": "http://loinc.org",
                            "code": "80563-0"
                        }
                    ],
                    "text": "Report"
                },
                "date": "$(_fhir_export.fhir_composition_stamp)",
                "author": [
                    {
                        "reference": "$(_fhir_export.fhir_composition_author_reference)",
                        "display": "$(_fhir_export.fhir_composition_author_display)"
                    }
                ],
                "title": "$(_fhir_export.fhir_composition_title)"
            }
        },
        {
            "resource": {
                "resourceType": "DiagnosticReport",
                "status": "$(_fhir_export.status)",
                "code": {
                    "coding": [
                        {
                            "system": "http://loinc.org",
                            "code": "80563-0"
                        }
                    ],
                    "text": "Report"
                },
                "contained": {}
            }
        }
    ]
}
```

The template uses the following interpolations:

| Field                                                   | Details                                                                                                              |
| ------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **\_fhir\_export.status**                               | Set to ‘final’ when pressing submit, otherwise set to ‘preliminary’. The same is used for each observation resource. |
| **\_fhir\_export.new\_fhir\_report\_id**                | Generated GUID, unless already specified.                                                                            |
| **\_fhir\_export.fhir\_report\_stamp**                  | Timestamp of report generation, in ISO 8601 format in UTC, unless already specified.                                 |
| **\_fhir\_export.fhir\_composition\_id**                | Generated GUID, unless already specified.                                                                            |
| **\_fhir\_export.fhir\_composition\_stamp**             | Timestamp of report generation, in ISO 8601 format in UTC, unless already specified.                                 |
| **\_fhir\_export.fhir\_composition\_title**             | Specific title, must be filled in by the protocol or deriving framework.                                             |
| **\_fhir\_export.fhir\_composition\_author\_reference** | Specific reference, must be filled in by the protocol or deriving framework.                                         |
| **\_fhir\_export.fhir\_composition\_author\_display**   | Specific value, must be filled in by the protocol or deriving framework.                                             |

## Observation Resource

The system exports every data-log item in this report as an Observation resource and defines the status of the observation resources as it does the report. Prior to you submitting a resources, the status is 'preliminary'. When you click the *Submit* button, the system sets the status to 'final'.

The system generates a unique ID for each observation, and the pattern is as follows: *Observation---*.

The data object name is the actual path of the object. The identifier is an optional value that is the same for all observations; for example, a report-id. You can specify this identifier by setting the value in *\_fhir\_export.report\_identifier*. The sequence number is auto-generated and formatted as 00. An example of the observation identifier is *Observation-complaints-T12\_34567-01*.

The system explicitly inserts observations into the contained array within the *DiagnosticReport* resource. The system expects that there is only one DiagnosticReport resource in the template and that it has the contained element at the root level of that resource, as in the following standard template:

```
{
    "resource": {
        "resourceType": "DiagnosticReport",
        "status": "$(_fhir_export.status)",
        "code": {
            "coding": [
                {
                    "system": "http://loinc.org",
                    "code": "80563-0"
                }
            ],
            "text": "Report"
        },
        "contained": {}
    }
}
```

When a data-object is a collection, each individual item will lead to an individual resource with a summary resource referencing all sub resources. The id of such a resource will not have the sequence number.

The system will also include all potential data-object informatics details in the FHIR resources.

## Example Report

The following is an example of a report with two answered questions, one a checklist of ‘complaints’ with three selected answers and one numeric input with a unit of measure defined.

```
{
    "entry": [
        {
            "resource": {
                "author": [
                    {
                        "display": "Demo",
                        "reference": "Demo Author Reference"
                    }
                ],
                "date": "2023-07-28T07:52:03Z",
                "id": "A5065541-0285-C5E4-81FE-6242BDA638F7",
                "resourceType": "Composition",
                "status": "final",
                "title": "Example FHIR Report",
                "type": {
                    "coding": [
                        {
                            "code": "80563-0",
                            "system": "http://loinc.org"
                        }
                    ],
                    "text": "Report"
                }
            }
        },
        {
            "resource": {
                "code": {
                    "coding": [
                        {
                            "code": "80563-0",
                            "system": "http://loinc.org"
                        }
                    ],
                    "text": "Report"
                },
                "contained": [
                    {
                        "code": {
                            "text": "complaints"
                        },
                        "hasMember": [
                            "#Observation-complaints-01",
                            "#Observation-complaints-02",
                            "#Observation-complaints-03"
                        ],
                        "id": "Observation-complaints",
                        "resourceType": "Observation",
                        "status": "final"
                    },
                    {
                        "code": {
                            "coding": [
                                {
                                    "code": "130461000146108",
                                    "display": "Characteristic of complaint",
                                    "system": "http://snomed.info/sct"
                                }
                            ],
                            "text": "complaints"
                        },
                        "id": "Observation-complaints-01",
                        "resourceType": "Observation",
                        "status": "final",
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "code": "248980004",
                                    "display": "Contact bleeding from cervix",
                                    "system": "http://snomed.info/sct"
                                }
                            ]
                        },
                        "valueString": "contact_bleeding"
                    },
                    {
                        "code": {
                            "coding": [
                                {
                                    "code": "130461000146108",
                                    "display": "Characteristic of complaint",
                                    "system": "http://snomed.info/sct"
                                }
                            ],
                            "text": "complaints"
                        },
                        "id": "Observation-complaints-02",
                        "resourceType": "Observation",
                        "status": "final",
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "code": "422910009",
                                    "display": "Abnormal urogenital discharge",
                                    "system": "http://snomed.info/sct"
                                }
                            ]
                        },
                        "valueString": "abnormal_urogenital_discharge"
                    },
                    {
                        "code": {
                            "coding": [
                                {
                                    "code": "130461000146108",
                                    "display": "Characteristic of complaint",
                                    "system": "http://snomed.info/sct"
                                }
                            ],
                            "text": "complaints"
                        },
                        "id": "Observation-complaints-03",
                        "resourceType": "Observation",
                        "status": "final",
                        "valueCodeableConcept": {
                            "coding": [
                                {
                                    "code": "237130006",
                                    "display": "Bleeding between periods",
                                    "system": "http://snomed.info/sct"
                                }
                            ]
                        },
                        "valueString": "bleeding_between_periods"
                    },
                    {
                        "code": {
                            "coding": [
                                {
                                    "code": "27051004",
                                    "display": "Blood arterial pH level",
                                    "system": "http://snomed.info/sct"
                                }
                            ],
                            "text": "blood_ph_level"
                        },
                        "id": "Observation-blood_ph_level-01",
                        "resourceType": "Observation",
                        "status": "final",
                        "valueQuantity": {
                            "code": "[pH]",
                            "system": "http://unitsofmeasure.org",
                            "unit": "pH",
                            "value": 7.9
                        }
                    }
                ],
                "resourceType": "DiagnosticReport",
                "status": "final"
            }
        }
    ],
    "identifier": {
        "system": "urn:ietf:rfc:3986",
        "value": "0A5A9BF9-7D98-2B6E-DCAB-DFF64F77F950"
    },
    "resourceType": "Bundle",
    "timestamp": "2023-07-28T07:52:03Z",
    "type": "document"
}
```

## Assessment Test Mode

When running an assessment in test mode, the system prints FHIR output next to the standard XML report after you click Submit or Save. This makes it easier for you to determine if the system created your desired output.

NOTE: In test mode, the system will always generate the FHIR report, even if the Generate FHIR Report on exit configuration is set to ‘No’.

![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-16c82b1f031954ec718681d80fdf03ac756a1e30%2F3cccf868-acef-4492-a48d-45644deb1b41.png?alt=media)

## Starter Application Framework 2 Integration

In the session data that the system returns from the assessment to the starter application, the system adds a specific FHIR object is added with one element: report. For example:

```
    FHIR = {
        report = "{\"entry\":[{\"resource\":{\"author\"..."
    },
```

You can use this to for further processing by the custom starter application implementation. Also, when customizing the top bar of the assessment framework, you can set the implementation to take full control of which data to convert and how that data should be converted into FHIR. You can also delegate this to the starter application if the application passes all required information to the starter.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://community-test.logicnets.com/release-9/design-considerations-and-frameworks/frameworks/assessment-framework/fhir-report-export-for-the-assessment-framework-beta.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
