From 8864d865606f2a8d29c20a9c1d10eeb4a76e29f3 Mon Sep 17 00:00:00 2001
From: "dotasek.dev" <dotasek.dev@gmail.com>
Date: Fri, 26 Jan 2024 14:38:26 -0500
Subject: [PATCH 01/22] WIP pre-load base validation engines 1

---
 gradle.properties                             |  2 +-
 src/commonMain/kotlin/model/CliContext.kt     |  3 ++
 src/jsMain/kotlin/model/CliContext.kt         | 10 ++++++
 .../ui/components/options/PresetSelect.kt     |  6 ++--
 src/jsMain/kotlin/utils/Preset.kt             | 11 +++++++
 src/jvmMain/kotlin/api/ApiInjection.kt        |  4 ++-
 .../ValidationServiceFactoryImpl.kt           | 33 +++++++++++++++++--
 7 files changed, 62 insertions(+), 7 deletions(-)

diff --git a/gradle.properties b/gradle.properties
index 3a52b605..dcbc0652 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -2,7 +2,7 @@ kotlin.code.style=official
 kotlin.js.generate.executable.default=false
 
 # versions
-fhirCoreVersion=6.2.13
+fhirCoreVersion=6.2.15-SNAPSHOT
 
 junitVersion=5.7.1
 mockk_version=1.10.2
diff --git a/src/commonMain/kotlin/model/CliContext.kt b/src/commonMain/kotlin/model/CliContext.kt
index 2b149694..f9471414 100644
--- a/src/commonMain/kotlin/model/CliContext.kt
+++ b/src/commonMain/kotlin/model/CliContext.kt
@@ -2,6 +2,9 @@ package model
 
 expect class CliContext() {
 
+    fun getBaseEngine(): String?
+    fun setBaseEngine(baseEngine: String?) : CliContext
+
     fun isDoNative(): Boolean
     fun setDoNative(doNative: Boolean): CliContext
 
diff --git a/src/jsMain/kotlin/model/CliContext.kt b/src/jsMain/kotlin/model/CliContext.kt
index a8ecb4d2..3ef7c9e4 100644
--- a/src/jsMain/kotlin/model/CliContext.kt
+++ b/src/jsMain/kotlin/model/CliContext.kt
@@ -7,6 +7,7 @@ import kotlinx.serialization.Serializable
 @Serializable
 actual class CliContext actual constructor() {
 
+    private var baseEngine: String? = null
     private var extensions : List<String> = listOf()
     private var doNative = false
     private var hintAboutNonMustSupport = false
@@ -35,6 +36,15 @@ actual class CliContext actual constructor() {
         locale = "en"
     }
 
+    actual fun getBaseEngine() : String? {
+        return baseEngine;
+    }
+
+    actual fun setBaseEngine(baseEngine: String?): CliContext {
+        this.baseEngine = baseEngine
+        return this
+    }
+
     actual fun isDoNative(): Boolean {
         return doNative
     }
diff --git a/src/jsMain/kotlin/ui/components/options/PresetSelect.kt b/src/jsMain/kotlin/ui/components/options/PresetSelect.kt
index 1712c990..51e13561 100644
--- a/src/jsMain/kotlin/ui/components/options/PresetSelect.kt
+++ b/src/jsMain/kotlin/ui/components/options/PresetSelect.kt
@@ -35,7 +35,6 @@ external interface PresetSelectProps : Props {
 
 class PresetSelectState : State {
     var snackbarOpen : String? = null
-    var preset : String = ""
 }
 
 class PresetSelect : RComponent<PresetSelectProps, PresetSelectState>() {
@@ -83,7 +82,7 @@ class PresetSelect : RComponent<PresetSelectProps, PresetSelectState>() {
                         Select {
                             attrs {
                                 label = ReactNode("Preset")
-                                value = "".unsafeCast<Nothing?>()
+
                                 onChange = { event, _ ->
                                     val selectedPreset = Preset.getSelectedPreset(event.target.value)
                                     if (selectedPreset != null) {
@@ -107,11 +106,14 @@ class PresetSelect : RComponent<PresetSelectProps, PresetSelectState>() {
                             }
 
                             Preset.values().forEach {
+
                                 MenuItem {
                                     attrs {
                                         value = it.key
+                                        selected = it.key.equals(props.cliContext.getBaseEngine())
                                     }
                                     +props.polyglot.t(it.polyglotKey)
+                                    console.log(it.key + " " + props.cliContext.getBaseEngine() + ":" + it.key.equals(props.cliContext.getBaseEngine() ))
                                 }
                             }
                         }
diff --git a/src/jsMain/kotlin/utils/Preset.kt b/src/jsMain/kotlin/utils/Preset.kt
index 9e528d2f..e115dd59 100644
--- a/src/jsMain/kotlin/utils/Preset.kt
+++ b/src/jsMain/kotlin/utils/Preset.kt
@@ -57,6 +57,7 @@ val IPS_AU_BUNDLE_PROFILE = "http://hl7.org.au/fhir/ips/StructureDefinition/Bund
 val IPS_NZ_BUNDLE_PROFILE = "https://standards.digital.health.nz/fhir/StructureDefinition/nzps-bundle"
 
 val IPS_CONTEXT = CliContext()
+    .setBaseEngine("IPS")
     .setSv("4.0.1")
     .addIg(PackageInfo.igLookupString(IPS_IG))
     .setExtensions(listOf(ANY_EXTENSION))
@@ -68,6 +69,7 @@ val IPS_CONTEXT = CliContext()
     ))
 
 val IPS_AU_CONTEXT = CliContext()
+    .setBaseEngine("IPS_AU")
     .setSv("4.0.1")
     .addIg(PackageInfo.igLookupString(IPS_AU_IG))
     .setExtensions(listOf(ANY_EXTENSION))
@@ -79,6 +81,7 @@ val IPS_AU_CONTEXT = CliContext()
     ))
 
 val IPS_NZ_CONTEXT = CliContext()
+    .setBaseEngine("IPS_NZ")
     .setSv("4.0.1")
     .addIg(PackageInfo.igLookupString(IPS_NZ_IG))
     .setExtensions(listOf(ANY_EXTENSION))
@@ -110,6 +113,14 @@ enum class Preset(
     val extensionSet: Set<String>,
     val profileSet: Set<String>
 ) {
+    CUSTOM(
+        "CUSTOM",
+        "preset_custom",
+        CliContext(),
+        setOf(),
+        setOf(),
+        setOf()
+    ),
     DEFAULT(
         "DEFAULT",
         "preset_fhir_resource",
diff --git a/src/jvmMain/kotlin/api/ApiInjection.kt b/src/jvmMain/kotlin/api/ApiInjection.kt
index 7277a0cf..d9e34f76 100644
--- a/src/jvmMain/kotlin/api/ApiInjection.kt
+++ b/src/jvmMain/kotlin/api/ApiInjection.kt
@@ -15,7 +15,9 @@ object ApiInjection {
     private const val PACKAGE_CLIENT_ADDRESS = "https://packages.fhir.org"
 
     val koinBeans = module {
-        single<ValidationServiceFactory> { ValidationServiceFactoryImpl() }
+        single<ValidationServiceFactory>(createdAtStart = true) {
+
+            ValidationServiceFactoryImpl() }
         single<PackageClient> { PackageClient(PackageServer(PACKAGE_CLIENT_ADDRESS)) }
         single<TerminologyApi> { TerminologyApiImpl() }
         single<EndpointApi> { EndpointApiImpl() }
diff --git a/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt b/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt
index 509ea0e6..54548154 100644
--- a/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt
+++ b/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt
@@ -1,25 +1,52 @@
 package controller.validation
 
+import constants.ANY_EXTENSION
+import model.PackageInfo
+import model.BundleValidationRule
 import java.util.concurrent.TimeUnit;
 
+import org.hl7.fhir.validation.cli.model.CliContext
 import org.hl7.fhir.validation.cli.services.ValidationService
 import org.hl7.fhir.validation.cli.services.SessionCache
 import org.hl7.fhir.validation.cli.services.PassiveExpiringSessionCache
 
-private const val MIN_FREE_MEMORY = 250000000
+private const val MIN_FREE_MEMORY = 25000000
 private const val SESSION_DEFAULT_DURATION: Long = 60
 
+val IPS_IG = PackageInfo(
+    "hl7.fhir.uv.ips",
+    "1.1.0",
+    "4.0.1",
+    "http://hl7.org/fhir/uv/ips/STU1.1"
+)
+
+val IPS_CONTEXT = CliContext()
+    .setBaseEngine("IPS")
+    .setSv("4.0.1")
+    .addIg(PackageInfo.igLookupString(IPS_IG))
+    .setExtensions(listOf(ANY_EXTENSION))
+    .setCheckIPSCodes(true)
+    .setBundleValidationRules(listOf(
+        BundleValidationRule()
+            .setRule("Composition:0")
+            .setProfile("http://hl7.org/fhir/uv/ips/StructureDefinition/Composition-uv-ips")
+    ))
+
 class ValidationServiceFactoryImpl : ValidationServiceFactory {
     private var validationService: ValidationService
 
     init {
+        System.out.println("ValidationServiceFactoryImpl.init")
         validationService = createValidationServiceInstance();
     }
 
      fun createValidationServiceInstance() : ValidationService {
-        val sessionCacheDuration = System.getenv("SESSION_CACHE_DURATION")?.toLong() ?: SESSION_DEFAULT_DURATION;
+         System.out.println("createValidationServiceInstance")
+         val sessionCacheDuration = System.getenv("SESSION_CACHE_DURATION")?.toLong() ?: SESSION_DEFAULT_DURATION;
         val sessionCache: SessionCache = PassiveExpiringSessionCache(sessionCacheDuration, TimeUnit.MINUTES).setResetExpirationAfterFetch(true);
-        return ValidationService(sessionCache);
+        val validationService = ValidationService(sessionCache);
+         validationService.putBaseEngine("IPS", IPS_CONTEXT)
+         return validationService
     }
    
     override fun getValidationService() : ValidationService {

From bc7e4af757a1e4ce621fd09dd12e3cde058c1f01 Mon Sep 17 00:00:00 2001
From: "dotasek.dev" <dotasek.dev@gmail.com>
Date: Fri, 26 Jan 2024 16:50:34 -0500
Subject: [PATCH 02/22] WIP preset selection 2

---
 .../kotlin/constants}/Preset.kt               |   9 +-
 src/commonMain/kotlin/model/CliContext.kt     |   3 +
 .../kotlin/model/BundleValidationRule.kt      |   2 -
 src/jsMain/kotlin/model/CliContext.kt         |   2 +-
 .../ui/components/options/PresetSelect.kt     |   3 +-
 .../tabs/entrytab/ManualEntryTab.kt           | 110 ++++++++++--------
 .../ValidationServiceFactoryImpl.kt           |  22 ++--
 7 files changed, 81 insertions(+), 70 deletions(-)
 rename src/{jsMain/kotlin/utils => commonMain/kotlin/constants}/Preset.kt (96%)

diff --git a/src/jsMain/kotlin/utils/Preset.kt b/src/commonMain/kotlin/constants/Preset.kt
similarity index 96%
rename from src/jsMain/kotlin/utils/Preset.kt
rename to src/commonMain/kotlin/constants/Preset.kt
index e115dd59..78cf0989 100644
--- a/src/jsMain/kotlin/utils/Preset.kt
+++ b/src/commonMain/kotlin/constants/Preset.kt
@@ -1,12 +1,14 @@
-package utils
+package constants
 
 import model.CliContext
 import model.PackageInfo
 
-import constants.ANY_EXTENSION
 import model.BundleValidationRule
 
 val DEFAULT_CONTEXT = CliContext()
+    .setBaseEngine("DEFAULT")
+    .setSv("4.0.1")
+    .setLocale("en")
 
 val IPS_IG = PackageInfo(
     "hl7.fhir.uv.ips",
@@ -94,14 +96,17 @@ val IPS_NZ_CONTEXT = CliContext()
 
 
 val CDA_CONTEXT = CliContext()
+    .setBaseEngine("CDA")
     .setSv("5.0.0")
     .addIg(PackageInfo.igLookupString(CDA_IG))
 
 val CCDA_CONTEXT = CliContext()
+    .setBaseEngine("CCDA")
     .setSv("5.0.0")
     .addIg(PackageInfo.igLookupString(CCDA_IG))
 
 val SQL_VIEW_CONTEXT = CliContext()
+    .setBaseEngine("SQL_VIEW")
     .setSv("5.0.0")
     .addIg(PackageInfo.igLookupString(SQL_ON_FHIR_IG))
 
diff --git a/src/commonMain/kotlin/model/CliContext.kt b/src/commonMain/kotlin/model/CliContext.kt
index f9471414..2e7f9205 100644
--- a/src/commonMain/kotlin/model/CliContext.kt
+++ b/src/commonMain/kotlin/model/CliContext.kt
@@ -65,4 +65,7 @@ expect class CliContext() {
     fun setBundleValidationRules(bundleValidationRules: List<BundleValidationRule>) : CliContext
 
     fun getBundleValidationRules():List<BundleValidationRule>
+
+    fun addIg(ig: String): CliContext
+
 }
\ No newline at end of file
diff --git a/src/jsMain/kotlin/model/BundleValidationRule.kt b/src/jsMain/kotlin/model/BundleValidationRule.kt
index 35c7ddb1..469a61cc 100644
--- a/src/jsMain/kotlin/model/BundleValidationRule.kt
+++ b/src/jsMain/kotlin/model/BundleValidationRule.kt
@@ -1,8 +1,6 @@
 package model
 
-import kotlinx.js.Object
 import kotlinx.serialization.Serializable
-import utils.Preset
 
 @Serializable
 actual class BundleValidationRule actual constructor() {
diff --git a/src/jsMain/kotlin/model/CliContext.kt b/src/jsMain/kotlin/model/CliContext.kt
index 3ef7c9e4..0eea978b 100644
--- a/src/jsMain/kotlin/model/CliContext.kt
+++ b/src/jsMain/kotlin/model/CliContext.kt
@@ -160,7 +160,7 @@ actual class CliContext actual constructor() {
         return this
     }
 
-    fun addIg(ig: String): CliContext {
+   actual fun addIg(ig: String): CliContext {
         this.igs += ig
         return this
     }
diff --git a/src/jsMain/kotlin/ui/components/options/PresetSelect.kt b/src/jsMain/kotlin/ui/components/options/PresetSelect.kt
index 51e13561..7001d4f1 100644
--- a/src/jsMain/kotlin/ui/components/options/PresetSelect.kt
+++ b/src/jsMain/kotlin/ui/components/options/PresetSelect.kt
@@ -11,14 +11,13 @@ import mainScope
 import model.BundleValidationRule
 import model.PackageInfo
 import mui.system.sx
-import popper.core.Placement
 import react.Props
 import react.ReactNode
 
 import styled.css
 import styled.styledDiv
 
-import utils.Preset
+import constants.Preset
 import utils.getJS
 
 
diff --git a/src/jsMain/kotlin/ui/components/tabs/entrytab/ManualEntryTab.kt b/src/jsMain/kotlin/ui/components/tabs/entrytab/ManualEntryTab.kt
index 3861dea4..dbbe929a 100644
--- a/src/jsMain/kotlin/ui/components/tabs/entrytab/ManualEntryTab.kt
+++ b/src/jsMain/kotlin/ui/components/tabs/entrytab/ManualEntryTab.kt
@@ -2,6 +2,7 @@ package ui.components.tabs.entrytab
 
 import Polyglot
 import api.sendValidationRequest
+import constants.Preset
 
 import css.animation.FadeIn.fadeIn
 import css.const.BORDER_GRAY
@@ -154,59 +155,70 @@ class ManualEntryTab : RComponent<ManualEntryTabProps, ManualEntryTabState>() {
             displayingError = false
             ohShitYouDidIt = false
         }
-        props.toggleValidationInProgress(true)
-        println("clicontext :: sv == ${props.cliContext.getSv()}, version == ${props.cliContext.getTargetVer()}, languageCode == ${props.cliContext.getLanguageCode()}")
-        val request = assembleRequest(
-            cliContext = props.cliContext,
-            fileName = generateFileName(fileContent),
-            fileContent = fileContent,
-            fileType = null
-        ).setSessionId(props.sessionId)
-        mainScope.launch {
-            try {
-                withTimeout(VALIDATION_TIME_LIMIT) {
-                    val validationResponse = sendValidationRequest(request)
-                    props.setSessionId(validationResponse.getSessionId())
-                    val returnedOutcome = validationResponse.getOutcomes().map { it.setValidated(true) }
-                    println("File validated\n"
-                            + "filename -> " + returnedOutcome.first().getFileInfo().fileName
-                            + "content -> " + returnedOutcome.first().getFileInfo().fileContent
-                            + "type -> " + returnedOutcome.first().getFileInfo().fileType
-                            + "Issues ::\n" + returnedOutcome.first().getMessages()
-                        .joinToString { "\n" })
-                    props.setValidationOutcome(returnedOutcome.first())
-                    props.toggleValidationInProgress(false)
-                }
-            } catch (e: TimeoutCancellationException) {
-                setState {
-                    errorMessage = props.polyglot.t("manual_entry_timeout_exception")
-                    displayingError = true
-                }
-                props.toggleValidationInProgress(false)
-            } catch (e : ValidationResponseException) {
-                setState {
-                    errorMessage = props.polyglot.t("manual_entry_validation_response_exception",
-                        getJS(arrayOf(Pair("httpResponseCode", e.httpStatusCode)))
-                    )
-                    displayingError = true
-                }
-                println("Exception ${e.message}")
-            }
-            catch (e: Exception) {
-                setState {
-                    if (props.currentManuallyEnteredText.contains("Mark is super dorky")) {
-                        ohShitYouDidIt = true
-                        props.updateCurrentlyEnteredText("Ken is super dorky.")
-                        errorMessage = "Never gonna give you up, never gonna let you down, never gonna run around..."
+        println("Attempting to validate with: " + props.cliContext.getBaseEngine())
+        val cliContext : CliContext? = if (props.cliContext.getBaseEngine() == null) {
+            println("Custom validation")
+            props.cliContext
+        } else {
+            println("Preset")
+            Preset.getSelectedPreset(props.cliContext.getBaseEngine())?.cliContext
+        }
+        if (cliContext != null) {
+            props.toggleValidationInProgress(true)
+            println("clicontext :: sv == ${cliContext.getSv()}, version == ${props.cliContext.getTargetVer()}, languageCode == ${props.cliContext.getLanguageCode()}")
+            val request = assembleRequest(
+                cliContext = cliContext,
+                fileName = generateFileName(fileContent),
+                fileContent = fileContent,
+                fileType = null
+            ).setSessionId(props.sessionId)
+            mainScope.launch {
+                try {
+                    withTimeout(VALIDATION_TIME_LIMIT) {
+                        val validationResponse = sendValidationRequest(request)
+                        props.setSessionId(validationResponse.getSessionId())
+                        val returnedOutcome = validationResponse.getOutcomes().map { it.setValidated(true) }
+                        println("File validated\n"
+                                + "filename -> " + returnedOutcome.first().getFileInfo().fileName
+                                + "content -> " + returnedOutcome.first().getFileInfo().fileContent
+                                + "type -> " + returnedOutcome.first().getFileInfo().fileType
+                                + "Issues ::\n" + returnedOutcome.first().getMessages()
+                            .joinToString { "\n" })
+                        props.setValidationOutcome(returnedOutcome.first())
+                        props.toggleValidationInProgress(false)
+                    }
+                } catch (e: TimeoutCancellationException) {
+                    setState {
+                        errorMessage = props.polyglot.t("manual_entry_timeout_exception")
                         displayingError = true
-                    } else {
-                        errorMessage = props.polyglot.t("manual_entry_cannot_parse_exception")
+                    }
+                    props.toggleValidationInProgress(false)
+                } catch (e: ValidationResponseException) {
+                    setState {
+                        errorMessage = props.polyglot.t(
+                            "manual_entry_validation_response_exception",
+                            getJS(arrayOf(Pair("httpResponseCode", e.httpStatusCode)))
+                        )
                         displayingError = true
                     }
+                    println("Exception ${e.message}")
+                } catch (e: Exception) {
+                    setState {
+                        if (props.currentManuallyEnteredText.contains("Mark is super dorky")) {
+                            ohShitYouDidIt = true
+                            props.updateCurrentlyEnteredText("Ken is super dorky.")
+                            errorMessage =
+                                "Never gonna give you up, never gonna let you down, never gonna run around..."
+                            displayingError = true
+                        } else {
+                            errorMessage = props.polyglot.t("manual_entry_cannot_parse_exception")
+                            displayingError = true
+                        }
+                    }
+                    println("Exception ${e.message}")
+                } finally {
+                    props.toggleValidationInProgress(false)
                 }
-                println("Exception ${e.message}")
-            } finally {
-                props.toggleValidationInProgress(false)
             }
         }
     }
diff --git a/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt b/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt
index 54548154..a56e8a90 100644
--- a/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt
+++ b/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt
@@ -1,6 +1,7 @@
 package controller.validation
 
 import constants.ANY_EXTENSION
+import constants.Preset
 import model.PackageInfo
 import model.BundleValidationRule
 import java.util.concurrent.TimeUnit;
@@ -20,32 +21,25 @@ val IPS_IG = PackageInfo(
     "http://hl7.org/fhir/uv/ips/STU1.1"
 )
 
-val IPS_CONTEXT = CliContext()
-    .setBaseEngine("IPS")
-    .setSv("4.0.1")
-    .addIg(PackageInfo.igLookupString(IPS_IG))
-    .setExtensions(listOf(ANY_EXTENSION))
-    .setCheckIPSCodes(true)
-    .setBundleValidationRules(listOf(
-        BundleValidationRule()
-            .setRule("Composition:0")
-            .setProfile("http://hl7.org/fhir/uv/ips/StructureDefinition/Composition-uv-ips")
-    ))
+
 
 class ValidationServiceFactoryImpl : ValidationServiceFactory {
     private var validationService: ValidationService
 
     init {
-        System.out.println("ValidationServiceFactoryImpl.init")
         validationService = createValidationServiceInstance();
     }
 
      fun createValidationServiceInstance() : ValidationService {
-         System.out.println("createValidationServiceInstance")
          val sessionCacheDuration = System.getenv("SESSION_CACHE_DURATION")?.toLong() ?: SESSION_DEFAULT_DURATION;
         val sessionCache: SessionCache = PassiveExpiringSessionCache(sessionCacheDuration, TimeUnit.MINUTES).setResetExpirationAfterFetch(true);
         val validationService = ValidationService(sessionCache);
-         validationService.putBaseEngine("IPS", IPS_CONTEXT)
+         Preset.values().forEach {
+             if (it != Preset.CUSTOM) {
+                 println("Loading preset: " + it.key)
+                 validationService.putBaseEngine(it.key, it.cliContext)
+             }
+         }
          return validationService
     }
    

From d5728346da26aede6cb5b0f81f980a4ac3d0e378 Mon Sep 17 00:00:00 2001
From: "dotasek.dev" <dotasek.dev@gmail.com>
Date: Wed, 31 Jan 2024 16:25:40 -0500
Subject: [PATCH 03/22] Start test cases

---
 http-client-tests/http-client.env.json        |  8 ++
 .../explicit-preset-requests/cda.json         | 17 ++++
 .../explicit-preset-requests/ips.json         | 29 ++++++
 .../explicit-preset-requests/sql-on-fhir.json | 16 ++++
 .../explicit-preset-requests/us-ccda.json     | 16 ++++
 http-client-tests/tests/explicit-queries.http | 89 +++++++++++++++++++
 http-client-tests/utilities/assertions.js     | 25 ++++++
 7 files changed, 200 insertions(+)
 create mode 100644 http-client-tests/http-client.env.json
 create mode 100644 http-client-tests/resources/explicit-preset-requests/cda.json
 create mode 100644 http-client-tests/resources/explicit-preset-requests/ips.json
 create mode 100644 http-client-tests/resources/explicit-preset-requests/sql-on-fhir.json
 create mode 100644 http-client-tests/resources/explicit-preset-requests/us-ccda.json
 create mode 100644 http-client-tests/tests/explicit-queries.http
 create mode 100644 http-client-tests/utilities/assertions.js

diff --git a/http-client-tests/http-client.env.json b/http-client-tests/http-client.env.json
new file mode 100644
index 00000000..15809801
--- /dev/null
+++ b/http-client-tests/http-client.env.json
@@ -0,0 +1,8 @@
+{
+  "default": {
+    "host": "https://validator.fhir.org"
+  },
+  "local": {
+    "host": "http://localhost:8082"
+  }
+}
\ No newline at end of file
diff --git a/http-client-tests/resources/explicit-preset-requests/cda.json b/http-client-tests/resources/explicit-preset-requests/cda.json
new file mode 100644
index 00000000..496dda2f
--- /dev/null
+++ b/http-client-tests/resources/explicit-preset-requests/cda.json
@@ -0,0 +1,17 @@
+{
+  "cliContext": {
+    "sv": "5.0.0",
+    "igs": [
+      "hl7.cda.uv.core#2.0.0-sd-ballot"
+    ],
+    "locale": "en"
+  },
+  "filesToValidate": [
+    {
+      "fileName": "manually_entered_file.xml",
+      "fileContent": "<ClinicalDocument xmlns=\"urn:hl7-org:v3\" xmlns:sdtc=\"urn:hl7-org:sdtc\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"urn:hl7-org:v3-test CDA.xsd\">\n\t<templateId root=\"2.16.840.1.113883.3.27.1776\"/>\n\t<id extension=\"c266\" root=\"2.16.840.1.113883.19.4\"/>\n  <code code=\"X-34133-9\" displayName=\"SoEN\" sdtc:valueSet=\"2.16.840.1.113883.1.2.3.4.5.6\" codeSystem=\"2.16.840.1.113883.6.1\" codeSystemName=\"LOINC\"/>\n  <title>Episode Note</title>\n\n</ClinicalDocument>",
+      "fileType": null
+    }
+  ],
+  "sessionId": "604864d9-2f82-42e8-885e-6a6b28267487"
+}
\ No newline at end of file
diff --git a/http-client-tests/resources/explicit-preset-requests/ips.json b/http-client-tests/resources/explicit-preset-requests/ips.json
new file mode 100644
index 00000000..ec046d68
--- /dev/null
+++ b/http-client-tests/resources/explicit-preset-requests/ips.json
@@ -0,0 +1,29 @@
+{
+  "cliContext": {
+    "extensions": [
+      "any"
+    ],
+    "sv": "4.0.1",
+    "igs": [
+      "hl7.fhir.uv.ips#1.1.0"
+    ],
+    "profiles": [
+      "http://hl7.org/fhir/uv/ips/StructureDefinition/Bundle-uv-ips"
+    ],
+    "checkIPSCodes": true,
+    "bundleValidationRules": [
+      {
+        "rule": "Composition:0",
+        "profile": "http://hl7.org/fhir/uv/ips/StructureDefinition/Composition-uv-ips"
+      }
+    ],
+    "locale": "en"
+  },
+  "filesToValidate": [
+    {
+      "fileName": "manually_entered_file.json",
+      "fileContent": "{\n  \"resourceType\" : \"Bundle\",\n  \"id\" : \"bundle-minimal\",\n  \"language\" : \"en-US\",\n  \"identifier\" : {\n    \"system\" : \"urn:oid:2.16.724.4.8.10.200.10\",\n    \"value\" : \"28b95815-76ce-457b-b7ae-a972e527db40\"\n  },\n  \"type\" : \"document\",\n  \"timestamp\" : \"2020-12-11T14:30:00+01:00\",\n  \"entry\" : [{\n    \"fullUrl\" : \"urn:uuid:6e1fb74a-742b-4c7b-8487-171dacb88766\",\n    \"resource\" : {\n      \"resourceType\" : \"Composition\",\n      \"id\" : \"6e1fb74a-742b-4c7b-8487-171dacb88766\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative</b></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource \\\"6e1fb74a-742b-4c7b-8487-171dacb88766\\\" </p></div><p><b>status</b>: final</p><p><b>type</b>: Patient summary Document <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://loinc.org/\\\">LOINC</a>#60591-5)</span></p><p><b>date</b>: 2020-12-11 02:30:00+0100</p><p><b>author</b>: Beetje van Hulp, MD </p><p><b>title</b>: Patient Summary as of December 11, 2020 14:30</p><p><b>confidentiality</b>: N</p><blockquote><p><b>attester</b></p><p><b>mode</b>: legal</p><p><b>time</b>: 2020-12-11 02:30:00+0100</p><p><b>party</b>: Beetje van Hulp, MD </p></blockquote><blockquote><p><b>attester</b></p><p><b>mode</b>: legal</p><p><b>time</b>: 2020-12-11 02:30:00+0100</p><p><b>party</b>: Anorg Aniza Tion BV </p></blockquote><p><b>custodian</b>: Anorg Aniza Tion BV</p><h3>RelatesTos</h3><table class=\\\"grid\\\"><tr><td>-</td><td><b>Code</b></td><td><b>Target[x]</b></td></tr><tr><td>*</td><td>appends</td><td>id: 20e12ce3-857f-49c0-b888-cb670597f191</td></tr></table><h3>Events</h3><table class=\\\"grid\\\"><tr><td>-</td><td><b>Code</b></td><td><b>Period</b></td></tr><tr><td>*</td><td>care provision <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/CodeSystem/v3-ActClass\\\">ActClass</a>#PCPR)</span></td><td>?? --&gt; 2020-12-11 02:30:00+0100</td></tr></table></div>\"\n      },\n      \"status\" : \"final\",\n      \"type\" : {\n        \"coding\" : [{\n          \"system\" : \"http://loinc.org\",\n          \"code\" : \"60591-5\",\n          \"display\" : \"Patient summary Document\"\n        }]\n      },\n      \"subject\" : {\n        \"reference\" : \"Patient/7685713c-e29e-4a75-8a90-45be7ba3be94\"\n      },\n      \"date\" : \"2020-12-11T14:30:00+01:00\",\n      \"author\" : [{\n        \"reference\" : \"Practitioner/98315ba9-ffea-41ef-b59b-a836c039858f\"\n      }],\n      \"title\" : \"Patient Summary as of December 11, 2020 14:30\",\n      \"confidentiality\" : \"N\",\n      \"attester\" : [{\n        \"mode\" : \"legal\",\n        \"time\" : \"2020-12-11T14:30:00+01:00\",\n        \"party\" : {\n          \"reference\" : \"Practitioner/98315ba9-ffea-41ef-b59b-a836c039858f\"\n        }\n      },\n      {\n        \"mode\" : \"legal\",\n        \"time\" : \"2020-12-11T14:30:00+01:00\",\n        \"party\" : {\n          \"reference\" : \"Organization/bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d\"\n        }\n      }],\n      \"custodian\" : {\n        \"reference\" : \"Organization/bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d\"\n      },\n      \"relatesTo\" : [{\n        \"code\" : \"appends\",\n        \"targetIdentifier\" : {\n          \"system\" : \"urn:oid:2.16.724.4.8.10.200.10\",\n          \"value\" : \"20e12ce3-857f-49c0-b888-cb670597f191\"\n        }\n      }],\n      \"event\" : [{\n        \"code\" : [{\n          \"coding\" : [{\n            \"system\" : \"http://terminology.hl7.org/CodeSystem/v3-ActClass\",\n            \"code\" : \"PCPR\"\n          }]\n        }],\n        \"period\" : {\n          \"end\" : \"2020-12-11T14:30:00+01:00\"\n        }\n      }],\n      \"section\" : [{\n        \"title\" : \"Active Problems\",\n        \"code\" : {\n          \"coding\" : [{\n            \"system\" : \"http://loinc.org\",\n            \"code\" : \"11450-4\",\n            \"display\" : \"Problem list Reported\"\n          }]\n        },\n        \"text\" : {\n          \"status\" : \"generated\",\n          \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><ul><li><div><b>Condition Name</b>: Menopausal Flushing</div><div><b>Code</b>: <span>198436008</span></div><div><b>Status</b>: <span>Active</span></div></li></ul></div>\"\n        },\n        \"entry\" : [{\n          \"reference\" : \"Condition/ad84b7a2-b4dd-474e-bef3-0779e6cb595f\"\n        }]\n      },\n      {\n        \"title\" : \"Medication\",\n        \"code\" : {\n          \"coding\" : [{\n            \"system\" : \"http://loinc.org\",\n            \"code\" : \"10160-0\",\n            \"display\" : \"History of Medication use Narrative\"\n          }]\n        },\n        \"text\" : {\n          \"status\" : \"generated\",\n          \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><ul><li><div><b>Medication Name</b>: Oral anastrozole 1mg tablet</div><div><b>Code</b>: <span></span></div><div><b>Status</b>: <span>Active, started March 2015</span></div><div>Instructions: Take 1 time per day</div></li></ul></div>\"\n        },\n        \"entry\" : [{\n          \"reference\" : \"MedicationStatement/6e883e5e-7648-485a-86de-3640a61601fe\"\n        }]\n      },\n      {\n        \"title\" : \"Allergies and Intolerances\",\n        \"code\" : {\n          \"coding\" : [{\n            \"system\" : \"http://loinc.org\",\n            \"code\" : \"48765-2\",\n            \"display\" : \"Allergies and adverse reactions Document\"\n          }]\n        },\n        \"text\" : {\n          \"status\" : \"generated\",\n          \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><ul><li><div><b>Allergy Name</b>: Pencillins</div><div><b>Verification Status</b>: Confirmed</div><div><b>Reaction</b>: <span>no information</span></div></li></ul></div>\"\n        },\n        \"entry\" : [{\n          \"reference\" : \"AllergyIntolerance/fe2769fd-22c9-4307-9122-ee0466e5aebb\"\n        }]\n      }]\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:7685713c-e29e-4a75-8a90-45be7ba3be94\",\n    \"resource\" : {\n      \"resourceType\" : \"Patient\",\n      \"id\" : \"7685713c-e29e-4a75-8a90-45be7ba3be94\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: Patient</b><a name=\\\"7685713c-e29e-4a75-8a90-45be7ba3be94\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource Patient &quot;7685713c-e29e-4a75-8a90-45be7ba3be94&quot; </p></div><p><b>identifier</b>: id:\\u00a0574687583</p><p><b>active</b>: true</p><p><b>name</b>: Martha DeLarosa </p><p><b>telecom</b>: <a href=\\\"tel:+31788700800\\\">+31788700800</a></p><p><b>gender</b>: female</p><p><b>birthDate</b>: 1972-05-01</p><p><b>address</b>: Laan Van Europa 1600 Dordrecht 3317 DB NL </p><h3>Contacts</h3><table class=\\\"grid\\\"><tr><td style=\\\"display: none\\\">-</td><td><b>Relationship</b></td><td><b>Name</b></td><td><b>Telecom</b></td><td><b>Address</b></td></tr><tr><td style=\\\"display: none\\\">*</td><td>mother <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-v3-RoleCode.html\\\">RoleCode</a>#MTH)</span></td><td>Martha Mum </td><td><a href=\\\"tel:+33-555-20036\\\">+33-555-20036</a></td><td>Promenade des Anglais 111 Lyon 69001 FR </td></tr></table></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:2.16.840.1.113883.2.4.6.3\",\n        \"value\" : \"574687583\"\n      }],\n      \"active\" : true,\n      \"name\" : [{\n        \"family\" : \"DeLarosa\",\n        \"given\" : [\"Martha\"]\n      }],\n      \"telecom\" : [{\n        \"system\" : \"phone\",\n        \"value\" : \"+31788700800\",\n        \"use\" : \"home\"\n      }],\n      \"gender\" : \"female\",\n      \"birthDate\" : \"1972-05-01\",\n      \"address\" : [{\n        \"line\" : [\"Laan Van Europa 1600\"],\n        \"city\" : \"Dordrecht\",\n        \"postalCode\" : \"3317 DB\",\n        \"country\" : \"NL\"\n      }],\n      \"contact\" : [{\n        \"relationship\" : [{\n          \"coding\" : [{\n            \"system\" : \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n            \"code\" : \"MTH\"\n          }]\n        }],\n        \"name\" : {\n          \"family\" : \"Mum\",\n          \"given\" : [\"Martha\"]\n        },\n        \"telecom\" : [{\n          \"system\" : \"phone\",\n          \"value\" : \"+33-555-20036\",\n          \"use\" : \"home\"\n        }],\n        \"address\" : {\n          \"line\" : [\"Promenade des Anglais 111\"],\n          \"city\" : \"Lyon\",\n          \"postalCode\" : \"69001\",\n          \"country\" : \"FR\"\n        }\n      }]\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:98315ba9-ffea-41ef-b59b-a836c039858f\",\n    \"resource\" : {\n      \"resourceType\" : \"Practitioner\",\n      \"id\" : \"98315ba9-ffea-41ef-b59b-a836c039858f\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: Practitioner</b><a name=\\\"98315ba9-ffea-41ef-b59b-a836c039858f\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource Practitioner &quot;98315ba9-ffea-41ef-b59b-a836c039858f&quot; </p></div><p><b>identifier</b>: id:\\u00a0129854633</p><p><b>active</b>: true</p><p><b>name</b>: Beetje van Hulp </p><h3>Qualifications</h3><table class=\\\"grid\\\"><tr><td style=\\\"display: none\\\">-</td><td><b>Code</b></td></tr><tr><td style=\\\"display: none\\\">*</td><td>Doctor of Medicine <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (degreeLicenseCertificate[2.7]#MD)</span></td></tr></table></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:2.16.528.1.1007.3.1\",\n        \"value\" : \"129854633\",\n        \"assigner\" : {\n          \"display\" : \"CIBG\"\n        }\n      }],\n      \"active\" : true,\n      \"name\" : [{\n        \"family\" : \"van Hulp\",\n        \"given\" : [\"Beetje\"]\n      }],\n      \"qualification\" : [{\n        \"code\" : {\n          \"coding\" : [{\n            \"system\" : \"http://terminology.hl7.org/CodeSystem/v2-0360\",\n            \"version\" : \"2.7\",\n            \"code\" : \"MD\",\n            \"display\" : \"Doctor of Medicine\"\n          }]\n        }\n      }]\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d\",\n    \"resource\" : {\n      \"resourceType\" : \"Organization\",\n      \"id\" : \"bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: Organization</b><a name=\\\"bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource Organization &quot;bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d&quot; </p></div><p><b>identifier</b>: id:\\u00a0564738757</p><p><b>active</b>: true</p><p><b>name</b>: Anorg Aniza Tion BV / The best custodian ever</p><p><b>telecom</b>: <a href=\\\"tel:+31-51-34343400\\\">+31-51-34343400</a></p><p><b>address</b>: Houttuinen 27 Dordrecht 3311 CE NL (WORK)</p></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:2.16.528.1.1007.3.3\",\n        \"value\" : \"564738757\"\n      }],\n      \"active\" : true,\n      \"name\" : \"Anorg Aniza Tion BV / The best custodian ever\",\n      \"telecom\" : [{\n        \"system\" : \"phone\",\n        \"value\" : \"+31-51-34343400\",\n        \"use\" : \"work\"\n      }],\n      \"address\" : [{\n        \"use\" : \"work\",\n        \"line\" : [\"Houttuinen 27\"],\n        \"city\" : \"Dordrecht\",\n        \"postalCode\" : \"3311 CE\",\n        \"country\" : \"NL\"\n      }]\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:ad84b7a2-b4dd-474e-bef3-0779e6cb595f\",\n    \"resource\" : {\n      \"resourceType\" : \"Condition\",\n      \"id\" : \"ad84b7a2-b4dd-474e-bef3-0779e6cb595f\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: Condition</b><a name=\\\"ad84b7a2-b4dd-474e-bef3-0779e6cb595f\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource Condition &quot;ad84b7a2-b4dd-474e-bef3-0779e6cb595f&quot; </p></div><p><b>identifier</b>: id:\\u00a0cacceb57-395f-48e1-9c88-e9c9704dc2d2</p><p><b>clinicalStatus</b>: Active <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-condition-clinical.html\\\">Condition Clinical Status Codes</a>#active)</span></p><p><b>verificationStatus</b>: Confirmed <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-condition-ver-status.html\\\">ConditionVerificationStatus</a>#confirmed)</span></p><p><b>category</b>: Problem <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://loinc.org/\\\">LOINC</a>#75326-9)</span></p><p><b>severity</b>: Moderate <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://loinc.org/\\\">LOINC</a>#LA6751-7)</span></p><p><b>code</b>: Menopausal flushing (finding) <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://browser.ihtsdotools.org/\\\">SNOMED CT</a>#198436008; <a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-icd10.html\\\">ICD-10</a>#N95.1 &quot;Menopausal and female climacteric states&quot;)</span></p><p><b>subject</b>: <a href=\\\"#Patient_7685713c-e29e-4a75-8a90-45be7ba3be94\\\">See above (Patient/7685713c-e29e-4a75-8a90-45be7ba3be94)</a></p><p><b>onset</b>: 2015</p><p><b>recordedDate</b>: 2016-10</p></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:1.2.3.999\",\n        \"value\" : \"cacceb57-395f-48e1-9c88-e9c9704dc2d2\"\n      }],\n      \"clinicalStatus\" : {\n        \"coding\" : [{\n          \"system\" : \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n          \"code\" : \"active\"\n        }]\n      },\n      \"verificationStatus\" : {\n        \"coding\" : [{\n          \"system\" : \"http://terminology.hl7.org/CodeSystem/condition-ver-status\",\n          \"code\" : \"confirmed\"\n        }]\n      },\n      \"category\" : [{\n        \"coding\" : [{\n          \"system\" : \"http://loinc.org\",\n          \"code\" : \"75326-9\",\n          \"display\" : \"Problem\"\n        }]\n      }],\n      \"severity\" : {\n        \"coding\" : [{\n          \"system\" : \"http://loinc.org\",\n          \"code\" : \"LA6751-7\",\n          \"display\" : \"Moderate\"\n        }]\n      },\n      \"code\" : {\n        \"coding\" : [{\n          \"system\" : \"http://snomed.info/sct\",\n          \"code\" : \"198436008\",\n          \"display\" : \"Menopausal flushing (finding)\",\n          \"_display\" : {\n            \"extension\" : [{\n              \"extension\" : [{\n                \"url\" : \"lang\",\n                \"valueCode\" : \"nl-NL\"\n              },\n              {\n                \"url\" : \"content\",\n                \"valueString\" : \"opvliegers\"\n              }],\n              \"url\" : \"http://hl7.org/fhir/StructureDefinition/translation\"\n            }]\n          }\n        },\n        {\n          \"system\" : \"http://hl7.org/fhir/sid/icd-10\",\n          \"code\" : \"N95.1\",\n          \"display\" : \"Menopausal and female climacteric states\"\n        }]\n      },\n      \"subject\" : {\n        \"reference\" : \"Patient/7685713c-e29e-4a75-8a90-45be7ba3be94\"\n      },\n      \"onsetDateTime\" : \"2015\",\n      \"recordedDate\" : \"2016-10\"\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:6e883e5e-7648-485a-86de-3640a61601fe\",\n    \"resource\" : {\n      \"resourceType\" : \"MedicationStatement\",\n      \"id\" : \"6e883e5e-7648-485a-86de-3640a61601fe\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: MedicationStatement</b><a name=\\\"6e883e5e-7648-485a-86de-3640a61601fe\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource MedicationStatement &quot;6e883e5e-7648-485a-86de-3640a61601fe&quot; </p></div><p><b>identifier</b>: id:\\u00a08faf0319-89d3-427c-b9d1-e8c8fd390dca</p><p><b>status</b>: active</p><p><b>medication</b>: <a href=\\\"#Medication_6369a973-afc7-4617-8877-3e9811e05a5b\\\">See above (Medication/6369a973-afc7-4617-8877-3e9811e05a5b)</a></p><p><b>subject</b>: <a href=\\\"#Patient_7685713c-e29e-4a75-8a90-45be7ba3be94\\\">See above (Patient/7685713c-e29e-4a75-8a90-45be7ba3be94)</a></p><p><b>effective</b>: 2015-03 --&gt; (ongoing)</p><blockquote><p><b>dosage</b></p><p><b>timing</b>: Count 1 times, Once</p><p><b>route</b>: Oral use <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (standardterms.edqm.eu#20053000)</span></p><blockquote><p><b>doseAndRate</b></p></blockquote></blockquote></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:1.2.3.999\",\n        \"value\" : \"8faf0319-89d3-427c-b9d1-e8c8fd390dca\"\n      }],\n      \"status\" : \"active\",\n      \"medicationReference\" : {\n        \"reference\" : \"Medication/6369a973-afc7-4617-8877-3e9811e05a5b\"\n      },\n      \"subject\" : {\n        \"reference\" : \"Patient/7685713c-e29e-4a75-8a90-45be7ba3be94\"\n      },\n      \"effectivePeriod\" : {\n        \"start\" : \"2015-03\"\n      },\n      \"dosage\" : [{\n        \"timing\" : {\n          \"repeat\" : {\n            \"count\" : 1,\n            \"periodUnit\" : \"d\"\n          }\n        },\n        \"route\" : {\n          \"coding\" : [{\n            \"system\" : \"http://standardterms.edqm.eu\",\n            \"code\" : \"20053000\",\n            \"display\" : \"Oral use\"\n          }]\n        },\n        \"doseAndRate\" : [{\n          \"type\" : {\n            \"coding\" : [{\n              \"system\" : \"http://terminology.hl7.org/CodeSystem/dose-rate-type\",\n              \"code\" : \"ordered\",\n              \"display\" : \"Ordered\"\n            }]\n          },\n          \"doseQuantity\" : {\n            \"value\" : 1,\n            \"unit\" : \"tablet\",\n            \"system\" : \"http://unitsofmeasure.org\",\n            \"code\" : \"1\"\n          }\n        }]\n      }]\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:6369a973-afc7-4617-8877-3e9811e05a5b\",\n    \"resource\" : {\n      \"resourceType\" : \"Medication\",\n      \"id\" : \"6369a973-afc7-4617-8877-3e9811e05a5b\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: Medication</b><a name=\\\"6369a973-afc7-4617-8877-3e9811e05a5b\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource Medication &quot;6369a973-afc7-4617-8877-3e9811e05a5b&quot; </p></div><p><b>code</b>: Product containing anastrozole (medicinal product) <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://browser.ihtsdotools.org/\\\">SNOMED CT</a>#108774000; unknown#99872 &quot;ANASTROZOL 1MG TABLET&quot;; unknown#2076667 &quot;ANASTROZOL CF TABLET FILMOMHULD 1MG&quot;; <a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-v3-WC.html\\\">WHO ATC</a>#L02BG03 &quot;anastrozole&quot;)</span></p></div>\"\n      },\n      \"code\" : {\n        \"coding\" : [{\n          \"system\" : \"http://snomed.info/sct\",\n          \"code\" : \"108774000\",\n          \"display\" : \"Product containing anastrozole (medicinal product)\"\n        },\n        {\n          \"system\" : \"urn:oid:2.16.840.1.113883.2.4.4.1\",\n          \"code\" : \"99872\",\n          \"display\" : \"ANASTROZOL 1MG TABLET\"\n        },\n        {\n          \"system\" : \"urn:oid:2.16.840.1.113883.2.4.4.7\",\n          \"code\" : \"2076667\",\n          \"display\" : \"ANASTROZOL CF TABLET FILMOMHULD 1MG\"\n        },\n        {\n          \"system\" : \"http://www.whocc.no/atc\",\n          \"code\" : \"L02BG03\",\n          \"display\" : \"anastrozole\"\n        }]\n      }\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:fe2769fd-22c9-4307-9122-ee0466e5aebb\",\n    \"resource\" : {\n      \"resourceType\" : \"AllergyIntolerance\",\n      \"id\" : \"fe2769fd-22c9-4307-9122-ee0466e5aebb\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: AllergyIntolerance</b><a name=\\\"fe2769fd-22c9-4307-9122-ee0466e5aebb\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource AllergyIntolerance &quot;fe2769fd-22c9-4307-9122-ee0466e5aebb&quot; </p></div><p><b>identifier</b>: id:\\u00a08d9566a4-d26d-46be-a3e4-c9f3a0e5cd83</p><p><b>clinicalStatus</b>: Active <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-allergyintolerance-clinical.html\\\">AllergyIntolerance Clinical Status Codes</a>#active)</span></p><p><b>verificationStatus</b>: Confirmed <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-allergyintolerance-verification.html\\\">AllergyIntolerance Verification Status</a>#confirmed)</span></p><p><b>type</b>: allergy</p><p><b>category</b>: medication</p><p><b>criticality</b>: high</p><p><b>code</b>: Substance with penicillin structure and antibacterial mechanism of action (substance) <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://browser.ihtsdotools.org/\\\">SNOMED CT</a>#373270004)</span></p><p><b>patient</b>: <a href=\\\"#Patient_7685713c-e29e-4a75-8a90-45be7ba3be94\\\">See above (Patient/7685713c-e29e-4a75-8a90-45be7ba3be94)</a></p><p><b>onset</b>: 2010</p></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:1.2.3.999\",\n        \"value\" : \"8d9566a4-d26d-46be-a3e4-c9f3a0e5cd83\"\n      }],\n      \"clinicalStatus\" : {\n        \"coding\" : [{\n          \"system\" : \"http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical\",\n          \"code\" : \"active\"\n        }]\n      },\n      \"verificationStatus\" : {\n        \"coding\" : [{\n          \"system\" : \"http://terminology.hl7.org/CodeSystem/allergyintolerance-verification\",\n          \"code\" : \"confirmed\"\n        }]\n      },\n      \"type\" : \"allergy\",\n      \"category\" : [\"medication\"],\n      \"criticality\" : \"high\",\n      \"code\" : {\n        \"coding\" : [{\n          \"system\" : \"http://snomed.info/sct\",\n          \"code\" : \"373270004\",\n          \"display\" : \"Substance with penicillin structure and antibacterial mechanism of action (substance)\"\n        }]\n      },\n      \"patient\" : {\n        \"reference\" : \"Patient/7685713c-e29e-4a75-8a90-45be7ba3be94\"\n      },\n      \"onsetDateTime\" : \"2010\"\n    }\n  }]\n}",
+      "fileType": null
+    }
+  ]
+}
\ No newline at end of file
diff --git a/http-client-tests/resources/explicit-preset-requests/sql-on-fhir.json b/http-client-tests/resources/explicit-preset-requests/sql-on-fhir.json
new file mode 100644
index 00000000..b4a2db2b
--- /dev/null
+++ b/http-client-tests/resources/explicit-preset-requests/sql-on-fhir.json
@@ -0,0 +1,16 @@
+{
+  "cliContext": {
+    "sv": "5.0.0",
+    "igs": [
+      "hl7.fhir.uv.sql-on-fhir#current"
+    ],
+    "locale": "en"
+  },
+  "filesToValidate": [
+    {
+      "fileName": "manually_entered_file.json",
+      "fileContent": "{\n    \"resourceType\": \"http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition\",\n    \"select\": [\n      {\n        \"column\": [\n          {\n            \"path\": \"getResourceKey()\",\n            \"name\": \"patient_id\"\n          }\n        ]\n      },\n      {\n        \"column\": [\n          {\n            \"path\": \"line.join('\\n')\",\n            \"name\": \"street\",\n            \"description\": \"The full street address, including newlines if present.\"\n          },\n          {\n            \"path\": \"use\",\n            \"name\": \"use\"\n          },\n          {\n            \"path\": \"city\",\n            \"name\": \"city\"\n          },\n          {\n            \"path\": \"postalCode\",\n            \"name\": \"zip\"\n          }\n        ],\n        \"forEach\": \"address\"\n      }\n    ],\n    \"name\": \"patient_addresses\",\n    \"status\": \"draft\",\n    \"resource\": \"Patient\"\n  }",
+      "fileType": null
+    }
+  ]
+}
\ No newline at end of file
diff --git a/http-client-tests/resources/explicit-preset-requests/us-ccda.json b/http-client-tests/resources/explicit-preset-requests/us-ccda.json
new file mode 100644
index 00000000..3e794f12
--- /dev/null
+++ b/http-client-tests/resources/explicit-preset-requests/us-ccda.json
@@ -0,0 +1,16 @@
+{
+  "cliContext": {
+    "sv": "5.0.0",
+    "igs": [
+      "hl7.cda.us.ccda#current"
+    ],
+    "locale": "en"
+  },
+  "filesToValidate": [
+    {
+      "fileName": "manually_entered_file.xml",
+      "fileContent": "<ClinicalDocument xmlns=\"urn:hl7-org:v3\" xmlns:sdtc=\"urn:hl7-org:sdtc\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"urn:hl7-org:v3-test CDA.xsd\">\n\t<templateId root=\"2.16.840.1.113883.3.27.1776\"/>\n\t<id extension=\"c266\" root=\"2.16.840.1.113883.19.4\"/>\n  <code code=\"X-34133-9\" displayName=\"SoEN\" sdtc:valueSet=\"2.16.840.1.113883.1.2.3.4.5.6\" codeSystem=\"2.16.840.1.113883.6.1\" codeSystemName=\"LOINC\"/>\n  <title>Episode Note</title>\n\n</ClinicalDocument>",
+      "fileType": null
+    }
+  ]
+}
\ No newline at end of file
diff --git a/http-client-tests/tests/explicit-queries.http b/http-client-tests/tests/explicit-queries.http
new file mode 100644
index 00000000..0ea166a4
--- /dev/null
+++ b/http-client-tests/tests/explicit-queries.http
@@ -0,0 +1,89 @@
+# These tests do validations using CliContext instances that are manually constructed
+# equivalents to those in commonMain/kotlin/constants/Preset
+
+# Conversely, the preset-queries.http tests will perform the same tests, but using
+# the baseEngine field of the CliContext to utilize the pre-built ValidationEngine
+# from the ValidationService
+
+
+
+### CDA
+# Check that a request with explicit IG settings returns an expected response
+POST {{host}}/validate
+Content-Type: application/json
+
+< ../resources/explicit-preset-requests/cda.json
+
+> {%
+    client.test("Validated Successfully", function() {
+        client.assert(response.status === 200, "Response status is not 201");
+    });
+    import { containsIssue } from "../utilities/assertions";
+    client.test("Issues are Correct", function() {
+        let issues = response.body.outcomes[0].issues
+
+        client.assert(issues.length === 7);
+    });
+%}
+
+
+### US-CDA
+# Check that a request with explicit IG settings returns an expected response
+POST {{host}}/validate
+Content-Type: application/json
+
+< ../resources/explicit-preset-requests/us-ccda.json
+
+> {%
+    client.test("Validated Successfully", function() {
+        client.assert(response.status === 200, "Response status is not 201");
+    });
+    import { containsIssue } from "../utilities/assertions";
+    client.test("Issues are Correct", function() {
+        let issues = response.body.outcomes[0].issues
+
+        client.assert(issues.length === 7);
+    });
+%}
+
+### IPS
+#
+POST {{host}}/validate
+Content-Type: application/json
+
+< ../resources/explicit-preset-requests/ips.json
+
+> {%
+    client.test("Validated Successfully", function() {
+        client.assert(response.status === 200, "Response status is not 201");
+    });
+    import { containsIssue } from "../utilities/assertions";
+    client.test("Issues are Correct", function() {
+        let issues = response.body.outcomes[0].issues
+        client.assert(issues.length === 32);
+        client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 373270004 (Substance with penicillin structure and antibacterial mechanism of action) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
+        client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 108774000 (Product containing anastrozole (medicinal product)) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
+    });
+%}
+
+
+### SQL-ON-FHIR
+# Check that a request with explicit IG settings returns an expected response
+POST {{host}}/validate
+Content-Type: application/json
+
+< ../resources/explicit-preset-requests/sql-on-fhir.json
+
+> {%
+    client.test("Validated Successfully", function() {
+        client.assert(response.status === 200, "Response status is not 201");
+    });
+    import { containsIssue } from "../utilities/assertions";
+    client.test("Issues are Correct", function() {
+        let issues = response.body.outcomes[0].issues
+        client.assert(issues.length === 3);
+        client.assert(containsIssue(issues, 20, 21, "The column 'use' appears to be a collection based on it's path. Collections are not supported in all execution contexts", "BUSINESSRULE", "WARNING"))
+        client.assert(containsIssue(issues, 24, 21, "The column 'city' appears to be a collection based on it's path. Collections are not supported in all execution contexts", "BUSINESSRULE", "WARNING"))
+        client.assert(containsIssue(issues, 28, 21, "The column 'zip' appears to be a collection based on it's path. Collections are not supported in all execution contexts", "BUSINESSRULE", "WARNING"))
+    });
+%}
\ No newline at end of file
diff --git a/http-client-tests/utilities/assertions.js b/http-client-tests/utilities/assertions.js
new file mode 100644
index 00000000..57e6a402
--- /dev/null
+++ b/http-client-tests/utilities/assertions.js
@@ -0,0 +1,25 @@
+/**
+ * Blocks the execution thread for the at least the specified time in milliseconds.
+ *
+ * Analogous to Java Thread.sleep
+ * @param issues
+ * @param line
+ * @param col
+ * @param message
+ * @param type
+ * @param level
+ */
+export function containsIssue(issues, line, col, message, type, level) {
+    for (let index in issues) {
+
+        if (issues[index].line === line
+            && issues[index].col === col
+            && issues[index].message === message
+            && issues[index].type === type
+            && issues[index].level === level
+        ) {
+            return true;
+        }
+    }
+    return false;
+}
\ No newline at end of file

From 59b3016d4d9da44d13a6bbbd42ad633627577526 Mon Sep 17 00:00:00 2001
From: "dotasek.dev" <dotasek.dev@gmail.com>
Date: Wed, 31 Jan 2024 16:27:19 -0500
Subject: [PATCH 04/22] Allow language setting for baseEngine use

---
 src/jsMain/kotlin/utils/RequestUtils.kt | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/jsMain/kotlin/utils/RequestUtils.kt b/src/jsMain/kotlin/utils/RequestUtils.kt
index 073e7293..39268bb8 100644
--- a/src/jsMain/kotlin/utils/RequestUtils.kt
+++ b/src/jsMain/kotlin/utils/RequestUtils.kt
@@ -19,5 +19,17 @@ fun assembleRequest(cliContext: CliContext, file: FileInfo): ValidationRequest {
 }
 
 fun assembleRequest(cliContext: CliContext, files: List<FileInfo>): ValidationRequest {
-    return ValidationRequest(cliContext, files)
-}
\ No newline at end of file
+    val assembledCliContext : CliContext= assembleCliContext(cliContext);
+    return ValidationRequest(assembledCliContext, files)
+}
+
+fun assembleCliContext(cliContext: CliContext): CliContext {
+    if (cliContext.getBaseEngine() == null) {
+        return cliContext
+    }
+    console.log("Building new CLI Context")
+    val baseEngineContext = CliContext()
+    baseEngineContext.setBaseEngine(cliContext.getBaseEngine())
+    baseEngineContext.setLocale(cliContext.getLanguageCode())
+    return baseEngineContext;
+}

From 60561fe8e5cc990f866ca37114f5a653907cf595 Mon Sep 17 00:00:00 2001
From: "dotasek.dev" <dotasek.dev@gmail.com>
Date: Wed, 31 Jan 2024 16:27:29 -0500
Subject: [PATCH 05/22] Bump core

---
 gradle.properties | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gradle.properties b/gradle.properties
index dcbc0652..2e1722d1 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -2,7 +2,7 @@ kotlin.code.style=official
 kotlin.js.generate.executable.default=false
 
 # versions
-fhirCoreVersion=6.2.15-SNAPSHOT
+fhirCoreVersion=6.2.16-SNAPSHOT
 
 junitVersion=5.7.1
 mockk_version=1.10.2

From c937d6e53dfb636af7cbf102208bd09f7c24ac00 Mon Sep 17 00:00:00 2001
From: dotasek <david.otasek@smilecdr.com>
Date: Thu, 1 Feb 2024 16:44:03 -0500
Subject: [PATCH 06/22] Update samples for direct testing against

---
 .../explicit-preset-requests/cda.json         |    7 +-
 .../explicit-preset-requests/ips-au.json      |   29 +
 .../explicit-preset-requests/ips-nz.json      |   29 +
 .../explicit-preset-requests/us-ccda.json     |    4 +-
 http-client-tests/resources/sources/README.md |   36 +
 http-client-tests/resources/sources/ccda.xml  |  460 +++
 .../resources/sources/ips-nz.json             | 3044 +++++++++++++++++
 http-client-tests/resources/sources/ips.json  |  555 +++
 .../resources/sources/sql-on-fhir.json        |   38 +
 http-client-tests/tests/explicit-queries.http |   60 +-
 http-client-tests/utilities/assertions.js     |    5 +-
 11 files changed, 4255 insertions(+), 12 deletions(-)
 create mode 100644 http-client-tests/resources/explicit-preset-requests/ips-au.json
 create mode 100644 http-client-tests/resources/explicit-preset-requests/ips-nz.json
 create mode 100644 http-client-tests/resources/sources/README.md
 create mode 100644 http-client-tests/resources/sources/ccda.xml
 create mode 100644 http-client-tests/resources/sources/ips-nz.json
 create mode 100644 http-client-tests/resources/sources/ips.json
 create mode 100644 http-client-tests/resources/sources/sql-on-fhir.json

diff --git a/http-client-tests/resources/explicit-preset-requests/cda.json b/http-client-tests/resources/explicit-preset-requests/cda.json
index 496dda2f..ab111684 100644
--- a/http-client-tests/resources/explicit-preset-requests/cda.json
+++ b/http-client-tests/resources/explicit-preset-requests/cda.json
@@ -2,16 +2,15 @@
   "cliContext": {
     "sv": "5.0.0",
     "igs": [
-      "hl7.cda.uv.core#2.0.0-sd-ballot"
+      "hl7.cda.uv.core#2.0.0-sd-snapshot1"
     ],
     "locale": "en"
   },
   "filesToValidate": [
     {
       "fileName": "manually_entered_file.xml",
-      "fileContent": "<ClinicalDocument xmlns=\"urn:hl7-org:v3\" xmlns:sdtc=\"urn:hl7-org:sdtc\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"urn:hl7-org:v3-test CDA.xsd\">\n\t<templateId root=\"2.16.840.1.113883.3.27.1776\"/>\n\t<id extension=\"c266\" root=\"2.16.840.1.113883.19.4\"/>\n  <code code=\"X-34133-9\" displayName=\"SoEN\" sdtc:valueSet=\"2.16.840.1.113883.1.2.3.4.5.6\" codeSystem=\"2.16.840.1.113883.6.1\" codeSystemName=\"LOINC\"/>\n  <title>Episode Note</title>\n\n</ClinicalDocument>",
+      "fileContent": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<?xml-stylesheet type=\"text/xsl\" href=\"CDA.xsl\"?>\n<!--\n Title:        Care Plan\n Filename:     C-CDA_R2_Care_Plan.xml\n Created by:   Lantana Consulting Group, LLC\n \n $LastChangedDate: 2014-11-12 23:25:09 -0500 (Wed, 12 Nov 2014) $\n  \n ********************************************************\n Disclaimer: This sample file contains representative data elements to represent a Care Plan. \n The file depicts a fictional character's health data. Any resemblance to a real person is coincidental. \n To illustrate as many data elements as possible, the clinical scenario may not be plausible. \n The data in this sample file is not intended to represent real patients, people or clinical events. \n This sample is designed to be used in conjunction with the C-CDA Clinical Notes Implementation Guide.\n ********************************************************\n  -->\n<ClinicalDocument xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:hl7-org:v3\" xmlns:voc=\"urn:hl7-org:v3/voc\" xmlns:sdtc=\"urn:hl7-org:sdtc\">\n\t<!-- ** CDA Header ** -->\n\t<realmCode code=\"US\"/>\n\t<typeId root=\"2.16.840.1.113883.1.3\" extension=\"POCD_HD000040\"/>\n  <!-- US Realm Header -->\n  <templateId root=\"2.16.840.1.113883.10.20.22.1.1\" extension=\"2023-05-01\"/>\n  <!-- Care Plan -->\n\t<templateId root=\"2.16.840.1.113883.10.20.22.1.15\" extension=\"2015-08-01\"/>\n\t<id root=\"db734647-fc99-424c-a864-7e3cda82e703\"/>\n\t<code code=\"52521-2\" codeSystem=\"2.16.840.1.113883.6.1\" codeSystemName=\"LOINC\" displayName=\"Overall Plan of Care/Advance Care Directives\"/>\n\t<title>Good Health Hospital Care Plan</title>\n\t<effectiveTime value=\"201308201120-0800\"/>\n\t<confidentialityCode code=\"N\" codeSystem=\"2.16.840.1.113883.5.25\"/>\n\t<languageCode code=\"en-US\"/>\n\t<!-- This document is the second document in the set (see setId for id for the set -->\n\t<setId root=\"004bb033-b948-4f4c-b5bf-a8dbd7d8dd40\"/>\n\t<!-- See relatedDocument for the previous version in the set -->\n\t<versionNumber value=\"2\"/>\n\t<!-- Patient (recordTarget) -->\n\t<recordTarget>\n\t\t<patientRole>\n\t\t\t<id extension=\"444222222\" root=\"2.16.840.1.113883.4.1\"/>\n\t\t\t<!-- Example Social Security Number using the actual SSN OID. -->\n\t\t\t<addr use=\"HP\">\n\t\t\t\t<!-- HP is \"primary home\" from codeSystem 2.16.840.1.113883.5.1119 -->\n\t\t\t\t<streetAddressLine>2222 Home Street</streetAddressLine>\n\t\t\t\t<city>Beaverton</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>97867</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t\t<!-- US is \"United States\" from ISO 3166-1 Country Codes: 1.0.3166.1 -->\n\t\t\t</addr>\n\t\t\t<telecom value=\"tel:+1(555)555-2003\" use=\"HP\"/>\n\t\t\t<!-- HP is \"primary home\" from HL7 AddressUse 2.16.840.1.113883.5.1119 -->\n\t\t\t<patient>\n\t\t\t\t<!-- The first name element represents what the patient is known as -->\n\t\t\t\t<name use=\"L\">\n\t\t\t\t\t<given>Eve</given>\n\t\t\t\t\t<!-- The \"SP\" is \"Spouse\" from HL7 Code System EntityNamePartQualifier 2.16.840.1.113883.5.43 -->\n\t\t\t\t\t<family qualifier=\"SP\">Betterhalf</family>\n\t\t\t\t</name>\n\t\t\t\t<!-- The second name element represents another name associated with the patient -->\n\t\t\t\t<name use=\"SRCH\">\n\t\t\t\t\t<given>Eve</given>\n\t\t\t\t\t<!-- The \"BR\" is \"Birth\" from HL7 Code System EntityNamePartQualifier 2.16.840.1.113883.5.43 -->\n\t\t\t\t\t<family qualifier=\"BR\">Everywoman</family>\n\t\t\t\t</name>\n\t\t\t\t<administrativeGenderCode code=\"F\" displayName=\"Female\" codeSystem=\"2.16.840.1.113883.5.1\" codeSystemName=\"AdministrativeGender\"/>\n\t\t\t\t<!-- Date of birth need only be precise to the day -->\n\t\t\t\t<birthTime value=\"19750501\"/>\n\t\t\t\t<maritalStatusCode code=\"M\" displayName=\"Married\" codeSystem=\"2.16.840.1.113883.5.2\" codeSystemName=\"MaritalStatusCode\"/>\n\t\t\t\t<religiousAffiliationCode code=\"1013\" displayName=\"Christian (non-Catholic, non-specific)\" codeSystem=\"2.16.840.1.113883.5.1076\" codeSystemName=\"HL7 Religious Affiliation\"/>\n\t\t\t\t<!-- CDC Race and Ethnicity code set contains the five minimum race and ethnicity categories defined by OMB Standards -->\n\t\t\t\t<raceCode code=\"2106-3\" displayName=\"White\" codeSystem=\"2.16.840.1.113883.6.238\" codeSystemName=\"Race &amp; Ethnicity - CDC\"/>\n\t\t\t\t<!-- The raceCode extension is only used if raceCode is valued -->\n\t\t\t\t<sdtc:raceCode code=\"2076-8\" displayName=\"Hawaiian or Other Pacific Islander\" codeSystem=\"2.16.840.1.113883.6.238\" codeSystemName=\"Race &amp; Ethnicity - CDC\"/>\n\t\t\t\t<ethnicGroupCode code=\"2186-5\" displayName=\"Not Hispanic or Latino\" codeSystem=\"2.16.840.1.113883.6.238\" codeSystemName=\"Race &amp; Ethnicity - CDC\"/>\n\t\t\t\t<guardian>\n\t\t\t\t\t<code code=\"POWATT\" displayName=\"Power of Attorney\" codeSystem=\"2.16.840.1.113883.1.11.19830\" codeSystemName=\"ResponsibleParty\"/>\n\t\t\t\t\t<addr use=\"HP\">\n\t\t\t\t\t\t<streetAddressLine>2222 Home Street</streetAddressLine>\n\t\t\t\t\t\t<city>Beaverton</city>\n\t\t\t\t\t\t<state>OR</state>\n\t\t\t\t\t\t<postalCode>97867</postalCode>\n\t\t\t\t\t\t<country>US</country>\n\t\t\t\t\t</addr>\n\t\t\t\t\t<telecom value=\"tel:+1(555)555-2008\" use=\"MC\"/>\n\t\t\t\t\t<guardianPerson>\n\t\t\t\t\t\t<name>\n\t\t\t\t\t\t\t<given>Boris</given>\n\t\t\t\t\t\t\t<given qualifier=\"CL\">Bo</given>\n\t\t\t\t\t\t\t<family>Betterhalf</family>\n\t\t\t\t\t\t</name>\n\t\t\t\t\t</guardianPerson>\n\t\t\t\t</guardian>\n\t\t\t\t<birthplace>\n\t\t\t\t\t<place>\n\t\t\t\t\t\t<addr>\n\t\t\t\t\t\t\t<streetAddressLine>4444 Home Street</streetAddressLine>\n\t\t\t\t\t\t\t<city>Beaverton</city>\n\t\t\t\t\t\t\t<state>OR</state>\n\t\t\t\t\t\t\t<postalCode>97867</postalCode>\n\t\t\t\t\t\t\t<country>US</country>\n\t\t\t\t\t\t</addr>\n\t\t\t\t\t</place>\n\t\t\t\t</birthplace>\n\t\t\t\t<languageCommunication>\n\t\t\t\t\t<languageCode code=\"en\"/>\n\t\t\t\t\t<modeCode code=\"ESP\" displayName=\"Expressed spoken\" codeSystem=\"2.16.840.1.113883.5.60\" codeSystemName=\"LanguageAbilityMode\"/>\n\t\t\t\t\t<proficiencyLevelCode code=\"G\" displayName=\"Good\" codeSystem=\"2.16.840.1.113883.5.61\" codeSystemName=\"LanguageAbilityProficiency\"/>\n\t\t\t\t\t<!-- Patient's preferred language -->\n\t\t\t\t\t<preferenceInd value=\"true\"/>\n\t\t\t\t</languageCommunication>\n\t\t\t</patient>\n\t\t\t<providerOrganization>\n\t\t\t\t<id extension=\"219BX\" root=\"2.16.840.1.113883.4.6\"/>\n\t\t\t\t<name>The DoctorsTogether Physician Group</name>\n\t\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)555-5000\"/>\n\t\t\t\t<addr>\n\t\t\t\t\t<streetAddressLine>1007 Health Drive</streetAddressLine>\n\t\t\t\t\t<city>Portland</city>\n\t\t\t\t\t<state>OR</state>\n\t\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t\t<country>US</country>\n\t\t\t\t</addr>\n\t\t\t</providerOrganization>\n\t\t</patientRole>\n\t</recordTarget>\n\t<!-- Author -->\n\t<author>\n\t\t<time value=\"20130730\"/>\n\t\t<assignedAuthor>\n\t\t\t<id root=\"20cf14fb-b65c-4c8c-a54d-b0cca834c18c\"/>\n\t\t\t<code code=\"163W00000X\" codeSystem=\"2.16.840.1.113883.6.101\" codeSystemName=\"Healthcare Provider Taxonomy (HIPAA)\" displayName=\"Registered nurse\"/>\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>1004 Healthcare Drive </streetAddressLine>\n\t\t\t\t<city>Portland</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)555-1004\"/>\n\t\t\t<assignedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<given>Nurse</given>\n\t\t\t\t\t<family>Nightingale</family>\n\t\t\t\t\t<suffix>RN</suffix>\n\t\t\t\t</name>\n\t\t\t</assignedPerson>\n\t\t\t<representedOrganization>\n\t\t\t\t<id root=\"2.16.840.1.113883.19.5\"/>\n\t\t\t\t<name>Good Health Hospital</name>\n\t\t\t</representedOrganization>\n\t\t</assignedAuthor>\n\t</author>\n\t<!-- Data Enterer -->\n\t<dataEnterer>\n\t\t<assignedEntity>\n\t\t\t<id extension=\"333777777\" root=\"2.16.840.1.113883.4.6\"/>\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>1007 Healthcare Drive</streetAddressLine>\n\t\t\t\t<city>Portland</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)-1050\"/>\n\t\t\t<assignedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<given>Ellen</given>\n\t\t\t\t\t<family>Enter</family>\n\t\t\t\t</name>\n\t\t\t</assignedPerson>\n\t\t</assignedEntity>\n\t</dataEnterer>\n\t<!-- Informant -->\n\t<informant>\n\t\t<assignedEntity>\n\t\t\t<id extension=\"888888888\" root=\"2.16.840.1.113883.19.5\"/>\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>1007 Healthcare Drive</streetAddressLine>\n\t\t\t\t<city>Portland</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)-1003\"/>\n\t\t\t<assignedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<given>Harold</given>\n\t\t\t\t\t<family>Hippocrates</family>\n\t\t\t\t\t<suffix qualifier=\"AC\">D.O.</suffix>\n\t\t\t\t</name>\n\t\t\t</assignedPerson>\n\t\t</assignedEntity>\n\t</informant>\n\t<!-- Custodian -->\n\t<custodian>\n\t\t<assignedCustodian>\n\t\t\t<representedCustodianOrganization>\n\t\t\t\t<id extension=\"321CX\" root=\"2.16.840.1.113883.4.6\"/>\n\t\t\t\t<name>Good Health HIE</name>\n\t\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)555-1009\"/>\n\t\t\t\t<addr use=\"WP\">\n\t\t\t\t\t<streetAddressLine>1009 Healthcare Drive </streetAddressLine>\n\t\t\t\t\t<city>Portland</city>\n\t\t\t\t\t<state>OR</state>\n\t\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t\t<country>US</country>\n\t\t\t\t</addr>\n\t\t\t</representedCustodianOrganization>\n\t\t</assignedCustodian>\n\t</custodian>\n\t<informationRecipient>\n\t\t<intendedRecipient>\n\t\t\t<!-- Receiving Person Provider Id -->\n\t\t\t<id root=\"a1cd2b74-c6de-44ee-b552-3adacb7983cc\"/>\n\t\t\t<!-- Receiving Medicare/Medicaid Provider Id-->\n\t\t\t<id root=\"c72f64c2-b1db-444b-bbff-4d2e1d6bd659\"/>\n\t\t\t<!-- Receiving Person ID-->\n\t\t\t<id root=\"fa883fee-b255-4465-8fb5-1d8135e39896\"/>\n\t\t\t<!-- Receiving Person Address-->\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>100 Better Health Rd.</streetAddressLine>\n\t\t\t\t<city>Ann Arbor</city>\n\t\t\t\t<state>MI</state>\n\t\t\t\t<postalCode>97857</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<informationRecipient>\n\t\t\t\t<!-- Receiving Person Name-->\n\t\t\t\t<name>\n\t\t\t\t\t<given>Nurse</given>\n\t\t\t\t\t<family>Caresalot</family>\n\t\t\t\t\t<suffix>RN</suffix>\n\t\t\t\t</name>\n\t\t\t</informationRecipient>\n\t\t\t<receivedOrganization>\n\t\t\t\t<!-- Receiving Organization Id-->\n\t\t\t\t<id root=\"c4c416a7-aeeb-4dcc-9662-ab836ff4d265\"/>\n\t\t\t\t<!-- Receiving Organization Provider ID (NPI) -->\n\t\t\t\t<id root=\"ab47f3c4-1267-4b9e-9a29-e966b5a861c8\"/>\n\t\t\t\t<!-- Receiving Organization Name -->\n\t\t\t\t<name>Better Health Hospital</name>\n\t\t\t\t<!-- Receiving Organization Address -->\n\t\t\t\t<addr>\n\t\t\t\t\t<streetAddressLine>100 Better Health Rd.</streetAddressLine>\n\t\t\t\t\t<city>Ann Arbor</city>\n\t\t\t\t\t<state>MI</state>\n\t\t\t\t\t<postalCode>97857</postalCode>\n\t\t\t\t\t<country>US</country>\n\t\t\t\t</addr>\n\t\t\t\t<!-- Receiving Care Setting Type Description: displayName.  Receiving Care Setting Type Code: code -->\n\t\t\t\t<standardIndustryClassCode displayName=\"Long Term Care Hospital\" code=\"282E00000X\" codeSystem=\"2.16.840.1.114222.4.11.1066\" codeSystemName=\"Healthcare Provider Taxonomy (HIPAA)\"/>\n\t\t\t</receivedOrganization>\n\t\t</intendedRecipient>\n\t</informationRecipient>\n\t<!-- Legal Authenticator -->\n\t<legalAuthenticator>\n\t\t<time value=\"20130730\"/>\n\t\t<signatureCode code=\"S\"/>\n\t\t<sdtc:signatureText mediaType=\"text/xml\" representation=\"B64\">U2lnbmVkIGJ5IE51cnNlIE5pZ2h0aW5nYWxl</sdtc:signatureText>\n\t\t<assignedEntity>\n\t\t\t<id root=\"20cf14fb-b65c-4c8c-a54d-b0cca834c18c\"/>\n\t\t\t<code code=\"163W00000X\" codeSystem=\"2.16.840.1.113883.6.101\" displayName=\"Registered nurse\"/>\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>1004 Healthcare Drive </streetAddressLine>\n\t\t\t\t<city>Portland</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)555-1004\"/>\n\t\t\t<assignedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<given>Nurse</given>\n\t\t\t\t\t<family>Nightingale</family>\n\t\t\t\t\t<suffix>RN</suffix>\n\t\t\t\t</name>\n\t\t\t</assignedPerson>\n\t\t\t<representedOrganization>\n\t\t\t\t<id root=\"2.16.840.1.113883.19.5\"/>\n\t\t\t\t<name>Good Health Hospital</name>\n\t\t\t\t<!-- the orgnaization id and name -->\n\t\t\t</representedOrganization>\n\t\t</assignedEntity>\n\t</legalAuthenticator>\n\t<!-- This authenticator represents patient agreement or sign-off of the Care Plan-->\n\t<authenticator>\n\t\t<time value=\"20130802\"/>\n\t\t<signatureCode code=\"S\"/>\n\t\t<sdtc:signatureText mediaType=\"text/xml\" representation=\"B64\">U2lnbmVkIGJ5IEV2ZSBFdmVyeXdvbWFu</sdtc:signatureText>\n\t\t<assignedEntity>\n\t\t\t<id extension=\"444222222\" root=\"2.16.840.1.113883.4.1\"/>\n\t\t\t<code code=\"ONESELF\" displayName=\"Self\" codeSystem=\"2.16.840.1.113883.5.111\" codeSystemName=\"RoleCode\"/>\n\t\t\t<addr use=\"HP\">\n\t\t\t\t<!-- HP is \"primary home\" from codeSystem 2.16.840.1.113883.5.1119 -->\n\t\t\t\t<streetAddressLine>2222 Home Street</streetAddressLine>\n\t\t\t\t<city>Beaverton</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>97867</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t\t<!-- US is \"United States\" from ISO 3166-1 Country Codes: 1.0.3166.1 -->\n\t\t\t</addr>\n\t\t\t<telecom value=\"tel:+1(555)555-2003\" use=\"HP\"/>\n\t\t\t<assignedPerson>\n\t\t\t\t<name use=\"L\">\n\t\t\t\t\t<given>Eve</given>\n\t\t\t\t\t<family qualifier=\"SP\">Everywoman</family>\n\t\t\t\t</name>\n\t\t\t</assignedPerson>\n\t\t</assignedEntity>\n\t</authenticator>\n\t<!-- This participant represents the person who reviewed the Care Plan. If the date in the time element is in the past, then this review has already taken place. \n         If the date in the time element is in the future, then this is the date of the next scheduled review. -->\n\t<!-- This example shows a Care Plan Review that has already taken place -->\n\t<participant typeCode=\"VRF\">\n\t\t<functionCode code=\"425268008\" codeSystem=\"2.16.840.1.113883.6.96\" codeSystemName=\"SNOMED CT\" displayName=\"Review of Care Plan\"/>\n\t\t<time value=\"20130801\"/>\n\t\t<associatedEntity classCode=\"ASSIGNED\">\n\t\t\t<id root=\"20cf14fb-b65c-4c8c-a54d-b0cca834c18c\"/>\n      <associatedPerson nullFlavor=\"NA\" />\n\t\t</associatedEntity>\n\t</participant>\n\t<!-- This participant represents the person who reviewed the Care Plan.   If the date in the time element is in the past, then this review has already taken place. \n  If the date in the time element is in the future,  then this is the date of the next scheduled review. -->\n\t<!-- This example shows a Scheduled Care Plan Review that is in the future -->\n\t<participant typeCode=\"VRF\">\n\t\t<functionCode code=\"425268008\" codeSystem=\"2.16.840.1.113883.6.96\" codeSystemName=\"SNOMED CT\" displayName=\"Review of Care Plan\"/>\n\t\t<time value=\"20131001\"/>\n\t\t<associatedEntity classCode=\"ASSIGNED\">\n\t\t\t<id root=\"20cf14fb-b65c-4c8c-a54d-b0cca834c18c\"/>\n\t\t\t<code code=\"SELF\" displayName=\"self\" codeSystem=\"2.16.840.1.113883.5.111\"/>\n      <associatedPerson nullFlavor=\"NA\" />\n\t\t</associatedEntity>\n\t</participant>\n\t<!-- This participant identifies individuals who support the patient such as a relative or caregiver -->\n\t<participant typeCode=\"IND\">\n\t\t<!-- Emergency Contact  -->\n\t\t<associatedEntity classCode=\"ECON\">\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>17 Daws Rd.</streetAddressLine>\n\t\t\t\t<city>Ann Arbor</city>\n\t\t\t\t<state>MI</state>\n\t\t\t\t<postalCode>97857</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom value=\"tel:(999)555-1212\" use=\"WP\"/>\n\t\t\t<associatedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<prefix>Mrs.</prefix>\n\t\t\t\t\t<given>Martha</given>\n\t\t\t\t\t<family>Jones</family>\n\t\t\t\t</name>\n\t\t\t</associatedPerson>\n\t\t</associatedEntity>\n\t</participant>\n\t<!-- This participant identifies individuals who support the patient such as a relative or caregiver -->\n\t<participant typeCode=\"IND\">\n\t\t<!-- Caregiver -->\n\t\t<associatedEntity classCode=\"CAREGIVER\">\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>17 Daws Rd.</streetAddressLine>\n\t\t\t\t<city>Ann Arbor</city>\n\t\t\t\t<state>MI</state>\n\t\t\t\t<postalCode>97857</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom value=\"tel:(999)555-1212\" use=\"WP\"/>\n\t\t\t<associatedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<prefix>Mrs.</prefix>\n\t\t\t\t\t<given>Martha</given>\n\t\t\t\t\t<family>Jones</family>\n\t\t\t\t</name>\n\t\t\t</associatedPerson>\n\t\t</associatedEntity>\n\t</participant>\n\t<documentationOf>\n\t\t<serviceEvent classCode=\"PCPR\">\n\t\t\t<effectiveTime>\n\t\t\t\t<low value=\"20130720\"/>\n\t\t\t\t<high value=\"20130815\"/>\n\t\t\t</effectiveTime>\n\t\t\t<!-- The performer(s) represents the healthcare providers involved in the current or historical care of the patient.\n                The patient’s key healthcare providers would be listed here which would include the primary physician and any \n                active consulting physicians, therapists, counselors, and care team members.  -->\n\t\t\t<performer typeCode=\"PRF\">\n\t\t\t\t<time value=\"20130715223615-0800\"/>\n\t\t\t\t<assignedEntity>\n\t\t\t\t\t<id extension=\"5555555555\" root=\"2.16.840.1.113883.4.6\"/>\n\t\t\t\t\t<code code=\"207QA0505X\" displayName=\"Adult Medicine\" codeSystem=\"2.16.840.1.113883.6.101\" codeSystemName=\"Healthcare Provider Taxonomy (HIPAA)\"/>\n\t\t\t\t\t<addr>\n\t\t\t\t\t\t<streetAddressLine>1004 Healthcare Drive </streetAddressLine>\n\t\t\t\t\t\t<city>Portland</city>\n\t\t\t\t\t\t<state>OR</state>\n\t\t\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t\t\t<country>US</country>\n\t\t\t\t\t</addr>\n\t\t\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)-1004\"/>\n\t\t\t\t\t<assignedPerson>\n\t\t\t\t\t\t<name>\n\t\t\t\t\t\t\t<given>Patricia</given>\n\t\t\t\t\t\t\t<given qualifier=\"CL\">Patty</given>\n\t\t\t\t\t\t\t<family>Primary</family>\n\t\t\t\t\t\t\t<suffix qualifier=\"AC\">M.D.</suffix>\n\t\t\t\t\t\t</name>\n\t\t\t\t\t</assignedPerson>\n\t\t\t\t</assignedEntity>\n\t\t\t</performer>\n\t\t</serviceEvent>\n\t</documentationOf>\n\t<!-- The Care Plan is continually evolving and dynamic. The Care Plan CDA instance \n     is NOT dynamic. Each time a Care Plan CDA is generated it represents a snapshot \n     in time of the Care Plan at that moment. Whenever a care provider or patient \n     generates a Care Plan, it should be noted through relatedDocument \n     whether the current Care Plan replaces or appends another Care Plan. \n     The relatedDocumentTypeCode indicates whether the current document is \n     an addendum to the ParentDocument (APND (append)) or the current document \n     is a replacement of the ParentDocument (RPLC (replace)). -->\n\t<!-- This document is the second in a set - relatedDocument\n      describes the parent document-->\n\t<relatedDocument typeCode=\"RPLC\">\n\t\t<parentDocument>\n\t\t\t<id root=\"223769be-f6ee-4b04-a0ce-b56ae998c880\"/>\n\t\t\t<code code=\"CarePlan-x\" codeSystem=\"2.16.840.1.113883.6.1\" codeSystemName=\"LOINC\" displayName=\"Care Plan\"/>\n\t\t\t<setId root=\"004bb033-b948-4f4c-b5bf-a8dbd7d8dd40\"/>\n\t\t\t<versionNumber value=\"1\"/>\n\t\t</parentDocument>\n\t</relatedDocument>\n\t<componentOf>\n\t\t<encompassingEncounter>\n\t\t\t<id extension=\"9937012\" root=\"2.16.840.1.113883.19\"/>\n\t\t\t<code codeSystem=\"2.16.840.1.113883.5.4\" code=\"IMP\" displayName=\"Inpatient\"/>\n\t\t\t<!-- captures that this is an inpatient encounter -->\n\t\t\t<effectiveTime>\n\t\t\t\t<low value=\"20130615\"/>\n\t\t\t\t<!-- No high value - this patient is still in hospital -->\n\t\t\t</effectiveTime>\n\t\t</encompassingEncounter>\n\t</componentOf>\n\t<!-- \n********************************************************\nCDA Body\n********************************************************\n-->\n\t<component>\n    <structuredBody>\n\t\t<!-- ***************** PROBLEM LIST *********************** -->\n\t\t<component>\n\t\t\t<!-- nullFlavor of NI indicates No Information.-->\n\t\t\t<!-- Note this pattern may not validate with schematron but has been SDWG approved -->\n\t\t\t<section nullFlavor=\"NI\">\n\t\t\t\t<!-- conforms to Problems section with entries required -->\n\t\t\t\t<templateId root=\"2.16.840.1.113883.10.20.22.2.5.1\" extension=\"2014-06-09\"/>\n\t\t\t\t<code code=\"11450-4\" codeSystem=\"2.16.840.1.113883.6.1\" codeSystemName=\"LOINC\" displayName=\"PROBLEM LIST\"/>\n\t\t\t\t<title>PROBLEMS</title>\n\t\t\t\t<text>No Information</text>\n\t\t\t</section>\n\t\t</component>\n    </structuredBody>\n\t</component>\n</ClinicalDocument>",
       "fileType": null
     }
-  ],
-  "sessionId": "604864d9-2f82-42e8-885e-6a6b28267487"
+  ]
 }
\ No newline at end of file
diff --git a/http-client-tests/resources/explicit-preset-requests/ips-au.json b/http-client-tests/resources/explicit-preset-requests/ips-au.json
new file mode 100644
index 00000000..31b0f152
--- /dev/null
+++ b/http-client-tests/resources/explicit-preset-requests/ips-au.json
@@ -0,0 +1,29 @@
+{
+  "cliContext": {
+    "extensions": [
+      "any"
+    ],
+    "sv": "4.0.1",
+    "igs": [
+      "hl7.fhir.au.ips#current"
+    ],
+    "profiles": [
+      "http://hl7.org.au/fhir/ips/StructureDefinition/Bundle-au-ips"
+    ],
+    "checkIPSCodes": true,
+    "bundleValidationRules": [
+      {
+        "rule": "Composition:0",
+        "profile": "http://hl7.org.au/fhir/ips/StructureDefinition/Composition-au-ips"
+      }
+    ],
+    "locale": "en"
+  },
+  "filesToValidate": [
+    {
+      "fileName": "manually_entered_file.json",
+      "fileContent": "{\n  \"resourceType\" : \"Bundle\",\n  \"id\" : \"bundle-minimal\",\n  \"language\" : \"en-US\",\n  \"identifier\" : {\n    \"system\" : \"urn:oid:2.16.724.4.8.10.200.10\",\n    \"value\" : \"28b95815-76ce-457b-b7ae-a972e527db40\"\n  },\n  \"type\" : \"document\",\n  \"timestamp\" : \"2020-12-11T14:30:00+01:00\",\n  \"entry\" : [{\n    \"fullUrl\" : \"urn:uuid:6e1fb74a-742b-4c7b-8487-171dacb88766\",\n    \"resource\" : {\n      \"resourceType\" : \"Composition\",\n      \"id\" : \"6e1fb74a-742b-4c7b-8487-171dacb88766\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative</b></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource \\\"6e1fb74a-742b-4c7b-8487-171dacb88766\\\" </p></div><p><b>status</b>: final</p><p><b>type</b>: Patient summary Document <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://loinc.org/\\\">LOINC</a>#60591-5)</span></p><p><b>date</b>: 2020-12-11 02:30:00+0100</p><p><b>author</b>: Beetje van Hulp, MD </p><p><b>title</b>: Patient Summary as of December 11, 2020 14:30</p><p><b>confidentiality</b>: N</p><blockquote><p><b>attester</b></p><p><b>mode</b>: legal</p><p><b>time</b>: 2020-12-11 02:30:00+0100</p><p><b>party</b>: Beetje van Hulp, MD </p></blockquote><blockquote><p><b>attester</b></p><p><b>mode</b>: legal</p><p><b>time</b>: 2020-12-11 02:30:00+0100</p><p><b>party</b>: Anorg Aniza Tion BV </p></blockquote><p><b>custodian</b>: Anorg Aniza Tion BV</p><h3>RelatesTos</h3><table class=\\\"grid\\\"><tr><td>-</td><td><b>Code</b></td><td><b>Target[x]</b></td></tr><tr><td>*</td><td>appends</td><td>id: 20e12ce3-857f-49c0-b888-cb670597f191</td></tr></table><h3>Events</h3><table class=\\\"grid\\\"><tr><td>-</td><td><b>Code</b></td><td><b>Period</b></td></tr><tr><td>*</td><td>care provision <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/CodeSystem/v3-ActClass\\\">ActClass</a>#PCPR)</span></td><td>?? --&gt; 2020-12-11 02:30:00+0100</td></tr></table></div>\"\n      },\n      \"status\" : \"final\",\n      \"type\" : {\n        \"coding\" : [{\n          \"system\" : \"http://loinc.org\",\n          \"code\" : \"60591-5\",\n          \"display\" : \"Patient summary Document\"\n        }]\n      },\n      \"subject\" : {\n        \"reference\" : \"Patient/7685713c-e29e-4a75-8a90-45be7ba3be94\"\n      },\n      \"date\" : \"2020-12-11T14:30:00+01:00\",\n      \"author\" : [{\n        \"reference\" : \"Practitioner/98315ba9-ffea-41ef-b59b-a836c039858f\"\n      }],\n      \"title\" : \"Patient Summary as of December 11, 2020 14:30\",\n      \"confidentiality\" : \"N\",\n      \"attester\" : [{\n        \"mode\" : \"legal\",\n        \"time\" : \"2020-12-11T14:30:00+01:00\",\n        \"party\" : {\n          \"reference\" : \"Practitioner/98315ba9-ffea-41ef-b59b-a836c039858f\"\n        }\n      },\n      {\n        \"mode\" : \"legal\",\n        \"time\" : \"2020-12-11T14:30:00+01:00\",\n        \"party\" : {\n          \"reference\" : \"Organization/bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d\"\n        }\n      }],\n      \"custodian\" : {\n        \"reference\" : \"Organization/bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d\"\n      },\n      \"relatesTo\" : [{\n        \"code\" : \"appends\",\n        \"targetIdentifier\" : {\n          \"system\" : \"urn:oid:2.16.724.4.8.10.200.10\",\n          \"value\" : \"20e12ce3-857f-49c0-b888-cb670597f191\"\n        }\n      }],\n      \"event\" : [{\n        \"code\" : [{\n          \"coding\" : [{\n            \"system\" : \"http://terminology.hl7.org/CodeSystem/v3-ActClass\",\n            \"code\" : \"PCPR\"\n          }]\n        }],\n        \"period\" : {\n          \"end\" : \"2020-12-11T14:30:00+01:00\"\n        }\n      }],\n      \"section\" : [{\n        \"title\" : \"Active Problems\",\n        \"code\" : {\n          \"coding\" : [{\n            \"system\" : \"http://loinc.org\",\n            \"code\" : \"11450-4\",\n            \"display\" : \"Problem list Reported\"\n          }]\n        },\n        \"text\" : {\n          \"status\" : \"generated\",\n          \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><ul><li><div><b>Condition Name</b>: Menopausal Flushing</div><div><b>Code</b>: <span>198436008</span></div><div><b>Status</b>: <span>Active</span></div></li></ul></div>\"\n        },\n        \"entry\" : [{\n          \"reference\" : \"Condition/ad84b7a2-b4dd-474e-bef3-0779e6cb595f\"\n        }]\n      },\n      {\n        \"title\" : \"Medication\",\n        \"code\" : {\n          \"coding\" : [{\n            \"system\" : \"http://loinc.org\",\n            \"code\" : \"10160-0\",\n            \"display\" : \"History of Medication use Narrative\"\n          }]\n        },\n        \"text\" : {\n          \"status\" : \"generated\",\n          \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><ul><li><div><b>Medication Name</b>: Oral anastrozole 1mg tablet</div><div><b>Code</b>: <span></span></div><div><b>Status</b>: <span>Active, started March 2015</span></div><div>Instructions: Take 1 time per day</div></li></ul></div>\"\n        },\n        \"entry\" : [{\n          \"reference\" : \"MedicationStatement/6e883e5e-7648-485a-86de-3640a61601fe\"\n        }]\n      },\n      {\n        \"title\" : \"Allergies and Intolerances\",\n        \"code\" : {\n          \"coding\" : [{\n            \"system\" : \"http://loinc.org\",\n            \"code\" : \"48765-2\",\n            \"display\" : \"Allergies and adverse reactions Document\"\n          }]\n        },\n        \"text\" : {\n          \"status\" : \"generated\",\n          \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><ul><li><div><b>Allergy Name</b>: Pencillins</div><div><b>Verification Status</b>: Confirmed</div><div><b>Reaction</b>: <span>no information</span></div></li></ul></div>\"\n        },\n        \"entry\" : [{\n          \"reference\" : \"AllergyIntolerance/fe2769fd-22c9-4307-9122-ee0466e5aebb\"\n        }]\n      }]\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:7685713c-e29e-4a75-8a90-45be7ba3be94\",\n    \"resource\" : {\n      \"resourceType\" : \"Patient\",\n      \"id\" : \"7685713c-e29e-4a75-8a90-45be7ba3be94\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: Patient</b><a name=\\\"7685713c-e29e-4a75-8a90-45be7ba3be94\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource Patient &quot;7685713c-e29e-4a75-8a90-45be7ba3be94&quot; </p></div><p><b>identifier</b>: id:\\u00a0574687583</p><p><b>active</b>: true</p><p><b>name</b>: Martha DeLarosa </p><p><b>telecom</b>: <a href=\\\"tel:+31788700800\\\">+31788700800</a></p><p><b>gender</b>: female</p><p><b>birthDate</b>: 1972-05-01</p><p><b>address</b>: Laan Van Europa 1600 Dordrecht 3317 DB NL </p><h3>Contacts</h3><table class=\\\"grid\\\"><tr><td style=\\\"display: none\\\">-</td><td><b>Relationship</b></td><td><b>Name</b></td><td><b>Telecom</b></td><td><b>Address</b></td></tr><tr><td style=\\\"display: none\\\">*</td><td>mother <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-v3-RoleCode.html\\\">RoleCode</a>#MTH)</span></td><td>Martha Mum </td><td><a href=\\\"tel:+33-555-20036\\\">+33-555-20036</a></td><td>Promenade des Anglais 111 Lyon 69001 FR </td></tr></table></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:2.16.840.1.113883.2.4.6.3\",\n        \"value\" : \"574687583\"\n      }],\n      \"active\" : true,\n      \"name\" : [{\n        \"family\" : \"DeLarosa\",\n        \"given\" : [\"Martha\"]\n      }],\n      \"telecom\" : [{\n        \"system\" : \"phone\",\n        \"value\" : \"+31788700800\",\n        \"use\" : \"home\"\n      }],\n      \"gender\" : \"female\",\n      \"birthDate\" : \"1972-05-01\",\n      \"address\" : [{\n        \"line\" : [\"Laan Van Europa 1600\"],\n        \"city\" : \"Dordrecht\",\n        \"postalCode\" : \"3317 DB\",\n        \"country\" : \"NL\"\n      }],\n      \"contact\" : [{\n        \"relationship\" : [{\n          \"coding\" : [{\n            \"system\" : \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n            \"code\" : \"MTH\"\n          }]\n        }],\n        \"name\" : {\n          \"family\" : \"Mum\",\n          \"given\" : [\"Martha\"]\n        },\n        \"telecom\" : [{\n          \"system\" : \"phone\",\n          \"value\" : \"+33-555-20036\",\n          \"use\" : \"home\"\n        }],\n        \"address\" : {\n          \"line\" : [\"Promenade des Anglais 111\"],\n          \"city\" : \"Lyon\",\n          \"postalCode\" : \"69001\",\n          \"country\" : \"FR\"\n        }\n      }]\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:98315ba9-ffea-41ef-b59b-a836c039858f\",\n    \"resource\" : {\n      \"resourceType\" : \"Practitioner\",\n      \"id\" : \"98315ba9-ffea-41ef-b59b-a836c039858f\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: Practitioner</b><a name=\\\"98315ba9-ffea-41ef-b59b-a836c039858f\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource Practitioner &quot;98315ba9-ffea-41ef-b59b-a836c039858f&quot; </p></div><p><b>identifier</b>: id:\\u00a0129854633</p><p><b>active</b>: true</p><p><b>name</b>: Beetje van Hulp </p><h3>Qualifications</h3><table class=\\\"grid\\\"><tr><td style=\\\"display: none\\\">-</td><td><b>Code</b></td></tr><tr><td style=\\\"display: none\\\">*</td><td>Doctor of Medicine <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (degreeLicenseCertificate[2.7]#MD)</span></td></tr></table></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:2.16.528.1.1007.3.1\",\n        \"value\" : \"129854633\",\n        \"assigner\" : {\n          \"display\" : \"CIBG\"\n        }\n      }],\n      \"active\" : true,\n      \"name\" : [{\n        \"family\" : \"van Hulp\",\n        \"given\" : [\"Beetje\"]\n      }],\n      \"qualification\" : [{\n        \"code\" : {\n          \"coding\" : [{\n            \"system\" : \"http://terminology.hl7.org/CodeSystem/v2-0360\",\n            \"version\" : \"2.7\",\n            \"code\" : \"MD\",\n            \"display\" : \"Doctor of Medicine\"\n          }]\n        }\n      }]\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d\",\n    \"resource\" : {\n      \"resourceType\" : \"Organization\",\n      \"id\" : \"bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: Organization</b><a name=\\\"bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource Organization &quot;bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d&quot; </p></div><p><b>identifier</b>: id:\\u00a0564738757</p><p><b>active</b>: true</p><p><b>name</b>: Anorg Aniza Tion BV / The best custodian ever</p><p><b>telecom</b>: <a href=\\\"tel:+31-51-34343400\\\">+31-51-34343400</a></p><p><b>address</b>: Houttuinen 27 Dordrecht 3311 CE NL (WORK)</p></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:2.16.528.1.1007.3.3\",\n        \"value\" : \"564738757\"\n      }],\n      \"active\" : true,\n      \"name\" : \"Anorg Aniza Tion BV / The best custodian ever\",\n      \"telecom\" : [{\n        \"system\" : \"phone\",\n        \"value\" : \"+31-51-34343400\",\n        \"use\" : \"work\"\n      }],\n      \"address\" : [{\n        \"use\" : \"work\",\n        \"line\" : [\"Houttuinen 27\"],\n        \"city\" : \"Dordrecht\",\n        \"postalCode\" : \"3311 CE\",\n        \"country\" : \"NL\"\n      }]\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:ad84b7a2-b4dd-474e-bef3-0779e6cb595f\",\n    \"resource\" : {\n      \"resourceType\" : \"Condition\",\n      \"id\" : \"ad84b7a2-b4dd-474e-bef3-0779e6cb595f\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: Condition</b><a name=\\\"ad84b7a2-b4dd-474e-bef3-0779e6cb595f\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource Condition &quot;ad84b7a2-b4dd-474e-bef3-0779e6cb595f&quot; </p></div><p><b>identifier</b>: id:\\u00a0cacceb57-395f-48e1-9c88-e9c9704dc2d2</p><p><b>clinicalStatus</b>: Active <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-condition-clinical.html\\\">Condition Clinical Status Codes</a>#active)</span></p><p><b>verificationStatus</b>: Confirmed <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-condition-ver-status.html\\\">ConditionVerificationStatus</a>#confirmed)</span></p><p><b>category</b>: Problem <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://loinc.org/\\\">LOINC</a>#75326-9)</span></p><p><b>severity</b>: Moderate <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://loinc.org/\\\">LOINC</a>#LA6751-7)</span></p><p><b>code</b>: Menopausal flushing (finding) <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://browser.ihtsdotools.org/\\\">SNOMED CT</a>#198436008; <a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-icd10.html\\\">ICD-10</a>#N95.1 &quot;Menopausal and female climacteric states&quot;)</span></p><p><b>subject</b>: <a href=\\\"#Patient_7685713c-e29e-4a75-8a90-45be7ba3be94\\\">See above (Patient/7685713c-e29e-4a75-8a90-45be7ba3be94)</a></p><p><b>onset</b>: 2015</p><p><b>recordedDate</b>: 2016-10</p></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:1.2.3.999\",\n        \"value\" : \"cacceb57-395f-48e1-9c88-e9c9704dc2d2\"\n      }],\n      \"clinicalStatus\" : {\n        \"coding\" : [{\n          \"system\" : \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n          \"code\" : \"active\"\n        }]\n      },\n      \"verificationStatus\" : {\n        \"coding\" : [{\n          \"system\" : \"http://terminology.hl7.org/CodeSystem/condition-ver-status\",\n          \"code\" : \"confirmed\"\n        }]\n      },\n      \"category\" : [{\n        \"coding\" : [{\n          \"system\" : \"http://loinc.org\",\n          \"code\" : \"75326-9\",\n          \"display\" : \"Problem\"\n        }]\n      }],\n      \"severity\" : {\n        \"coding\" : [{\n          \"system\" : \"http://loinc.org\",\n          \"code\" : \"LA6751-7\",\n          \"display\" : \"Moderate\"\n        }]\n      },\n      \"code\" : {\n        \"coding\" : [{\n          \"system\" : \"http://snomed.info/sct\",\n          \"code\" : \"198436008\",\n          \"display\" : \"Menopausal flushing (finding)\",\n          \"_display\" : {\n            \"extension\" : [{\n              \"extension\" : [{\n                \"url\" : \"lang\",\n                \"valueCode\" : \"nl-NL\"\n              },\n              {\n                \"url\" : \"content\",\n                \"valueString\" : \"opvliegers\"\n              }],\n              \"url\" : \"http://hl7.org/fhir/StructureDefinition/translation\"\n            }]\n          }\n        },\n        {\n          \"system\" : \"http://hl7.org/fhir/sid/icd-10\",\n          \"code\" : \"N95.1\",\n          \"display\" : \"Menopausal and female climacteric states\"\n        }]\n      },\n      \"subject\" : {\n        \"reference\" : \"Patient/7685713c-e29e-4a75-8a90-45be7ba3be94\"\n      },\n      \"onsetDateTime\" : \"2015\",\n      \"recordedDate\" : \"2016-10\"\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:6e883e5e-7648-485a-86de-3640a61601fe\",\n    \"resource\" : {\n      \"resourceType\" : \"MedicationStatement\",\n      \"id\" : \"6e883e5e-7648-485a-86de-3640a61601fe\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: MedicationStatement</b><a name=\\\"6e883e5e-7648-485a-86de-3640a61601fe\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource MedicationStatement &quot;6e883e5e-7648-485a-86de-3640a61601fe&quot; </p></div><p><b>identifier</b>: id:\\u00a08faf0319-89d3-427c-b9d1-e8c8fd390dca</p><p><b>status</b>: active</p><p><b>medication</b>: <a href=\\\"#Medication_6369a973-afc7-4617-8877-3e9811e05a5b\\\">See above (Medication/6369a973-afc7-4617-8877-3e9811e05a5b)</a></p><p><b>subject</b>: <a href=\\\"#Patient_7685713c-e29e-4a75-8a90-45be7ba3be94\\\">See above (Patient/7685713c-e29e-4a75-8a90-45be7ba3be94)</a></p><p><b>effective</b>: 2015-03 --&gt; (ongoing)</p><blockquote><p><b>dosage</b></p><p><b>timing</b>: Count 1 times, Once</p><p><b>route</b>: Oral use <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (standardterms.edqm.eu#20053000)</span></p><blockquote><p><b>doseAndRate</b></p></blockquote></blockquote></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:1.2.3.999\",\n        \"value\" : \"8faf0319-89d3-427c-b9d1-e8c8fd390dca\"\n      }],\n      \"status\" : \"active\",\n      \"medicationReference\" : {\n        \"reference\" : \"Medication/6369a973-afc7-4617-8877-3e9811e05a5b\"\n      },\n      \"subject\" : {\n        \"reference\" : \"Patient/7685713c-e29e-4a75-8a90-45be7ba3be94\"\n      },\n      \"effectivePeriod\" : {\n        \"start\" : \"2015-03\"\n      },\n      \"dosage\" : [{\n        \"timing\" : {\n          \"repeat\" : {\n            \"count\" : 1,\n            \"periodUnit\" : \"d\"\n          }\n        },\n        \"route\" : {\n          \"coding\" : [{\n            \"system\" : \"http://standardterms.edqm.eu\",\n            \"code\" : \"20053000\",\n            \"display\" : \"Oral use\"\n          }]\n        },\n        \"doseAndRate\" : [{\n          \"type\" : {\n            \"coding\" : [{\n              \"system\" : \"http://terminology.hl7.org/CodeSystem/dose-rate-type\",\n              \"code\" : \"ordered\",\n              \"display\" : \"Ordered\"\n            }]\n          },\n          \"doseQuantity\" : {\n            \"value\" : 1,\n            \"unit\" : \"tablet\",\n            \"system\" : \"http://unitsofmeasure.org\",\n            \"code\" : \"1\"\n          }\n        }]\n      }]\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:6369a973-afc7-4617-8877-3e9811e05a5b\",\n    \"resource\" : {\n      \"resourceType\" : \"Medication\",\n      \"id\" : \"6369a973-afc7-4617-8877-3e9811e05a5b\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: Medication</b><a name=\\\"6369a973-afc7-4617-8877-3e9811e05a5b\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource Medication &quot;6369a973-afc7-4617-8877-3e9811e05a5b&quot; </p></div><p><b>code</b>: Product containing anastrozole (medicinal product) <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://browser.ihtsdotools.org/\\\">SNOMED CT</a>#108774000; unknown#99872 &quot;ANASTROZOL 1MG TABLET&quot;; unknown#2076667 &quot;ANASTROZOL CF TABLET FILMOMHULD 1MG&quot;; <a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-v3-WC.html\\\">WHO ATC</a>#L02BG03 &quot;anastrozole&quot;)</span></p></div>\"\n      },\n      \"code\" : {\n        \"coding\" : [{\n          \"system\" : \"http://snomed.info/sct\",\n          \"code\" : \"108774000\",\n          \"display\" : \"Product containing anastrozole (medicinal product)\"\n        },\n        {\n          \"system\" : \"urn:oid:2.16.840.1.113883.2.4.4.1\",\n          \"code\" : \"99872\",\n          \"display\" : \"ANASTROZOL 1MG TABLET\"\n        },\n        {\n          \"system\" : \"urn:oid:2.16.840.1.113883.2.4.4.7\",\n          \"code\" : \"2076667\",\n          \"display\" : \"ANASTROZOL CF TABLET FILMOMHULD 1MG\"\n        },\n        {\n          \"system\" : \"http://www.whocc.no/atc\",\n          \"code\" : \"L02BG03\",\n          \"display\" : \"anastrozole\"\n        }]\n      }\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:fe2769fd-22c9-4307-9122-ee0466e5aebb\",\n    \"resource\" : {\n      \"resourceType\" : \"AllergyIntolerance\",\n      \"id\" : \"fe2769fd-22c9-4307-9122-ee0466e5aebb\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: AllergyIntolerance</b><a name=\\\"fe2769fd-22c9-4307-9122-ee0466e5aebb\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource AllergyIntolerance &quot;fe2769fd-22c9-4307-9122-ee0466e5aebb&quot; </p></div><p><b>identifier</b>: id:\\u00a08d9566a4-d26d-46be-a3e4-c9f3a0e5cd83</p><p><b>clinicalStatus</b>: Active <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-allergyintolerance-clinical.html\\\">AllergyIntolerance Clinical Status Codes</a>#active)</span></p><p><b>verificationStatus</b>: Confirmed <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-allergyintolerance-verification.html\\\">AllergyIntolerance Verification Status</a>#confirmed)</span></p><p><b>type</b>: allergy</p><p><b>category</b>: medication</p><p><b>criticality</b>: high</p><p><b>code</b>: Substance with penicillin structure and antibacterial mechanism of action (substance) <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://browser.ihtsdotools.org/\\\">SNOMED CT</a>#373270004)</span></p><p><b>patient</b>: <a href=\\\"#Patient_7685713c-e29e-4a75-8a90-45be7ba3be94\\\">See above (Patient/7685713c-e29e-4a75-8a90-45be7ba3be94)</a></p><p><b>onset</b>: 2010</p></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:1.2.3.999\",\n        \"value\" : \"8d9566a4-d26d-46be-a3e4-c9f3a0e5cd83\"\n      }],\n      \"clinicalStatus\" : {\n        \"coding\" : [{\n          \"system\" : \"http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical\",\n          \"code\" : \"active\"\n        }]\n      },\n      \"verificationStatus\" : {\n        \"coding\" : [{\n          \"system\" : \"http://terminology.hl7.org/CodeSystem/allergyintolerance-verification\",\n          \"code\" : \"confirmed\"\n        }]\n      },\n      \"type\" : \"allergy\",\n      \"category\" : [\"medication\"],\n      \"criticality\" : \"high\",\n      \"code\" : {\n        \"coding\" : [{\n          \"system\" : \"http://snomed.info/sct\",\n          \"code\" : \"373270004\",\n          \"display\" : \"Substance with penicillin structure and antibacterial mechanism of action (substance)\"\n        }]\n      },\n      \"patient\" : {\n        \"reference\" : \"Patient/7685713c-e29e-4a75-8a90-45be7ba3be94\"\n      },\n      \"onsetDateTime\" : \"2010\"\n    }\n  }]\n}",
+      "fileType": null
+    }
+  ]
+}
\ No newline at end of file
diff --git a/http-client-tests/resources/explicit-preset-requests/ips-nz.json b/http-client-tests/resources/explicit-preset-requests/ips-nz.json
new file mode 100644
index 00000000..12c4420e
--- /dev/null
+++ b/http-client-tests/resources/explicit-preset-requests/ips-nz.json
@@ -0,0 +1,29 @@
+{
+  "cliContext": {
+    "extensions": [
+      "any"
+    ],
+    "sv": "4.0.1",
+    "igs": [
+      "tewhatuora.fhir.nzps#current"
+    ],
+    "profiles": [
+      "https://standards.digital.health.nz/fhir/StructureDefinition/nzps-bundle"
+    ],
+    "checkIPSCodes": true,
+    "bundleValidationRules": [
+      {
+        "rule": "Composition:0",
+        "profile": "https://standards.digital.health.nz/fhir/StructureDefinition/nzps-composition"
+      }
+    ],
+    "locale": "en"
+  },
+  "filesToValidate": [
+    {
+      "fileName": "manually_entered_file.json",
+      "fileContent": "{\n    \"resourceType\": \"Bundle\",\n    \"id\": \"NZ-IPS-20231121031219\",\n    \"language\": \"en-NZ\",\n    \"identifier\": {\n        \"system\": \"urn:oid:2.16.724.4.8.10.200.10\",\n        \"value\": \"3d5006e9-f003-4a78-a253-40ab405b7ef2\"\n    },\n    \"type\": \"document\",\n    \"timestamp\": \"2023-11-21T03:12:19.1242772+00:00\",\n    \"entry\": [\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Composition/9b9e4f64-c976-47e9-a8a5-4b9b0484a709\",\n            \"resource\": {\n                \"resourceType\": \"Composition\",\n                \"id\": \"9b9e4f64-c976-47e9-a8a5-4b9b0484a709\",\n                \"meta\": {\n                    \"versionId\": \"1\"\n                },\n                \"language\": \"en-NZ\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' lang='en-NZ' xml:lang='en-NZ'>International Patient Summary for Iosefa Test-Fuimaono</div>\"\n                },\n                \"identifier\": {\n                    \"system\": \"urn:oid:2.16.840.1.113883.2.18.7.2\",\n                    \"value\": \"3d5006e9-f003-4a78-a253-40ab405b7ef2\"\n                },\n                \"status\": \"final\",\n                \"type\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"60591-5\",\n                            \"display\": \"Patient summary Document\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"date\": \"2023-11-21\",\n                \"author\": [\n                    {\n                        \"reference\": \"Organization/9c9542df-e45f-4131-9d44-8f5974e56d5b\"\n                    }\n                ],\n                \"title\": \"International Patient Summary\",\n                \"confidentiality\": \"N\",\n                \"attester\": [\n                    {\n                        \"mode\": \"professional\",\n                        \"time\": \"2023-11-21\",\n                        \"party\": {\n                            \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                        }\n                    }\n                ],\n                \"custodian\": {\n                    \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                },\n                \"relatesTo\": [\n                    {\n                        \"code\": \"transforms\",\n                        \"targetIdentifier\": {\n                            \"system\": \"urn:oid:2.16.840.1.113883.2.18.7.2\",\n                            \"value\": \"3d5006e9-f003-4a78-a253-40ab405b7ef2\"\n                        }\n                    }\n                ],\n                \"event\": [\n                    {\n                        \"code\": [\n                            {\n                                \"coding\": [\n                                    {\n                                        \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActClass\",\n                                        \"code\": \"PCPR\"\n                                    }\n                                ]\n                            }\n                        ],\n                        \"period\": {\n                            \"end\": \"2023-11-21\"\n                        }\n                    }\n                ],\n                \"section\": [\n                    {\n                        \"title\": \"Allergies and Intolerances\",\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"48765-2\",\n                                    \"display\": \"Allergies and adverse reactions Document\"\n                                }\n                            ]\n                        },\n                        \"text\": {\n                            \"status\": \"generated\",\n                            \"div\": \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\\r\\n  <table>\\r\\n    <thead>\\r\\n      <tr>\\r\\n        <th>Code</th>\\r\\n        <th>Type</th>\\r\\n        <th>Recorded On</th>\\r\\n        <th>Asserted By</th>\\r\\n        <th>Clinical Status</th>\\r\\n        <th>Verification Status</th>\\r\\n      </tr>\\r\\n    </thead>\\r\\n    <tbody>\\r\\n      <tr>\\r\\n        <td>Flucloxacillin-containing product</td>\\r\\n        <td>Allergy</td>\\r\\n        <td />\\r\\n        <td>Patient/ZKT9319</td>\\r\\n        <td>active</td>\\r\\n        <td>confirmed</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>Diazepam-containing product</td>\\r\\n        <td>Allergy</td>\\r\\n        <td />\\r\\n        <td>Patient/ZKT9319</td>\\r\\n        <td>active</td>\\r\\n        <td>confirmed</td>\\r\\n      </tr>\\r\\n    </tbody>\\r\\n  </table>\\r\\n</div>\"\n                        },\n                        \"entry\": [\n                            {\n                                \"reference\": \"AllergyIntolerance/1dfacb6d-4260-4fd4-84e9-a1c13aafa72c\"\n                            },\n                            {\n                                \"reference\": \"AllergyIntolerance/e9b9aeaf-e5ac-4f72-b01d-df4c6107f746\"\n                            }\n                        ]\n                    },\n                    {\n                        \"title\": \"Problem List\",\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"11450-4\",\n                                    \"display\": \"Problem list - Reported\"\n                                }\n                            ]\n                        },\n                        \"text\": {\n                            \"status\": \"generated\",\n                            \"div\": \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\\r\\n  <table>\\r\\n    <thead>\\r\\n      <tr>\\r\\n        <th>Condition</th>\\r\\n        <th>Category</th>\\r\\n        <th>Recorded On</th>\\r\\n        <th>Clinical Status</th>\\r\\n        <th>Verification Status</th>\\r\\n      </tr>\\r\\n    </thead>\\r\\n    <tbody>\\r\\n      <tr>\\r\\n        <td>Postconcussion syndrome</td>\\r\\n        <td>Problem List Item</td>\\r\\n        <td />\\r\\n        <td>active</td>\\r\\n        <td>confirmed</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>Diabetes type 2 on insulin</td>\\r\\n        <td>Problem List Item</td>\\r\\n        <td />\\r\\n        <td>active</td>\\r\\n        <td>confirmed</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>Gout</td>\\r\\n        <td>Problem List Item</td>\\r\\n        <td />\\r\\n        <td>active</td>\\r\\n        <td>confirmed</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>Benign essential hypertension</td>\\r\\n        <td>Problem List Item</td>\\r\\n        <td />\\r\\n        <td>active</td>\\r\\n        <td>confirmed</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>Anxiety disorder due to a general medical condition</td>\\r\\n        <td>Problem List Item</td>\\r\\n        <td />\\r\\n        <td>inactive</td>\\r\\n        <td>confirmed</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>Fracture of neck of femur</td>\\r\\n        <td>Problem List Item</td>\\r\\n        <td />\\r\\n        <td>inactive</td>\\r\\n        <td>confirmed</td>\\r\\n      </tr>\\r\\n    </tbody>\\r\\n  </table>\\r\\n</div>\"\n                        },\n                        \"entry\": [\n                            {\n                                \"reference\": \"Condition/2eafb947-e816-4d9f-978b-c91d0dbe4acc\"\n                            },\n                            {\n                                \"reference\": \"Condition/1923f2ca-043b-432c-9eed-404c81474e60\"\n                            },\n                            {\n                                \"reference\": \"Condition/4f40d5e3-9a5f-4e3f-b799-c3378da8e7dd\"\n                            },\n                            {\n                                \"reference\": \"Condition/08992112-ac66-4c66-a803-89f80bb6d2aa\"\n                            },\n                            {\n                                \"reference\": \"Condition/9b54fc7a-8302-45cc-9ff6-e60c623c5bf9\"\n                            },\n                            {\n                                \"reference\": \"Condition/dd40111a-683f-4d72-bccc-3c6848bc0813\"\n                            }\n                        ]\n                    },\n                    {\n                        \"title\": \"Medication Summary\",\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"10160-0\",\n                                    \"display\": \"History of Medication use Narrative\"\n                                }\n                            ]\n                        },\n                        \"text\": {\n                            \"status\": \"generated\",\n                            \"div\": \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\\r\\n  <table>\\r\\n    <thead>\\r\\n      <tr>\\r\\n        <th>Drug</th>\\r\\n        <th>Status</th>\\r\\n        <th>Effective</th>\\r\\n        <th>Instructions</th>\\r\\n      </tr>\\r\\n    </thead>\\r\\n    <tbody>\\r\\n      <tr>\\r\\n        <td>insulin glargine 100 international units/mL injection, 10 mL vial</td>\\r\\n        <td>Active</td>\\r\\n        <td>2023-02-21</td>\\r\\n        <td>Inject 20 units per day into your upper arms, abdomen or thights.You should vary the site where you inject each dose of Lantus. This helps reduce your risk of certain side effects, such as pits or lumps in your skin.</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>dulaglutide 1.5 mg/0.5 mL injection, prefilled injection device</td>\\r\\n        <td>Active</td>\\r\\n        <td>2023-02-21</td>\\r\\n        <td>Inject once a week, on the same day each week, into the skin of your stomach, thigh or upper arm. You can use the same area of your body each time, but choose a different place within that area. You can inject it any time of the day, with or without meals.</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>metformin hydrochloride 1000 mg tablet</td>\\r\\n        <td>Active</td>\\r\\n        <td>2023-02-21</td>\\r\\n        <td>Take ONE tablet, two times a day, with meals.</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>amlodipine 5 mg tablet</td>\\r\\n        <td>Active</td>\\r\\n        <td>2023-02-21</td>\\r\\n        <td>Take ONE tablet at any time of day, but try to make sure it's around the same time every day.</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>losartan potassium 50 mg tablet</td>\\r\\n        <td>Active</td>\\r\\n        <td>2023-02-21</td>\\r\\n        <td>Take ONE tablet daily</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>aspirin 75 mg tablet: enteric-coated</td>\\r\\n        <td>Active</td>\\r\\n        <td>2023-02-21</td>\\r\\n        <td>Take ONE tablet daily</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>allopurinol 300 mg tablet</td>\\r\\n        <td>Active</td>\\r\\n        <td>2023-02-21</td>\\r\\n        <td>Take ONE tablet daily, after meals</td>\\r\\n      </tr>\\r\\n    </tbody>\\r\\n  </table>\\r\\n</div>\"\n                        },\n                        \"entry\": [\n                            {\n                                \"reference\": \"MedicationStatement/8ecbe74a-a3fa-4edf-8133-44ca8903a645\"\n                            },\n                            {\n                                \"reference\": \"MedicationStatement/06c4eda2-df30-4231-af09-0135e5f84548\"\n                            },\n                            {\n                                \"reference\": \"MedicationStatement/4b5f40b9-f59c-4090-81b1-4609ac6b7af8\"\n                            },\n                            {\n                                \"reference\": \"MedicationStatement/e19dc087-0055-4feb-a847-72e77cf55a0a\"\n                            },\n                            {\n                                \"reference\": \"MedicationStatement/f7a26186-dd57-420f-95be-c0deeee49367\"\n                            },\n                            {\n                                \"reference\": \"MedicationStatement/b6b49f33-a0e4-4b94-92f3-caa3267ad4f7\"\n                            },\n                            {\n                                \"reference\": \"MedicationStatement/ce2395b9-d7ef-4df0-b38f-fc9be0e44f94\"\n                            }\n                        ]\n                    },\n                    {\n                        \"title\": \"Immunizations\",\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"11369-6\",\n                                    \"display\": \"History of Immunization Narrative\"\n                                }\n                            ]\n                        },\n                        \"text\": {\n                            \"status\": \"generated\",\n                            \"div\": \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\\r\\n  <table>\\r\\n    <thead>\\r\\n      <tr>\\r\\n        <th>Vaccine</th>\\r\\n        <th>Status</th>\\r\\n        <th>Occurance</th>\\r\\n        <th>Route</th>\\r\\n        <th>Dose #</th>\\r\\n        <th>Series</th>\\r\\n      </tr>\\r\\n    </thead>\\r\\n    <tbody>\\r\\n      <tr>\\r\\n        <td>SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 30 mcg/0.3mL dose</td>\\r\\n        <td>Completed</td>\\r\\n        <td>2022-02-01</td>\\r\\n        <td>Injection, intramuscular</td>\\r\\n        <td>2</td>\\r\\n        <td>12 (At risk, no previous history)</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 30 mcg/0.3mL dose</td>\\r\\n        <td>Completed</td>\\r\\n        <td>2021-08-05</td>\\r\\n        <td>Injection, intramuscular</td>\\r\\n        <td>1</td>\\r\\n        <td>12 (At risk, no previous history)</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>Influenza, seasonal, injectable</td>\\r\\n        <td>Completed</td>\\r\\n        <td>2019-05-20</td>\\r\\n        <td>Injection, intramuscular</td>\\r\\n        <td>1</td>\\r\\n        <td>1 (Over 65 years (Influenza))</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>diphtheria, tetanus toxoids and acellular pertussis vaccine</td>\\r\\n        <td>Completed</td>\\r\\n        <td>2019-04-24</td>\\r\\n        <td>Injection, intramuscular</td>\\r\\n        <td>1</td>\\r\\n        <td>6 (Booster)</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>tetanus and diphtheria toxoids, not adsorbed, for adult use</td>\\r\\n        <td>Completed</td>\\r\\n        <td>2018-04-05</td>\\r\\n        <td>Injection, intramuscular</td>\\r\\n        <td>1</td>\\r\\n        <td>6 (Booster)</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>pneumococcal conjugate vaccine, 13 valent</td>\\r\\n        <td>Completed</td>\\r\\n        <td>2015-09-25</td>\\r\\n        <td>Injection, intramuscular</td>\\r\\n        <td>1</td>\\r\\n        <td>21 (PCV catch up)</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>Influenza, seasonal, injectable</td>\\r\\n        <td>Completed</td>\\r\\n        <td>2015-05-01</td>\\r\\n        <td>Injection, intramuscular</td>\\r\\n        <td>1</td>\\r\\n        <td>1 (Over 65 years (Influenza))</td>\\r\\n      </tr>\\r\\n    </tbody>\\r\\n  </table>\\r\\n</div>\"\n                        },\n                        \"entry\": [\n                            {\n                                \"reference\": \"Immunization/998e59d9-a7f4-4503-b08e-85ce9b206b0a\"\n                            },\n                            {\n                                \"reference\": \"Immunization/fc6b3454-527b-4deb-a266-7f52c63d0d3c\"\n                            },\n                            {\n                                \"reference\": \"Immunization/33c971d3-0992-4e93-b904-6325ed4602e3\"\n                            },\n                            {\n                                \"reference\": \"Immunization/12c253d4-20e8-4dd4-935c-fd1ec8a49279\"\n                            },\n                            {\n                                \"reference\": \"Immunization/70308bba-2bc4-4505-ba9b-520f9d3dc30b\"\n                            },\n                            {\n                                \"reference\": \"Immunization/acd3a963-0985-4679-a126-8eb9ed981d36\"\n                            },\n                            {\n                                \"reference\": \"Immunization/bae44614-43cc-4df4-94b3-c26d34b0ea37\"\n                            }\n                        ]\n                    },\n                    {\n                        \"title\": \"Procedures\",\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"47519-4\",\n                                    \"display\": \"History of Procedures Document\"\n                                }\n                            ]\n                        },\n                        \"text\": {\n                            \"status\": \"generated\",\n                            \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'><table xmlns=\\\"http://www.w3.org/1999/xhtml\\\">        <thead>          <tr>            <th>Date(s)</th>            <th>Procedure</th>            <th>Location</th>            <th>Performer</th>            <th>Comments</th>                                  </tr>        </thead>        <tbody>          <tr>            <td>01/09/2020 to 01/09/2020</td>            <td>Operative procedure on hip</td>            <td>Waikato Hospital</td>                                                          </tr>          <tr>            <td>31/03/2018 to 31/03/2018</td>            <td>Hand closure</td>            <td>Samoa</td>                                                          </tr>        </tbody>      </table>    </div>\"\n                        },\n                        \"entry\": [\n                            {\n                                \"reference\": \"Procedure/8414198c-a43b-4ef1-b06f-3b39fb4b39cc\"\n                            },\n                            {\n                                \"reference\": \"Procedure/1096ab80-e982-41b3-85c2-8e1d2466d147\"\n                            }\n                        ]\n                    },\n                    {\n                        \"title\": \"Results\",\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"30954-2\",\n                                    \"display\": \"Relevant diagnostic tests/laboratory data Narrative\"\n                                }\n                            ]\n                        },\n                        \"text\": {\n                            \"status\": \"generated\",\n                            \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'><table>        <tbody>          <tr>            <th>Result Group:</th>            <td>Lipids</td>            <th>Result Date:</th>            <td>05 Mar 2023 00:00</td>            <th>Result Status:</th>            <td>completed</td>          </tr>        </tbody>      </table>      <table xmlns=\\\"http://www.w3.org/1999/xhtml\\\">        <thead>          <tr>            <th>Result Name</th>            <th>Value</th>            <th>Reference Range</th>            <th>Abnormal Indicator</th>            <th>Comments</th>                                  </tr>        </thead>        <tbody>          <tr>            <td>Total cholesterol:HDL ratio</td>            <td>5.1 mmol/L</td>            <td>&lt;4 mmol/L (high risk)</td>            <td>H</td>                                              </tr>          <tr>            <td>HDL Cholesterol</td>            <td>1.5 mmol/L</td>            <td>&gt;1 mmol/L</td>            <td>N</td>                                              </tr>          <tr>            <td>LDL Cholesterol</td>            <td>3.4 mmol/L</td>            <td>&lt;1.8 mmol/L</td>            <td>H</td>                                              </tr>        </tbody>      </table>            <table>        <tbody>          <tr>            <th>Result Group:</th>            <td>HbA1C</td>            <th>Result Date:</th>            <td>05 Mar 2023 00:00</td>            <th>Result Status:</th>            <td>completed</td>          </tr>        </tbody>      </table>      <table xmlns=\\\"http://www.w3.org/1999/xhtml\\\">        <thead>          <tr>            <th>Result Name</th>            <th>Value</th>            <th>Reference Range</th>            <th>Abnormal Indicator</th>            <th>Comments</th>                                  </tr>        </thead>        <tbody>          <tr>            <td>HbA1c</td>            <td>60 mmol/mol</td>            <td>50 – 55 mmol/mol (diabetes)</td>            <td>H</td>                                              </tr>        </tbody>      </table>    </div>\"\n                        },\n                        \"entry\": [\n                            {\n                                \"reference\": \"Observation/2f3ad263-1b4e-443b-95ca-66d2abb6e927\"\n                            },\n                            {\n                                \"reference\": \"Observation/fe53810f-a341-4093-a959-4048ad62f85b\"\n                            },\n                            {\n                                \"reference\": \"Observation/6adb76b4-73f3-4552-87a6-09ac3dc1f558\"\n                            },\n                            {\n                                \"reference\": \"DiagnosticReport/9e0d995f-a78d-45f4-b3aa-23037972a3e6\"\n                            },\n                            {\n                                \"reference\": \"Observation/63ad8984-003c-4e44-bc56-31dd6abc0897\"\n                            },\n                            {\n                                \"reference\": \"DiagnosticReport/2da4116e-7158-4d59-b6c4-873b37f7d65f\"\n                            }\n                        ]\n                    },\n                    {\n                        \"title\": \"Vital Signs\",\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"8716-3\",\n                                    \"display\": \"Vital signs\"\n                                }\n                            ]\n                        },\n                        \"text\": {\n                            \"status\": \"generated\",\n                            \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'><table>        <tbody>          <tr>            <th>Result Group:</th>            <td>Vital signs, weight, height, head circumference, oxygen saturation and BMI panel</td>            <th>Result Date:</th>            <td>29 Sep 2023 00:00</td>            <th>Result Status:</th>            <td>completed</td>          </tr>        </tbody>      </table>      <table xmlns=\\\"http://www.w3.org/1999/xhtml\\\">        <thead>          <tr>            <th>Result Name</th>            <th>Value</th>                                  </tr>        </thead>        <tbody>          <tr>            <td>Body temperature</td>            <td>37.5 C</td>                                  </tr>          <tr>            <td>Heart rate</td>            <td>84 beats/minute</td>                                  </tr>          <tr>            <td>Respiratory rate</td>            <td>18 breaths/minute</td>                                  </tr>          <tr>            <td>Systolic blood pressure</td>            <td>136 mm[Hg]</td>                                  </tr>          <tr>            <td>Diastolic blood pressure</td>            <td>88 mm[Hg]</td>                                  </tr>          <tr>            <td>Body height</td>            <td>1.84 cm</td>                                  </tr>          <tr>            <td>Body weight</td>            <td>104 kg</td>                                  </tr>        </tbody>      </table>            <table>        <tbody>          <tr>            <th>Result Group:</th>            <td>Vital signs, weight, height, head circumference, oxygen saturation and BMI panel</td>            <th>Result Date:</th>            <td>05 Mar 2023 00:00</td>            <th>Result Status:</th>            <td>completed</td>          </tr>        </tbody>      </table>      <table xmlns=\\\"http://www.w3.org/1999/xhtml\\\">        <thead>          <tr>            <th>Result Name</th>            <th>Value</th>                                  </tr>        </thead>        <tbody>          <tr>            <td>Body temperature</td>            <td>37.2 C</td>                                  </tr>          <tr>            <td>Heart rate</td>            <td>86 beats/minute</td>                                  </tr>          <tr>            <td>Respiratory rate</td>            <td>14 breaths/minute</td>                                  </tr>          <tr>            <td>Systolic blood pressure</td>            <td>130 mm[Hg]</td>                                  </tr>          <tr>            <td>Diastolic blood pressure</td>            <td>82 mm[Hg]</td>                                  </tr>          <tr>            <td>Body weight</td>            <td>103 kg</td>                                  </tr>        </tbody>      </table>    </div>\"\n                        },\n                        \"entry\": [\n                            {\n                                \"reference\": \"Observation/6f64547c-89a3-459d-a993-b89e995c1f14\"\n                            },\n                            {\n                                \"reference\": \"Observation/da3bbb11-e485-4396-a25c-611354789c65\"\n                            },\n                            {\n                                \"reference\": \"Observation/5dead0bd-80c7-42f7-9720-3aaf047eb89b\"\n                            },\n                            {\n                                \"reference\": \"Observation/126f25f0-d921-4d9a-85a2-5b847cfb89fb\"\n                            },\n                            {\n                                \"reference\": \"Observation/cf628f81-f66b-42a7-a33a-c5d38a604861\"\n                            },\n                            {\n                                \"reference\": \"Observation/dd309bef-3b36-4422-a202-39d040113a5d\"\n                            },\n                            {\n                                \"reference\": \"Observation/4c5e0a16-2e2c-47cc-8e1d-a87afee4d6f1\"\n                            },\n                            {\n                                \"reference\": \"Observation/eda3092b-5228-420b-b0ce-f5eb77e73942\"\n                            },\n                            {\n                                \"reference\": \"Observation/2d420435-f380-46e1-ad93-b9fef57f4b71\"\n                            },\n                            {\n                                \"reference\": \"Observation/7a422837-80f5-4fa6-b3ac-8a0e44b99356\"\n                            },\n                            {\n                                \"reference\": \"Observation/af9ae822-ae5d-4bec-88bf-4dd250350783\"\n                            }\n                        ]\n                    },\n                    {\n                        \"title\": \"Social History\",\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"29762-2\",\n                                    \"display\": \"Social history Narrative\"\n                                }\n                            ]\n                        },\n                        \"text\": {\n                            \"status\": \"generated\",\n                            \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'><table xmlns=\\\"http://www.w3.org/1999/xhtml\\\">        <thead>          <tr>            <th>Type</th>            <th>Item</th>            <th>Date(s)</th>            <th>Comment</th>                                  </tr>        </thead>        <tbody>          <tr>            <td>other</td>            <td>Worked as a forestry worker.</td>                        <td>Worked as a forestry worker. Was always physically active until 2020 fall.Has had subsequent falls. Now depends on a walker or scooter.</td>                                  </tr>          <tr>            <td>smoking</td>            <td>Ex-smoker</td>            <td>30/06/2005</td>            <td>30 - pack - year smoking history, quit smoking ~2005.</td>                                  </tr>        </tbody>      </table>    </div>\"\n                        },\n                        \"entry\": [\n                            {\n                                \"reference\": \"Observation/33624327-7e1b-4912-bca1-2d0c8d36b952\"\n                            }\n                        ]\n                    },\n                    {\n                        \"title\": \"Functional Status\",\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"47420-5\",\n                                    \"display\": \"Functional status assessment note\"\n                                }\n                            ]\n                        },\n                        \"text\": {\n                            \"status\": \"generated\",\n                            \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'><table xmlns=\\\"http://www.w3.org/1999/xhtml\\\">        <thead>          <tr>            <th>Functional Condition</th>            <th>Effective Dates</th>            <th>Condition Status</th>          </tr>        </thead>        <tbody>          <tr>            <td>Often confused, struggles to communicate in English</td>                        <td>Active</td>          </tr>          <tr>            <td>Depends on a walking frame or electric scooter to get around.</td>                        <td>Active</td>          </tr>          <tr>            <td>Doesn’t leave the house much.</td>                        <td>Active</td>          </tr>          <tr>            <td>Relies on caregiver Cindy for assistance with many activities of daily living.</td>                        <td>Active</td>          </tr>          <tr>            <td>Family has made the decision to transfer Iosefa to residential care soon, arrangements currently being finalised.</td>                        <td>Active</td>          </tr>        </tbody>      </table>    </div>\"\n                        },\n                        \"entry\": [\n                            {\n                                \"reference\": \"Condition/4464bdfe-dc87-4179-a10d-2884c975a6eb\"\n                            },\n                            {\n                                \"reference\": \"Condition/f0982a2a-8eb2-4b1a-9e73-6a82d2102003\"\n                            },\n                            {\n                                \"reference\": \"Condition/94c0216a-183b-45e9-9e98-f244ac0b4d4f\"\n                            },\n                            {\n                                \"reference\": \"Condition/14863bd8-1d6d-4c85-9bcc-1b33699908c4\"\n                            },\n                            {\n                                \"reference\": \"Condition/b008f275-c141-4cd5-b1bb-46c399eaf42d\"\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Patient/ZKT9319\",\n            \"resource\": {\n                \"resourceType\": \"Patient\",\n                \"id\": \"ZKT9319\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Name: Iosefa Test-Fuimaono</div>\"\n                },\n                \"identifier\": [\n                    {\n                        \"system\": \"https://standards.digital.health.nz/ns/nhi-id\",\n                        \"value\": \"ZKT9319\"\n                    }\n                ],\n                \"name\": [\n                    {\n                        \"use\": \"usual\",\n                        \"family\": \"Test-Fuimaono\",\n                        \"given\": [\n                            \"Iosefa\"\n                        ]\n                    }\n                ],\n                \"gender\": \"male\",\n                \"birthDate\": \"1950-07-04\",\n                \"address\": [\n                    {\n                        \"use\": \"home\",\n                        \"type\": \"physical\",\n                        \"line\": [\n                            \"Flat 1\",\n                            \"1 Brooklyn Road\",\n                            \"Claudelands\"\n                        ],\n                        \"city\": \"Hamilton\",\n                        \"postalCode\": \"3214\",\n                        \"country\": \"NZ\"\n                    }\n                ],\n                \"maritalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/v3-MaritalStatus\",\n                            \"code\": \"W\",\n                            \"display\": \"Widowed\"\n                        }\n                    ]\n                },\n                \"contact\": [\n                    {\n                        \"relationship\": [\n                            {\n                                \"coding\": [\n                                    {\n                                        \"system\": \"http://terminology.hl7.org/CodeSystem/v2-0131\",\n                                        \"code\": \"N\",\n                                        \"display\": \"Next-of-Kin\"\n                                    }\n                                ]\n                            }\n                        ],\n                        \"name\": {\n                            \"use\": \"usual\",\n                            \"family\": \"Test-Fuimaono\",\n                            \"given\": [\n                                \"Cindy\",\n                                \"Test-Fuimaono\"\n                            ]\n                        },\n                        \"telecom\": [\n                            {\n                                \"system\": \"phone\",\n                                \"value\": \"021 111111\",\n                                \"use\": \"mobile\"\n                            }\n                        ],\n                        \"address\": {\n                            \"use\": \"home\",\n                            \"type\": \"physical\",\n                            \"line\": [\n                                \"Flat 1\",\n                                \"1 Brooklyn Road\",\n                                \"Claudelands\"\n                            ],\n                            \"city\": \"Hamilton\",\n                            \"postalCode\": \"3214\",\n                            \"country\": \"NZ\"\n                        }\n                    },\n                    {\n                        \"relationship\": [\n                            {\n                                \"coding\": [\n                                    {\n                                        \"system\": \"http://terminology.hl7.org/CodeSystem/v2-0131\",\n                                        \"code\": \"C\",\n                                        \"display\": \"Emergency Contact\"\n                                    }\n                                ]\n                            }\n                        ],\n                        \"name\": {\n                            \"use\": \"usual\",\n                            \"family\": \"Test-Fuimaono\",\n                            \"given\": [\n                                \"Cindy\",\n                                \"Test-Fuimaono\"\n                            ]\n                        },\n                        \"telecom\": [\n                            {\n                                \"system\": \"phone\",\n                                \"value\": \"021 111111\",\n                                \"use\": \"mobile\"\n                            }\n                        ],\n                        \"address\": {\n                            \"use\": \"home\",\n                            \"type\": \"physical\",\n                            \"line\": [\n                                \"Flat 1\",\n                                \"1 Brooklyn Road\",\n                                \"Claudelands\"\n                            ],\n                            \"city\": \"Hamilton\",\n                            \"postalCode\": \"3214\",\n                            \"country\": \"NZ\"\n                        }\n                    }\n                ],\n                \"communication\": [\n                    {\n                        \"language\": {\n                            \"text\": \"en-NZ\"\n                        }\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Organization/9c9542df-e45f-4131-9d44-8f5974e56d5b\",\n            \"resource\": {\n                \"resourceType\": \"Organization\",\n                \"id\": \"9c9542df-e45f-4131-9d44-8f5974e56d5b\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Name: Fairfield Medical Centre</div>\"\n                },\n                \"identifier\": [\n                    {\n                        \"system\": \"https://standards.digital.health.nz/ns/hpi-facility-id\",\n                        \"value\": \"F0U044-C\"\n                    }\n                ],\n                \"name\": \"Fairfield Medical Centre\"\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\",\n            \"resource\": {\n                \"resourceType\": \"PractitionerRole\",\n                \"id\": \"c9288aea-5e73-4182-8231-aacbe50d3244\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Role: Doctor</div>\"\n                },\n                \"practitioner\": {\n                    \"reference\": \"Practitioner/4d4b76bf-55b5-40b8-a130-99ea24a84c23\"\n                },\n                \"code\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://snomed.info/sct\",\n                                \"code\": \"158965000\",\n                                \"display\": \"Doctor\"\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Practitioner/4d4b76bf-55b5-40b8-a130-99ea24a84c23\",\n            \"resource\": {\n                \"resourceType\": \"Practitioner\",\n                \"id\": \"4d4b76bf-55b5-40b8-a130-99ea24a84c23\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Name: Dr James Test-Smith</div>\"\n                },\n                \"name\": [\n                    {\n                        \"use\": \"usual\",\n                        \"family\": \"Test-Smith\",\n                        \"given\": [\n                            \"Dr\",\n                            \"James\",\n                            \"Test-Smith\"\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\",\n            \"resource\": {\n                \"resourceType\": \"Organization\",\n                \"id\": \"644f2fb9-c264-4c32-898b-4048dddd6d1b\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Name: Fairfield Medical Centre</div>\"\n                },\n                \"identifier\": [\n                    {\n                        \"system\": \"https://standards.digital.health.nz/ns/hpi-facility-id\",\n                        \"value\": \"F0U044-C\"\n                    }\n                ],\n                \"name\": \"Fairfield Medical Centre\"\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Location/F05076-A\",\n            \"resource\": {\n                \"resourceType\": \"Location\",\n                \"id\": \"F05076-A\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\\r\\n  <h2>Waikato Hospital</h2>\\r\\n  <table>\\r\\n    <tr>\\r\\n      <td>Identifier</td>\\r\\n      <td>F05076-A</td>\\r\\n    </tr>\\r\\n    <tr>\\r\\n      <td>Identifier System</td>\\r\\n      <td>https://standards.digital.health.nz/ns/hpi-facility-id</td>\\r\\n    </tr>\\r\\n    <tr>\\r\\n      <td>Status</td>\\r\\n      <td>Active</td>\\r\\n    </tr>\\r\\n    <tr>\\r\\n      <td>Mode</td>\\r\\n      <td>Instance</td>\\r\\n    </tr>\\r\\n    <tr>\\r\\n      <td>Type</td>\\r\\n      <td>Location</td>\\r\\n    </tr>\\r\\n    <tr>\\r\\n      <td>Address</td>\\r\\n      <td>183 Pembroke Street, Waikato Hospital, Hamilton 3204</td>\\r\\n    </tr>\\r\\n  </table>\\r\\n</div>\"\n                },\n                \"identifier\": [\n                    {\n                        \"system\": \"https://standards.digital.health.nz/ns/hpi-facility-id\",\n                        \"value\": \"F05076-A\"\n                    }\n                ],\n                \"status\": \"active\",\n                \"name\": \"Waikato Hospital\"\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/AllergyIntolerance/1dfacb6d-4260-4fd4-84e9-a1c13aafa72c\",\n            \"resource\": {\n                \"resourceType\": \"AllergyIntolerance\",\n                \"id\": \"1dfacb6d-4260-4fd4-84e9-a1c13aafa72c\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Flucloxacillin-containing product (Penicillin adverse reaction)</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"verificationStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/allergyintolerance-verification\",\n                            \"code\": \"confirmed\"\n                        }\n                    ]\n                },\n                \"type\": \"allergy\",\n                \"category\": [\n                    \"medication\"\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"96067005\",\n                            \"display\": \"Flucloxacillin-containing product\"\n                        }\n                    ]\n                },\n                \"patient\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"asserter\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"reaction\": [\n                    {\n                        \"manifestation\": [\n                            {\n                                \"coding\": [\n                                    {\n                                        \"system\": \"http://snomed.info/sct\",\n                                        \"code\": \"292954005\",\n                                        \"display\": \"Penicillin adverse reaction\"\n                                    }\n                                ]\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/AllergyIntolerance/e9b9aeaf-e5ac-4f72-b01d-df4c6107f746\",\n            \"resource\": {\n                \"resourceType\": \"AllergyIntolerance\",\n                \"id\": \"e9b9aeaf-e5ac-4f72-b01d-df4c6107f746\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Diazepam-containing product (Diazepam adverse reaction)</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"verificationStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/allergyintolerance-verification\",\n                            \"code\": \"confirmed\"\n                        }\n                    ]\n                },\n                \"type\": \"allergy\",\n                \"category\": [\n                    \"medication\"\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"48546005\",\n                            \"display\": \"Diazepam-containing product\"\n                        }\n                    ]\n                },\n                \"patient\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"asserter\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"reaction\": [\n                    {\n                        \"manifestation\": [\n                            {\n                                \"coding\": [\n                                    {\n                                        \"system\": \"http://snomed.info/sct\",\n                                        \"code\": \"292360004\",\n                                        \"display\": \"Diazepam adverse reaction\"\n                                    }\n                                ]\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/2eafb947-e816-4d9f-978b-c91d0dbe4acc\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"2eafb947-e816-4d9f-978b-c91d0dbe4acc\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Postconcussion</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"verificationStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-ver-status\",\n                            \"code\": \"confirmed\"\n                        }\n                    ]\n                },\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/condition-category\",\n                                \"code\": \"problem-list-item\",\n                                \"display\": \"Problem List Item\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"40425004\",\n                            \"display\": \"Postconcussion syndrome\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/1923f2ca-043b-432c-9eed-404c81474e60\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"1923f2ca-043b-432c-9eed-404c81474e60\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Diabetes type 2 on insulin</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"verificationStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-ver-status\",\n                            \"code\": \"confirmed\"\n                        }\n                    ]\n                },\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/condition-category\",\n                                \"code\": \"problem-list-item\",\n                                \"display\": \"Problem List Item\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"237599002\",\n                            \"display\": \"Diabetes type 2 on insulin\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/4f40d5e3-9a5f-4e3f-b799-c3378da8e7dd\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"4f40d5e3-9a5f-4e3f-b799-c3378da8e7dd\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Gout</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"verificationStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-ver-status\",\n                            \"code\": \"confirmed\"\n                        }\n                    ]\n                },\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/condition-category\",\n                                \"code\": \"problem-list-item\",\n                                \"display\": \"Problem List Item\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"90560007\",\n                            \"display\": \"Gout\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/08992112-ac66-4c66-a803-89f80bb6d2aa\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"08992112-ac66-4c66-a803-89f80bb6d2aa\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Benign essential hypertension</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"verificationStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-ver-status\",\n                            \"code\": \"confirmed\"\n                        }\n                    ]\n                },\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/condition-category\",\n                                \"code\": \"problem-list-item\",\n                                \"display\": \"Problem List Item\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"1201005\",\n                            \"display\": \"Benign essential hypertension\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/9b54fc7a-8302-45cc-9ff6-e60c623c5bf9\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"9b54fc7a-8302-45cc-9ff6-e60c623c5bf9\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Anxiety disorder due to a general medical condition</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"inactive\"\n                        }\n                    ]\n                },\n                \"verificationStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-ver-status\",\n                            \"code\": \"confirmed\"\n                        }\n                    ]\n                },\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/condition-category\",\n                                \"code\": \"problem-list-item\",\n                                \"display\": \"Problem List Item\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"52910006\",\n                            \"display\": \"Anxiety disorder due to a general medical condition\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/dd40111a-683f-4d72-bccc-3c6848bc0813\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"dd40111a-683f-4d72-bccc-3c6848bc0813\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Fracture of neck of femur</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"inactive\"\n                        }\n                    ]\n                },\n                \"verificationStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-ver-status\",\n                            \"code\": \"confirmed\"\n                        }\n                    ]\n                },\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/condition-category\",\n                                \"code\": \"problem-list-item\",\n                                \"display\": \"Problem List Item\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"5913000\",\n                            \"display\": \"Fracture of neck of femur\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/4464bdfe-dc87-4179-a10d-2884c975a6eb\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"4464bdfe-dc87-4179-a10d-2884c975a6eb\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Often confused, struggles to communicate in English</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"code\": {\n                    \"text\": \"Often confused, struggles to communicate in English\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/f0982a2a-8eb2-4b1a-9e73-6a82d2102003\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"f0982a2a-8eb2-4b1a-9e73-6a82d2102003\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Depends on a walking frame or electric scooter to get around.</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"code\": {\n                    \"text\": \"Depends on a walking frame or electric scooter to get around.\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/94c0216a-183b-45e9-9e98-f244ac0b4d4f\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"94c0216a-183b-45e9-9e98-f244ac0b4d4f\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Doesn’t leave the house much.</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"code\": {\n                    \"text\": \"Doesn’t leave the house much.\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/14863bd8-1d6d-4c85-9bcc-1b33699908c4\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"14863bd8-1d6d-4c85-9bcc-1b33699908c4\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Relies on caregiver Cindy for assistance with many activities of daily living.</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"code\": {\n                    \"text\": \"Relies on caregiver Cindy for assistance with many activities of daily living.\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/b008f275-c141-4cd5-b1bb-46c399eaf42d\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"b008f275-c141-4cd5-b1bb-46c399eaf42d\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Family has made the decision to transfer Iosefa to residential care soon, arrangements currently being finalised.</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"code\": {\n                    \"text\": \"Family has made the decision to transfer Iosefa to residential care soon, arrangements currently being finalised.\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/MedicationStatement/8ecbe74a-a3fa-4edf-8133-44ca8903a645\",\n            \"resource\": {\n                \"resourceType\": \"MedicationStatement\",\n                \"id\": \"8ecbe74a-a3fa-4edf-8133-44ca8903a645\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>10368421000116106 (insulin glargine 100 international units/mL injection, 10 mL vial)</div>\"\n                },\n                \"status\": \"active\",\n                \"medicationCodeableConcept\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"126212009\",\n                            \"display\": \"Product containing insulin glargine (medicinal product)\"\n                        }\n                    ],\n                    \"text\": \"insulin glargine 100 international units/mL injection, 10 mL vial\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-02-21\",\n                \"informationSource\": {\n                    \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                },\n                \"dosage\": [\n                    {\n                        \"text\": \"Inject 20 units per day into your upper arms, abdomen or thights.You should vary the site where you inject each dose of Lantus. This helps reduce your risk of certain side effects, such as pits or lumps in your skin.\",\n                        \"timing\": {\n                            \"repeat\": {\n                                \"frequency\": 1,\n                                \"period\": 1,\n                                \"periodUnit\": \"d\"\n                            }\n                        },\n                        \"route\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"34206005\",\n                                    \"display\": \"subcutaneous route\"\n                                }\n                            ]\n                        },\n                        \"doseAndRate\": [\n                            {\n                                \"type\": {\n                                    \"coding\": [\n                                        {\n                                            \"system\": \"http://terminology.hl7.org/CodeSystem/dose-rate-type\",\n                                            \"code\": \"ordered\",\n                                            \"display\": \"Ordered\"\n                                        }\n                                    ]\n                                },\n                                \"doseQuantity\": {\n                                    \"value\": 1,\n                                    \"unit\": \"unit\",\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"767525000\"\n                                }\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/MedicationStatement/06c4eda2-df30-4231-af09-0135e5f84548\",\n            \"resource\": {\n                \"resourceType\": \"MedicationStatement\",\n                \"id\": \"06c4eda2-df30-4231-af09-0135e5f84548\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>47230201000116108 (dulaglutide 1.5 mg/0.5 mL injection, prefilled injection device)</div>\"\n                },\n                \"status\": \"active\",\n                \"medicationCodeableConcept\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"714081009\",\n                            \"display\": \"Product containing dulaglutide (medicinal product)\"\n                        }\n                    ],\n                    \"text\": \"dulaglutide 1.5 mg/0.5 mL injection, prefilled injection device\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-02-21\",\n                \"informationSource\": {\n                    \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                },\n                \"dosage\": [\n                    {\n                        \"text\": \"Inject once a week, on the same day each week, into the skin of your stomach, thigh or upper arm. You can use the same area of your body each time, but choose a different place within that area. You can inject it any time of the day, with or without meals.\",\n                        \"route\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"34206005\",\n                                    \"display\": \"subcutaneous route\"\n                                }\n                            ]\n                        },\n                        \"doseAndRate\": [\n                            {\n                                \"type\": {\n                                    \"coding\": [\n                                        {\n                                            \"system\": \"http://terminology.hl7.org/CodeSystem/dose-rate-type\",\n                                            \"code\": \"ordered\",\n                                            \"display\": \"Ordered\"\n                                        }\n                                    ]\n                                }\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/MedicationStatement/4b5f40b9-f59c-4090-81b1-4609ac6b7af8\",\n            \"resource\": {\n                \"resourceType\": \"MedicationStatement\",\n                \"id\": \"4b5f40b9-f59c-4090-81b1-4609ac6b7af8\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>44221701000116102 (metformin hydrochloride 1000 mg tablet)</div>\"\n                },\n                \"status\": \"active\",\n                \"medicationCodeableConcept\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"109081006\",\n                            \"display\": \"Product containing metformin (medicinal product)\"\n                        }\n                    ],\n                    \"text\": \"metformin hydrochloride 1000 mg tablet\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-02-21\",\n                \"informationSource\": {\n                    \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                },\n                \"dosage\": [\n                    {\n                        \"text\": \"Take ONE tablet, two times a day, with meals.\",\n                        \"timing\": {\n                            \"repeat\": {\n                                \"frequency\": 2,\n                                \"period\": 1,\n                                \"periodUnit\": \"d\"\n                            }\n                        },\n                        \"route\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"26643006\",\n                                    \"display\": \"Oral route\"\n                                }\n                            ]\n                        },\n                        \"doseAndRate\": [\n                            {\n                                \"type\": {\n                                    \"coding\": [\n                                        {\n                                            \"system\": \"http://terminology.hl7.org/CodeSystem/dose-rate-type\",\n                                            \"code\": \"ordered\",\n                                            \"display\": \"Ordered\"\n                                        }\n                                    ]\n                                },\n                                \"doseQuantity\": {\n                                    \"value\": 1,\n                                    \"unit\": \"Tablet - unit of product usage\",\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"428673006\"\n                                }\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/MedicationStatement/e19dc087-0055-4feb-a847-72e77cf55a0a\",\n            \"resource\": {\n                \"resourceType\": \"MedicationStatement\",\n                \"id\": \"e19dc087-0055-4feb-a847-72e77cf55a0a\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>10109621000116108 (amlodipine 5 mg tablet)</div>\"\n                },\n                \"status\": \"active\",\n                \"medicationCodeableConcept\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"108537001\",\n                            \"display\": \"Product containing amlodipine (medicinal product)\"\n                        }\n                    ],\n                    \"text\": \"amlodipine 5 mg tablet\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-02-21\",\n                \"informationSource\": {\n                    \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                },\n                \"dosage\": [\n                    {\n                        \"text\": \"Take ONE tablet at any time of day, but try to make sure it's around the same time every day.\",\n                        \"timing\": {\n                            \"repeat\": {\n                                \"frequency\": 1,\n                                \"period\": 1,\n                                \"periodUnit\": \"d\"\n                            }\n                        },\n                        \"route\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"26643006\",\n                                    \"display\": \"Oral route\"\n                                }\n                            ]\n                        },\n                        \"doseAndRate\": [\n                            {\n                                \"type\": {\n                                    \"coding\": [\n                                        {\n                                            \"system\": \"http://terminology.hl7.org/CodeSystem/dose-rate-type\",\n                                            \"code\": \"ordered\",\n                                            \"display\": \"Ordered\"\n                                        }\n                                    ]\n                                },\n                                \"doseQuantity\": {\n                                    \"value\": 1,\n                                    \"unit\": \"Tablet - unit of product usage\",\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"428673006\"\n                                }\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/MedicationStatement/f7a26186-dd57-420f-95be-c0deeee49367\",\n            \"resource\": {\n                \"resourceType\": \"MedicationStatement\",\n                \"id\": \"f7a26186-dd57-420f-95be-c0deeee49367\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>10195211000116102 (losartan potassium 50 mg tablet)</div>\"\n                },\n                \"status\": \"active\",\n                \"medicationCodeableConcept\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"96309000\",\n                            \"display\": \"Product containing losartan (medicinal product)\"\n                        }\n                    ],\n                    \"text\": \"losartan potassium 50 mg tablet\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-02-21\",\n                \"informationSource\": {\n                    \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                },\n                \"dosage\": [\n                    {\n                        \"text\": \"Take ONE tablet daily\",\n                        \"timing\": {\n                            \"repeat\": {\n                                \"frequency\": 1,\n                                \"period\": 1,\n                                \"periodUnit\": \"d\"\n                            }\n                        },\n                        \"route\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"26643006\",\n                                    \"display\": \"Oral route\"\n                                }\n                            ]\n                        },\n                        \"doseAndRate\": [\n                            {\n                                \"type\": {\n                                    \"coding\": [\n                                        {\n                                            \"system\": \"http://terminology.hl7.org/CodeSystem/dose-rate-type\",\n                                            \"code\": \"ordered\",\n                                            \"display\": \"Ordered\"\n                                        }\n                                    ]\n                                },\n                                \"doseQuantity\": {\n                                    \"value\": 1,\n                                    \"unit\": \"Tablet - unit of product usage\",\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"428673006\"\n                                }\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/MedicationStatement/b6b49f33-a0e4-4b94-92f3-caa3267ad4f7\",\n            \"resource\": {\n                \"resourceType\": \"MedicationStatement\",\n                \"id\": \"b6b49f33-a0e4-4b94-92f3-caa3267ad4f7\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>10077081000116106 (aspirin 75 mg tablet: enteric-coated)</div>\"\n                },\n                \"status\": \"active\",\n                \"medicationCodeableConcept\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"7947003\",\n                            \"display\": \"Product containing aspirin (medicinal product)\"\n                        }\n                    ],\n                    \"text\": \"aspirin 75 mg tablet: enteric-coated\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-02-21\",\n                \"informationSource\": {\n                    \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                },\n                \"dosage\": [\n                    {\n                        \"text\": \"Take ONE tablet daily\",\n                        \"timing\": {\n                            \"repeat\": {\n                                \"frequency\": 1,\n                                \"period\": 1,\n                                \"periodUnit\": \"d\"\n                            }\n                        },\n                        \"route\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"26643006\",\n                                    \"display\": \"Oral route\"\n                                }\n                            ]\n                        },\n                        \"doseAndRate\": [\n                            {\n                                \"type\": {\n                                    \"coding\": [\n                                        {\n                                            \"system\": \"http://terminology.hl7.org/CodeSystem/dose-rate-type\",\n                                            \"code\": \"ordered\",\n                                            \"display\": \"Ordered\"\n                                        }\n                                    ]\n                                },\n                                \"doseQuantity\": {\n                                    \"value\": 1,\n                                    \"unit\": \"Tablet - unit of product usage\",\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"428673006\"\n                                }\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/MedicationStatement/ce2395b9-d7ef-4df0-b38f-fc9be0e44f94\",\n            \"resource\": {\n                \"resourceType\": \"MedicationStatement\",\n                \"id\": \"ce2395b9-d7ef-4df0-b38f-fc9be0e44f94\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>10030521000116104 (allopurinol 300 mg tablet)</div>\"\n                },\n                \"status\": \"active\",\n                \"medicationCodeableConcept\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"25246002\",\n                            \"display\": \"Product containing allopurinol (medicinal product)\"\n                        }\n                    ],\n                    \"text\": \"allopurinol 300 mg tablet\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-02-21\",\n                \"informationSource\": {\n                    \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                },\n                \"dosage\": [\n                    {\n                        \"text\": \"Take ONE tablet daily, after meals\",\n                        \"timing\": {\n                            \"repeat\": {\n                                \"frequency\": 1,\n                                \"period\": 1,\n                                \"periodUnit\": \"d\"\n                            }\n                        },\n                        \"route\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"26643006\",\n                                    \"display\": \"Oral route\"\n                                }\n                            ]\n                        },\n                        \"doseAndRate\": [\n                            {\n                                \"type\": {\n                                    \"coding\": [\n                                        {\n                                            \"system\": \"http://terminology.hl7.org/CodeSystem/dose-rate-type\",\n                                            \"code\": \"ordered\",\n                                            \"display\": \"Ordered\"\n                                        }\n                                    ]\n                                },\n                                \"doseQuantity\": {\n                                    \"value\": 1,\n                                    \"unit\": \"Tablet - unit of product usage\",\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"428673006\"\n                                }\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Immunization/998e59d9-a7f4-4503-b08e-85ce9b206b0a\",\n            \"resource\": {\n                \"resourceType\": \"Immunization\",\n                \"id\": \"998e59d9-a7f4-4503-b08e-85ce9b206b0a\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>208 (Pfizer/BioNtech)</div>\"\n                },\n                \"status\": \"completed\",\n                \"vaccineCode\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://hl7.org/fhir/sid/cvx\",\n                            \"code\": \"208\",\n                            \"display\": \"SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 30 mcg/0.3mL dose\"\n                        }\n                    ]\n                },\n                \"patient\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"occurrenceDateTime\": \"2022-02-01\",\n                \"site\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"16217701000119102\",\n                            \"display\": \"Structure of left deltoid muscle\"\n                        }\n                    ]\n                },\n                \"route\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration\",\n                            \"code\": \"IM\",\n                            \"display\": \"Injection, intramuscular\"\n                        }\n                    ]\n                },\n                \"performer\": [\n                    {\n                        \"actor\": {\n                            \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                        }\n                    }\n                ],\n                \"protocolApplied\": [\n                    {\n                        \"series\": \"12 (At risk, no previous history)\",\n                        \"doseNumberPositiveInt\": 2\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Immunization/fc6b3454-527b-4deb-a266-7f52c63d0d3c\",\n            \"resource\": {\n                \"resourceType\": \"Immunization\",\n                \"id\": \"fc6b3454-527b-4deb-a266-7f52c63d0d3c\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>208 (Pfizer/BioNtech)</div>\"\n                },\n                \"status\": \"completed\",\n                \"vaccineCode\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://hl7.org/fhir/sid/cvx\",\n                            \"code\": \"208\",\n                            \"display\": \"SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 30 mcg/0.3mL dose\"\n                        }\n                    ]\n                },\n                \"patient\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"occurrenceDateTime\": \"2021-08-05\",\n                \"site\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"16217701000119102\",\n                            \"display\": \"Structure of left deltoid muscle\"\n                        }\n                    ]\n                },\n                \"route\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration\",\n                            \"code\": \"IM\",\n                            \"display\": \"Injection, intramuscular\"\n                        }\n                    ]\n                },\n                \"performer\": [\n                    {\n                        \"actor\": {\n                            \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                        }\n                    }\n                ],\n                \"protocolApplied\": [\n                    {\n                        \"series\": \"12 (At risk, no previous history)\",\n                        \"doseNumberPositiveInt\": 1\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Immunization/33c971d3-0992-4e93-b904-6325ed4602e3\",\n            \"resource\": {\n                \"resourceType\": \"Immunization\",\n                \"id\": \"33c971d3-0992-4e93-b904-6325ed4602e3\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>99006 (Influenza)</div>\"\n                },\n                \"status\": \"completed\",\n                \"vaccineCode\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://hl7.org/fhir/sid/cvx\",\n                            \"code\": \"141\",\n                            \"display\": \"Influenza, seasonal, injectable\"\n                        }\n                    ]\n                },\n                \"patient\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"occurrenceDateTime\": \"2019-05-20\",\n                \"site\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"16217701000119102\",\n                            \"display\": \"Structure of left deltoid muscle\"\n                        }\n                    ]\n                },\n                \"route\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration\",\n                            \"code\": \"IM\",\n                            \"display\": \"Injection, intramuscular\"\n                        }\n                    ]\n                },\n                \"performer\": [\n                    {\n                        \"actor\": {\n                            \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                        }\n                    }\n                ],\n                \"protocolApplied\": [\n                    {\n                        \"series\": \"1 (Over 65 years (Influenza))\",\n                        \"doseNumberPositiveInt\": 1\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Immunization/12c253d4-20e8-4dd4-935c-fd1ec8a49279\",\n            \"resource\": {\n                \"resourceType\": \"Immunization\",\n                \"id\": \"12c253d4-20e8-4dd4-935c-fd1ec8a49279\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>20 (DTaP)</div>\"\n                },\n                \"status\": \"completed\",\n                \"vaccineCode\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://hl7.org/fhir/sid/cvx\",\n                            \"code\": \"20\",\n                            \"display\": \"diphtheria, tetanus toxoids and acellular pertussis vaccine\"\n                        }\n                    ]\n                },\n                \"patient\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"occurrenceDateTime\": \"2019-04-24\",\n                \"site\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"16217701000119102\",\n                            \"display\": \"Structure of left deltoid muscle\"\n                        }\n                    ]\n                },\n                \"route\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration\",\n                            \"code\": \"IM\",\n                            \"display\": \"Injection, intramuscular\"\n                        }\n                    ]\n                },\n                \"performer\": [\n                    {\n                        \"actor\": {\n                            \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                        }\n                    }\n                ],\n                \"protocolApplied\": [\n                    {\n                        \"series\": \"6 (Booster)\",\n                        \"doseNumberPositiveInt\": 1\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Immunization/70308bba-2bc4-4505-ba9b-520f9d3dc30b\",\n            \"resource\": {\n                \"resourceType\": \"Immunization\",\n                \"id\": \"70308bba-2bc4-4505-ba9b-520f9d3dc30b\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'> [Tetanus booster (given as DT)]</div>\"\n                },\n                \"status\": \"completed\",\n                \"vaccineCode\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://hl7.org/fhir/sid/cvx\",\n                            \"code\": \"138\",\n                            \"display\": \"tetanus and diphtheria toxoids, not adsorbed, for adult use\"\n                        }\n                    ]\n                },\n                \"patient\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"occurrenceDateTime\": \"2018-04-05\",\n                \"site\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"16217701000119102\",\n                            \"display\": \"Structure of left deltoid muscle\"\n                        }\n                    ]\n                },\n                \"route\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration\",\n                            \"code\": \"IM\",\n                            \"display\": \"Injection, intramuscular\"\n                        }\n                    ]\n                },\n                \"performer\": [\n                    {\n                        \"actor\": {\n                            \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                        }\n                    }\n                ],\n                \"protocolApplied\": [\n                    {\n                        \"series\": \"6 (Booster)\",\n                        \"doseNumberPositiveInt\": 1\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Immunization/acd3a963-0985-4679-a126-8eb9ed981d36\",\n            \"resource\": {\n                \"resourceType\": \"Immunization\",\n                \"id\": \"acd3a963-0985-4679-a126-8eb9ed981d36\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>133 (PCV13)</div>\"\n                },\n                \"status\": \"completed\",\n                \"vaccineCode\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://hl7.org/fhir/sid/cvx\",\n                            \"code\": \"133\",\n                            \"display\": \"pneumococcal conjugate vaccine, 13 valent\"\n                        }\n                    ]\n                },\n                \"patient\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"occurrenceDateTime\": \"2015-09-25\",\n                \"site\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"16217701000119102\",\n                            \"display\": \"Structure of left deltoid muscle\"\n                        }\n                    ]\n                },\n                \"route\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration\",\n                            \"code\": \"IM\",\n                            \"display\": \"Injection, intramuscular\"\n                        }\n                    ]\n                },\n                \"performer\": [\n                    {\n                        \"actor\": {\n                            \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                        }\n                    }\n                ],\n                \"protocolApplied\": [\n                    {\n                        \"series\": \"21 (PCV catch up)\",\n                        \"doseNumberPositiveInt\": 1\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Immunization/bae44614-43cc-4df4-94b3-c26d34b0ea37\",\n            \"resource\": {\n                \"resourceType\": \"Immunization\",\n                \"id\": \"bae44614-43cc-4df4-94b3-c26d34b0ea37\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>99006 (Influenza)</div>\"\n                },\n                \"status\": \"completed\",\n                \"vaccineCode\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://hl7.org/fhir/sid/cvx\",\n                            \"code\": \"141\",\n                            \"display\": \"Influenza, seasonal, injectable\"\n                        }\n                    ]\n                },\n                \"patient\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"occurrenceDateTime\": \"2015-05-01\",\n                \"site\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"16217701000119102\",\n                            \"display\": \"Structure of left deltoid muscle\"\n                        }\n                    ]\n                },\n                \"route\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration\",\n                            \"code\": \"IM\",\n                            \"display\": \"Injection, intramuscular\"\n                        }\n                    ]\n                },\n                \"performer\": [\n                    {\n                        \"actor\": {\n                            \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                        }\n                    }\n                ],\n                \"protocolApplied\": [\n                    {\n                        \"series\": \"1 (Over 65 years (Influenza))\",\n                        \"doseNumberPositiveInt\": 1\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Procedure/8414198c-a43b-4ef1-b06f-3b39fb4b39cc\",\n            \"resource\": {\n                \"resourceType\": \"Procedure\",\n                \"id\": \"8414198c-a43b-4ef1-b06f-3b39fb4b39cc\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Operative procedure on hip</div>\"\n                },\n                \"status\": \"unknown\",\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"265132005\",\n                            \"display\": \"Primary open reduction and internal fixation of proximal femoral fracture with screw/nail and plate device\"\n                        }\n                    ],\n                    \"text\": \"Operative procedure on hip\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"performedDateTime\": \"2020-09-01\",\n                \"location\": {\n                    \"reference\": \"Location/F05076-A\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Procedure/1096ab80-e982-41b3-85c2-8e1d2466d147\",\n            \"resource\": {\n                \"resourceType\": \"Procedure\",\n                \"id\": \"1096ab80-e982-41b3-85c2-8e1d2466d147\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Hand closure</div>\"\n                },\n                \"status\": \"unknown\",\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"287903004\",\n                            \"display\": \"Suturing of hand\"\n                        }\n                    ],\n                    \"text\": \"Hand closure\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"performedDateTime\": \"2018-03-31\"\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/DiagnosticReport/9e0d995f-a78d-45f4-b3aa-23037972a3e6\",\n            \"resource\": {\n                \"resourceType\": \"DiagnosticReport\",\n                \"id\": \"9e0d995f-a78d-45f4-b3aa-23037972a3e6\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'> [Lipids]</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/v2-0074\",\n                                \"code\": \"LAB\",\n                                \"display\": \"Laboratory\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"text\": \"[Lipids]\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"result\": [\n                    {\n                        \"reference\": \"Observation/2f3ad263-1b4e-443b-95ca-66d2abb6e927\"\n                    },\n                    {\n                        \"reference\": \"Observation/fe53810f-a341-4093-a959-4048ad62f85b\"\n                    },\n                    {\n                        \"reference\": \"Observation/6adb76b4-73f3-4552-87a6-09ac3dc1f558\"\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/DiagnosticReport/2da4116e-7158-4d59-b6c4-873b37f7d65f\",\n            \"resource\": {\n                \"resourceType\": \"DiagnosticReport\",\n                \"id\": \"2da4116e-7158-4d59-b6c4-873b37f7d65f\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'> [HbA1C]</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/v2-0074\",\n                                \"code\": \"LAB\",\n                                \"display\": \"Laboratory\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"text\": \"[HbA1C]\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"result\": [\n                    {\n                        \"reference\": \"Observation/63ad8984-003c-4e44-bc56-31dd6abc0897\"\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/2f3ad263-1b4e-443b-95ca-66d2abb6e927\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"2f3ad263-1b4e-443b-95ca-66d2abb6e927\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'> [Total cholesterol:HDL ratio]</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"laboratory\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"text\": \"[Total cholesterol:HDL ratio]\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/8363e64e-f639-4f55-bd3c-6302bf87a6d3\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 5.1,\n                    \"unit\": \"mmol/L\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"mmol/L\"\n                },\n                \"interpretation\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n                                \"code\": \"H\",\n                                \"display\": \"High\"\n                            }\n                        ]\n                    }\n                ],\n                \"referenceRange\": [\n                    {\n                        \"text\": \"<4 mmol/L (high risk)\"\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/fe53810f-a341-4093-a959-4048ad62f85b\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"fe53810f-a341-4093-a959-4048ad62f85b\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'> [HDL Cholesterol]</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"laboratory\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"text\": \"[HDL Cholesterol]\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/8363e64e-f639-4f55-bd3c-6302bf87a6d3\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 1.5,\n                    \"unit\": \"mmol/L\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"mmol/L\"\n                },\n                \"interpretation\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n                                \"code\": \"N\",\n                                \"display\": \"Normal\"\n                            }\n                        ]\n                    }\n                ],\n                \"referenceRange\": [\n                    {\n                        \"text\": \">1 mmol/L\"\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/6adb76b4-73f3-4552-87a6-09ac3dc1f558\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"6adb76b4-73f3-4552-87a6-09ac3dc1f558\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'> [LDL Cholesterol]</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"laboratory\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"text\": \"[LDL Cholesterol]\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/8363e64e-f639-4f55-bd3c-6302bf87a6d3\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 3.4,\n                    \"unit\": \"mmol/L\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"mmol/L\"\n                },\n                \"interpretation\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n                                \"code\": \"H\",\n                                \"display\": \"High\"\n                            }\n                        ]\n                    }\n                ],\n                \"referenceRange\": [\n                    {\n                        \"text\": \"<1.8 mmol/L\"\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/63ad8984-003c-4e44-bc56-31dd6abc0897\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"63ad8984-003c-4e44-bc56-31dd6abc0897\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'> [HbA1c]</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"laboratory\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"text\": \"[HbA1c]\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/8363e64e-f639-4f55-bd3c-6302bf87a6d3\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 60,\n                    \"unit\": \"mmol/mol\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"mmol/mol\"\n                },\n                \"interpretation\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n                                \"code\": \"H\",\n                                \"display\": \"High\"\n                            }\n                        ]\n                    }\n                ],\n                \"referenceRange\": [\n                    {\n                        \"text\": \"50 – 55 mmol/mol (diabetes)\"\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/6f64547c-89a3-459d-a993-b89e995c1f14\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"6f64547c-89a3-459d-a993-b89e995c1f14\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Body temperature</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"8310-5\",\n                            \"display\": \"Body temperature\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-09-29T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 37.5,\n                    \"unit\": \"Cel\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"Cel\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/da3bbb11-e485-4396-a25c-611354789c65\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"da3bbb11-e485-4396-a25c-611354789c65\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Heart rate</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"8867-4\",\n                            \"display\": \"Heart rate\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-09-29T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 84,\n                    \"unit\": \"/min\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"/min\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/5dead0bd-80c7-42f7-9720-3aaf047eb89b\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"5dead0bd-80c7-42f7-9720-3aaf047eb89b\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Respiratory rate</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"9279-1\",\n                            \"display\": \"Respiratory rate\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-09-29T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 18,\n                    \"unit\": \"/min\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"/min\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/126f25f0-d921-4d9a-85a2-5b847cfb89fb\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"126f25f0-d921-4d9a-85a2-5b847cfb89fb\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Blood pressure panel with all children optional</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"85354-9\",\n                            \"display\": \"Blood pressure panel with all children optional\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-09-29T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"component\": [\n                    {\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"8480-6\",\n                                    \"display\": \"Systolic blood pressure\"\n                                }\n                            ]\n                        },\n                        \"valueQuantity\": {\n                            \"value\": 136,\n                            \"unit\": \"mmHg\",\n                            \"system\": \"http://unitsofmeasure.org\",\n                            \"code\": \"mm[Hg]\"\n                        }\n                    },\n                    {\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"8462-4\",\n                                    \"display\": \"Diastolic blood pressure\"\n                                }\n                            ]\n                        },\n                        \"valueQuantity\": {\n                            \"value\": 88,\n                            \"unit\": \"mmHg\",\n                            \"system\": \"http://unitsofmeasure.org\",\n                            \"code\": \"mm[Hg]\"\n                        }\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/cf628f81-f66b-42a7-a33a-c5d38a604861\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"cf628f81-f66b-42a7-a33a-c5d38a604861\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Body height</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"8302-2\",\n                            \"display\": \"Body height\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-09-29T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 1.84,\n                    \"unit\": \"cm\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"cm\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/dd309bef-3b36-4422-a202-39d040113a5d\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"dd309bef-3b36-4422-a202-39d040113a5d\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Body weight</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"29463-7\",\n                            \"display\": \"Body weight\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-09-29T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 104,\n                    \"unit\": \"kg\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"kg\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/4c5e0a16-2e2c-47cc-8e1d-a87afee4d6f1\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"4c5e0a16-2e2c-47cc-8e1d-a87afee4d6f1\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Body temperature</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"8310-5\",\n                            \"display\": \"Body temperature\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 37.2,\n                    \"unit\": \"Cel\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"Cel\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/eda3092b-5228-420b-b0ce-f5eb77e73942\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"eda3092b-5228-420b-b0ce-f5eb77e73942\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Heart rate</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"8867-4\",\n                            \"display\": \"Heart rate\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 86,\n                    \"unit\": \"/min\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"/min\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/2d420435-f380-46e1-ad93-b9fef57f4b71\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"2d420435-f380-46e1-ad93-b9fef57f4b71\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Respiratory rate</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"9279-1\",\n                            \"display\": \"Respiratory rate\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 14,\n                    \"unit\": \"/min\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"/min\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/7a422837-80f5-4fa6-b3ac-8a0e44b99356\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"7a422837-80f5-4fa6-b3ac-8a0e44b99356\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Blood pressure panel with all children optional</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"85354-9\",\n                            \"display\": \"Blood pressure panel with all children optional\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"component\": [\n                    {\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"8480-6\",\n                                    \"display\": \"Systolic blood pressure\"\n                                }\n                            ]\n                        },\n                        \"valueQuantity\": {\n                            \"value\": 130,\n                            \"unit\": \"mmHg\",\n                            \"system\": \"http://unitsofmeasure.org\",\n                            \"code\": \"mm[Hg]\"\n                        }\n                    },\n                    {\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"8462-4\",\n                                    \"display\": \"Diastolic blood pressure\"\n                                }\n                            ]\n                        },\n                        \"valueQuantity\": {\n                            \"value\": 82,\n                            \"unit\": \"mmHg\",\n                            \"system\": \"http://unitsofmeasure.org\",\n                            \"code\": \"mm[Hg]\"\n                        }\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/af9ae822-ae5d-4bec-88bf-4dd250350783\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"af9ae822-ae5d-4bec-88bf-4dd250350783\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Body weight</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"29463-7\",\n                            \"display\": \"Body weight\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 103,\n                    \"unit\": \"kg\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"kg\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/33624327-7e1b-4912-bca1-2d0c8d36b952\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"33624327-7e1b-4912-bca1-2d0c8d36b952\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Tobacco smoking status</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"social-history\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"72166-2\",\n                            \"display\": \"Tobacco smoking status\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2005-06-30\",\n                \"performer\": [\n                    {\n                        \"reference\": \"Patient/ZKT9319\"\n                    }\n                ],\n                \"valueCodeableConcept\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"LA15920-4\",\n                            \"display\": \"Former smoker\"\n                        }\n                    ]\n                },\n                \"note\": [\n                    {\n                        \"text\": \"30 - pack - year smoking history, quit smoking ~2005.\"\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/PractitionerRole/8363e64e-f639-4f55-bd3c-6302bf87a6d3\",\n            \"resource\": {\n                \"resourceType\": \"PractitionerRole\",\n                \"id\": \"8363e64e-f639-4f55-bd3c-6302bf87a6d3\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Role: Clinical pathologist</div>\"\n                },\n                \"code\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://snomed.info/sct\",\n                                \"code\": \"81464008\",\n                                \"display\": \"Clinical pathologist\"\n                            }\n                        ]\n                    }\n                ]\n            }\n        }\n    ]\n}",
+      "fileType": null
+    }
+  ]
+}
\ No newline at end of file
diff --git a/http-client-tests/resources/explicit-preset-requests/us-ccda.json b/http-client-tests/resources/explicit-preset-requests/us-ccda.json
index 3e794f12..e5d0832f 100644
--- a/http-client-tests/resources/explicit-preset-requests/us-ccda.json
+++ b/http-client-tests/resources/explicit-preset-requests/us-ccda.json
@@ -2,14 +2,14 @@
   "cliContext": {
     "sv": "5.0.0",
     "igs": [
-      "hl7.cda.us.ccda#current"
+      "hl7.cda.us.ccda#3.0.0-ballot"
     ],
     "locale": "en"
   },
   "filesToValidate": [
     {
       "fileName": "manually_entered_file.xml",
-      "fileContent": "<ClinicalDocument xmlns=\"urn:hl7-org:v3\" xmlns:sdtc=\"urn:hl7-org:sdtc\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"urn:hl7-org:v3-test CDA.xsd\">\n\t<templateId root=\"2.16.840.1.113883.3.27.1776\"/>\n\t<id extension=\"c266\" root=\"2.16.840.1.113883.19.4\"/>\n  <code code=\"X-34133-9\" displayName=\"SoEN\" sdtc:valueSet=\"2.16.840.1.113883.1.2.3.4.5.6\" codeSystem=\"2.16.840.1.113883.6.1\" codeSystemName=\"LOINC\"/>\n  <title>Episode Note</title>\n\n</ClinicalDocument>",
+      "fileContent": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<?xml-stylesheet type=\"text/xsl\" href=\"CDA.xsl\"?>\n<!--\n Title:        Care Plan\n Filename:     C-CDA_R2_Care_Plan.xml\n Created by:   Lantana Consulting Group, LLC\n \n $LastChangedDate: 2014-11-12 23:25:09 -0500 (Wed, 12 Nov 2014) $\n  \n ********************************************************\n Disclaimer: This sample file contains representative data elements to represent a Care Plan. \n The file depicts a fictional character's health data. Any resemblance to a real person is coincidental. \n To illustrate as many data elements as possible, the clinical scenario may not be plausible. \n The data in this sample file is not intended to represent real patients, people or clinical events. \n This sample is designed to be used in conjunction with the C-CDA Clinical Notes Implementation Guide.\n ********************************************************\n  -->\n<ClinicalDocument xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:hl7-org:v3\" xmlns:voc=\"urn:hl7-org:v3/voc\" xmlns:sdtc=\"urn:hl7-org:sdtc\">\n\t<!-- ** CDA Header ** -->\n\t<realmCode code=\"US\"/>\n\t<typeId root=\"2.16.840.1.113883.1.3\" extension=\"POCD_HD000040\"/>\n  <!-- US Realm Header -->\n  <templateId root=\"2.16.840.1.113883.10.20.22.1.1\" extension=\"2023-05-01\"/>\n  <!-- Care Plan -->\n\t<templateId root=\"2.16.840.1.113883.10.20.22.1.15\" extension=\"2015-08-01\"/>\n\t<id root=\"db734647-fc99-424c-a864-7e3cda82e703\"/>\n\t<code code=\"52521-2\" codeSystem=\"2.16.840.1.113883.6.1\" codeSystemName=\"LOINC\" displayName=\"Overall Plan of Care/Advance Care Directives\"/>\n\t<title>Good Health Hospital Care Plan</title>\n\t<effectiveTime value=\"201308201120-0800\"/>\n\t<confidentialityCode code=\"N\" codeSystem=\"2.16.840.1.113883.5.25\"/>\n\t<languageCode code=\"en-US\"/>\n\t<!-- This document is the second document in the set (see setId for id for the set -->\n\t<setId root=\"004bb033-b948-4f4c-b5bf-a8dbd7d8dd40\"/>\n\t<!-- See relatedDocument for the previous version in the set -->\n\t<versionNumber value=\"2\"/>\n\t<!-- Patient (recordTarget) -->\n\t<recordTarget>\n\t\t<patientRole>\n\t\t\t<id extension=\"444222222\" root=\"2.16.840.1.113883.4.1\"/>\n\t\t\t<!-- Example Social Security Number using the actual SSN OID. -->\n\t\t\t<addr use=\"HP\">\n\t\t\t\t<!-- HP is \"primary home\" from codeSystem 2.16.840.1.113883.5.1119 -->\n\t\t\t\t<streetAddressLine>2222 Home Street</streetAddressLine>\n\t\t\t\t<city>Beaverton</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>97867</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t\t<!-- US is \"United States\" from ISO 3166-1 Country Codes: 1.0.3166.1 -->\n\t\t\t</addr>\n\t\t\t<telecom value=\"tel:+1(555)555-2003\" use=\"HP\"/>\n\t\t\t<!-- HP is \"primary home\" from HL7 AddressUse 2.16.840.1.113883.5.1119 -->\n\t\t\t<patient>\n\t\t\t\t<!-- The first name element represents what the patient is known as -->\n\t\t\t\t<name use=\"L\">\n\t\t\t\t\t<given>Eve</given>\n\t\t\t\t\t<!-- The \"SP\" is \"Spouse\" from HL7 Code System EntityNamePartQualifier 2.16.840.1.113883.5.43 -->\n\t\t\t\t\t<family qualifier=\"SP\">Betterhalf</family>\n\t\t\t\t</name>\n\t\t\t\t<!-- The second name element represents another name associated with the patient -->\n\t\t\t\t<name use=\"SRCH\">\n\t\t\t\t\t<given>Eve</given>\n\t\t\t\t\t<!-- The \"BR\" is \"Birth\" from HL7 Code System EntityNamePartQualifier 2.16.840.1.113883.5.43 -->\n\t\t\t\t\t<family qualifier=\"BR\">Everywoman</family>\n\t\t\t\t</name>\n\t\t\t\t<administrativeGenderCode code=\"F\" displayName=\"Female\" codeSystem=\"2.16.840.1.113883.5.1\" codeSystemName=\"AdministrativeGender\"/>\n\t\t\t\t<!-- Date of birth need only be precise to the day -->\n\t\t\t\t<birthTime value=\"19750501\"/>\n\t\t\t\t<maritalStatusCode code=\"M\" displayName=\"Married\" codeSystem=\"2.16.840.1.113883.5.2\" codeSystemName=\"MaritalStatusCode\"/>\n\t\t\t\t<religiousAffiliationCode code=\"1013\" displayName=\"Christian (non-Catholic, non-specific)\" codeSystem=\"2.16.840.1.113883.5.1076\" codeSystemName=\"HL7 Religious Affiliation\"/>\n\t\t\t\t<!-- CDC Race and Ethnicity code set contains the five minimum race and ethnicity categories defined by OMB Standards -->\n\t\t\t\t<raceCode code=\"2106-3\" displayName=\"White\" codeSystem=\"2.16.840.1.113883.6.238\" codeSystemName=\"Race &amp; Ethnicity - CDC\"/>\n\t\t\t\t<!-- The raceCode extension is only used if raceCode is valued -->\n\t\t\t\t<sdtc:raceCode code=\"2076-8\" displayName=\"Hawaiian or Other Pacific Islander\" codeSystem=\"2.16.840.1.113883.6.238\" codeSystemName=\"Race &amp; Ethnicity - CDC\"/>\n\t\t\t\t<ethnicGroupCode code=\"2186-5\" displayName=\"Not Hispanic or Latino\" codeSystem=\"2.16.840.1.113883.6.238\" codeSystemName=\"Race &amp; Ethnicity - CDC\"/>\n\t\t\t\t<guardian>\n\t\t\t\t\t<code code=\"POWATT\" displayName=\"Power of Attorney\" codeSystem=\"2.16.840.1.113883.1.11.19830\" codeSystemName=\"ResponsibleParty\"/>\n\t\t\t\t\t<addr use=\"HP\">\n\t\t\t\t\t\t<streetAddressLine>2222 Home Street</streetAddressLine>\n\t\t\t\t\t\t<city>Beaverton</city>\n\t\t\t\t\t\t<state>OR</state>\n\t\t\t\t\t\t<postalCode>97867</postalCode>\n\t\t\t\t\t\t<country>US</country>\n\t\t\t\t\t</addr>\n\t\t\t\t\t<telecom value=\"tel:+1(555)555-2008\" use=\"MC\"/>\n\t\t\t\t\t<guardianPerson>\n\t\t\t\t\t\t<name>\n\t\t\t\t\t\t\t<given>Boris</given>\n\t\t\t\t\t\t\t<given qualifier=\"CL\">Bo</given>\n\t\t\t\t\t\t\t<family>Betterhalf</family>\n\t\t\t\t\t\t</name>\n\t\t\t\t\t</guardianPerson>\n\t\t\t\t</guardian>\n\t\t\t\t<birthplace>\n\t\t\t\t\t<place>\n\t\t\t\t\t\t<addr>\n\t\t\t\t\t\t\t<streetAddressLine>4444 Home Street</streetAddressLine>\n\t\t\t\t\t\t\t<city>Beaverton</city>\n\t\t\t\t\t\t\t<state>OR</state>\n\t\t\t\t\t\t\t<postalCode>97867</postalCode>\n\t\t\t\t\t\t\t<country>US</country>\n\t\t\t\t\t\t</addr>\n\t\t\t\t\t</place>\n\t\t\t\t</birthplace>\n\t\t\t\t<languageCommunication>\n\t\t\t\t\t<languageCode code=\"en\"/>\n\t\t\t\t\t<modeCode code=\"ESP\" displayName=\"Expressed spoken\" codeSystem=\"2.16.840.1.113883.5.60\" codeSystemName=\"LanguageAbilityMode\"/>\n\t\t\t\t\t<proficiencyLevelCode code=\"G\" displayName=\"Good\" codeSystem=\"2.16.840.1.113883.5.61\" codeSystemName=\"LanguageAbilityProficiency\"/>\n\t\t\t\t\t<!-- Patient's preferred language -->\n\t\t\t\t\t<preferenceInd value=\"true\"/>\n\t\t\t\t</languageCommunication>\n\t\t\t</patient>\n\t\t\t<providerOrganization>\n\t\t\t\t<id extension=\"219BX\" root=\"2.16.840.1.113883.4.6\"/>\n\t\t\t\t<name>The DoctorsTogether Physician Group</name>\n\t\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)555-5000\"/>\n\t\t\t\t<addr>\n\t\t\t\t\t<streetAddressLine>1007 Health Drive</streetAddressLine>\n\t\t\t\t\t<city>Portland</city>\n\t\t\t\t\t<state>OR</state>\n\t\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t\t<country>US</country>\n\t\t\t\t</addr>\n\t\t\t</providerOrganization>\n\t\t</patientRole>\n\t</recordTarget>\n\t<!-- Author -->\n\t<author>\n\t\t<time value=\"20130730\"/>\n\t\t<assignedAuthor>\n\t\t\t<id root=\"20cf14fb-b65c-4c8c-a54d-b0cca834c18c\"/>\n\t\t\t<code code=\"163W00000X\" codeSystem=\"2.16.840.1.113883.6.101\" codeSystemName=\"Healthcare Provider Taxonomy (HIPAA)\" displayName=\"Registered nurse\"/>\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>1004 Healthcare Drive </streetAddressLine>\n\t\t\t\t<city>Portland</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)555-1004\"/>\n\t\t\t<assignedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<given>Nurse</given>\n\t\t\t\t\t<family>Nightingale</family>\n\t\t\t\t\t<suffix>RN</suffix>\n\t\t\t\t</name>\n\t\t\t</assignedPerson>\n\t\t\t<representedOrganization>\n\t\t\t\t<id root=\"2.16.840.1.113883.19.5\"/>\n\t\t\t\t<name>Good Health Hospital</name>\n\t\t\t</representedOrganization>\n\t\t</assignedAuthor>\n\t</author>\n\t<!-- Data Enterer -->\n\t<dataEnterer>\n\t\t<assignedEntity>\n\t\t\t<id extension=\"333777777\" root=\"2.16.840.1.113883.4.6\"/>\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>1007 Healthcare Drive</streetAddressLine>\n\t\t\t\t<city>Portland</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)-1050\"/>\n\t\t\t<assignedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<given>Ellen</given>\n\t\t\t\t\t<family>Enter</family>\n\t\t\t\t</name>\n\t\t\t</assignedPerson>\n\t\t</assignedEntity>\n\t</dataEnterer>\n\t<!-- Informant -->\n\t<informant>\n\t\t<assignedEntity>\n\t\t\t<id extension=\"888888888\" root=\"2.16.840.1.113883.19.5\"/>\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>1007 Healthcare Drive</streetAddressLine>\n\t\t\t\t<city>Portland</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)-1003\"/>\n\t\t\t<assignedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<given>Harold</given>\n\t\t\t\t\t<family>Hippocrates</family>\n\t\t\t\t\t<suffix qualifier=\"AC\">D.O.</suffix>\n\t\t\t\t</name>\n\t\t\t</assignedPerson>\n\t\t</assignedEntity>\n\t</informant>\n\t<!-- Custodian -->\n\t<custodian>\n\t\t<assignedCustodian>\n\t\t\t<representedCustodianOrganization>\n\t\t\t\t<id extension=\"321CX\" root=\"2.16.840.1.113883.4.6\"/>\n\t\t\t\t<name>Good Health HIE</name>\n\t\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)555-1009\"/>\n\t\t\t\t<addr use=\"WP\">\n\t\t\t\t\t<streetAddressLine>1009 Healthcare Drive </streetAddressLine>\n\t\t\t\t\t<city>Portland</city>\n\t\t\t\t\t<state>OR</state>\n\t\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t\t<country>US</country>\n\t\t\t\t</addr>\n\t\t\t</representedCustodianOrganization>\n\t\t</assignedCustodian>\n\t</custodian>\n\t<informationRecipient>\n\t\t<intendedRecipient>\n\t\t\t<!-- Receiving Person Provider Id -->\n\t\t\t<id root=\"a1cd2b74-c6de-44ee-b552-3adacb7983cc\"/>\n\t\t\t<!-- Receiving Medicare/Medicaid Provider Id-->\n\t\t\t<id root=\"c72f64c2-b1db-444b-bbff-4d2e1d6bd659\"/>\n\t\t\t<!-- Receiving Person ID-->\n\t\t\t<id root=\"fa883fee-b255-4465-8fb5-1d8135e39896\"/>\n\t\t\t<!-- Receiving Person Address-->\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>100 Better Health Rd.</streetAddressLine>\n\t\t\t\t<city>Ann Arbor</city>\n\t\t\t\t<state>MI</state>\n\t\t\t\t<postalCode>97857</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<informationRecipient>\n\t\t\t\t<!-- Receiving Person Name-->\n\t\t\t\t<name>\n\t\t\t\t\t<given>Nurse</given>\n\t\t\t\t\t<family>Caresalot</family>\n\t\t\t\t\t<suffix>RN</suffix>\n\t\t\t\t</name>\n\t\t\t</informationRecipient>\n\t\t\t<receivedOrganization>\n\t\t\t\t<!-- Receiving Organization Id-->\n\t\t\t\t<id root=\"c4c416a7-aeeb-4dcc-9662-ab836ff4d265\"/>\n\t\t\t\t<!-- Receiving Organization Provider ID (NPI) -->\n\t\t\t\t<id root=\"ab47f3c4-1267-4b9e-9a29-e966b5a861c8\"/>\n\t\t\t\t<!-- Receiving Organization Name -->\n\t\t\t\t<name>Better Health Hospital</name>\n\t\t\t\t<!-- Receiving Organization Address -->\n\t\t\t\t<addr>\n\t\t\t\t\t<streetAddressLine>100 Better Health Rd.</streetAddressLine>\n\t\t\t\t\t<city>Ann Arbor</city>\n\t\t\t\t\t<state>MI</state>\n\t\t\t\t\t<postalCode>97857</postalCode>\n\t\t\t\t\t<country>US</country>\n\t\t\t\t</addr>\n\t\t\t\t<!-- Receiving Care Setting Type Description: displayName.  Receiving Care Setting Type Code: code -->\n\t\t\t\t<standardIndustryClassCode displayName=\"Long Term Care Hospital\" code=\"282E00000X\" codeSystem=\"2.16.840.1.114222.4.11.1066\" codeSystemName=\"Healthcare Provider Taxonomy (HIPAA)\"/>\n\t\t\t</receivedOrganization>\n\t\t</intendedRecipient>\n\t</informationRecipient>\n\t<!-- Legal Authenticator -->\n\t<legalAuthenticator>\n\t\t<time value=\"20130730\"/>\n\t\t<signatureCode code=\"S\"/>\n\t\t<sdtc:signatureText mediaType=\"text/xml\" representation=\"B64\">U2lnbmVkIGJ5IE51cnNlIE5pZ2h0aW5nYWxl</sdtc:signatureText>\n\t\t<assignedEntity>\n\t\t\t<id root=\"20cf14fb-b65c-4c8c-a54d-b0cca834c18c\"/>\n\t\t\t<code code=\"163W00000X\" codeSystem=\"2.16.840.1.113883.6.101\" displayName=\"Registered nurse\"/>\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>1004 Healthcare Drive </streetAddressLine>\n\t\t\t\t<city>Portland</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)555-1004\"/>\n\t\t\t<assignedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<given>Nurse</given>\n\t\t\t\t\t<family>Nightingale</family>\n\t\t\t\t\t<suffix>RN</suffix>\n\t\t\t\t</name>\n\t\t\t</assignedPerson>\n\t\t\t<representedOrganization>\n\t\t\t\t<id root=\"2.16.840.1.113883.19.5\"/>\n\t\t\t\t<name>Good Health Hospital</name>\n\t\t\t\t<!-- the orgnaization id and name -->\n\t\t\t</representedOrganization>\n\t\t</assignedEntity>\n\t</legalAuthenticator>\n\t<!-- This authenticator represents patient agreement or sign-off of the Care Plan-->\n\t<authenticator>\n\t\t<time value=\"20130802\"/>\n\t\t<signatureCode code=\"S\"/>\n\t\t<sdtc:signatureText mediaType=\"text/xml\" representation=\"B64\">U2lnbmVkIGJ5IEV2ZSBFdmVyeXdvbWFu</sdtc:signatureText>\n\t\t<assignedEntity>\n\t\t\t<id extension=\"444222222\" root=\"2.16.840.1.113883.4.1\"/>\n\t\t\t<code code=\"ONESELF\" displayName=\"Self\" codeSystem=\"2.16.840.1.113883.5.111\" codeSystemName=\"RoleCode\"/>\n\t\t\t<addr use=\"HP\">\n\t\t\t\t<!-- HP is \"primary home\" from codeSystem 2.16.840.1.113883.5.1119 -->\n\t\t\t\t<streetAddressLine>2222 Home Street</streetAddressLine>\n\t\t\t\t<city>Beaverton</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>97867</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t\t<!-- US is \"United States\" from ISO 3166-1 Country Codes: 1.0.3166.1 -->\n\t\t\t</addr>\n\t\t\t<telecom value=\"tel:+1(555)555-2003\" use=\"HP\"/>\n\t\t\t<assignedPerson>\n\t\t\t\t<name use=\"L\">\n\t\t\t\t\t<given>Eve</given>\n\t\t\t\t\t<family qualifier=\"SP\">Everywoman</family>\n\t\t\t\t</name>\n\t\t\t</assignedPerson>\n\t\t</assignedEntity>\n\t</authenticator>\n\t<!-- This participant represents the person who reviewed the Care Plan. If the date in the time element is in the past, then this review has already taken place. \n         If the date in the time element is in the future, then this is the date of the next scheduled review. -->\n\t<!-- This example shows a Care Plan Review that has already taken place -->\n\t<participant typeCode=\"VRF\">\n\t\t<functionCode code=\"425268008\" codeSystem=\"2.16.840.1.113883.6.96\" codeSystemName=\"SNOMED CT\" displayName=\"Review of Care Plan\"/>\n\t\t<time value=\"20130801\"/>\n\t\t<associatedEntity classCode=\"ASSIGNED\">\n\t\t\t<id root=\"20cf14fb-b65c-4c8c-a54d-b0cca834c18c\"/>\n      <associatedPerson nullFlavor=\"NA\" />\n\t\t</associatedEntity>\n\t</participant>\n\t<!-- This participant represents the person who reviewed the Care Plan.   If the date in the time element is in the past, then this review has already taken place. \n  If the date in the time element is in the future,  then this is the date of the next scheduled review. -->\n\t<!-- This example shows a Scheduled Care Plan Review that is in the future -->\n\t<participant typeCode=\"VRF\">\n\t\t<functionCode code=\"425268008\" codeSystem=\"2.16.840.1.113883.6.96\" codeSystemName=\"SNOMED CT\" displayName=\"Review of Care Plan\"/>\n\t\t<time value=\"20131001\"/>\n\t\t<associatedEntity classCode=\"ASSIGNED\">\n\t\t\t<id root=\"20cf14fb-b65c-4c8c-a54d-b0cca834c18c\"/>\n\t\t\t<code code=\"SELF\" displayName=\"self\" codeSystem=\"2.16.840.1.113883.5.111\"/>\n      <associatedPerson nullFlavor=\"NA\" />\n\t\t</associatedEntity>\n\t</participant>\n\t<!-- This participant identifies individuals who support the patient such as a relative or caregiver -->\n\t<participant typeCode=\"IND\">\n\t\t<!-- Emergency Contact  -->\n\t\t<associatedEntity classCode=\"ECON\">\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>17 Daws Rd.</streetAddressLine>\n\t\t\t\t<city>Ann Arbor</city>\n\t\t\t\t<state>MI</state>\n\t\t\t\t<postalCode>97857</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom value=\"tel:(999)555-1212\" use=\"WP\"/>\n\t\t\t<associatedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<prefix>Mrs.</prefix>\n\t\t\t\t\t<given>Martha</given>\n\t\t\t\t\t<family>Jones</family>\n\t\t\t\t</name>\n\t\t\t</associatedPerson>\n\t\t</associatedEntity>\n\t</participant>\n\t<!-- This participant identifies individuals who support the patient such as a relative or caregiver -->\n\t<participant typeCode=\"IND\">\n\t\t<!-- Caregiver -->\n\t\t<associatedEntity classCode=\"CAREGIVER\">\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>17 Daws Rd.</streetAddressLine>\n\t\t\t\t<city>Ann Arbor</city>\n\t\t\t\t<state>MI</state>\n\t\t\t\t<postalCode>97857</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom value=\"tel:(999)555-1212\" use=\"WP\"/>\n\t\t\t<associatedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<prefix>Mrs.</prefix>\n\t\t\t\t\t<given>Martha</given>\n\t\t\t\t\t<family>Jones</family>\n\t\t\t\t</name>\n\t\t\t</associatedPerson>\n\t\t</associatedEntity>\n\t</participant>\n\t<documentationOf>\n\t\t<serviceEvent classCode=\"PCPR\">\n\t\t\t<effectiveTime>\n\t\t\t\t<low value=\"20130720\"/>\n\t\t\t\t<high value=\"20130815\"/>\n\t\t\t</effectiveTime>\n\t\t\t<!-- The performer(s) represents the healthcare providers involved in the current or historical care of the patient.\n                The patient’s key healthcare providers would be listed here which would include the primary physician and any \n                active consulting physicians, therapists, counselors, and care team members.  -->\n\t\t\t<performer typeCode=\"PRF\">\n\t\t\t\t<time value=\"20130715223615-0800\"/>\n\t\t\t\t<assignedEntity>\n\t\t\t\t\t<id extension=\"5555555555\" root=\"2.16.840.1.113883.4.6\"/>\n\t\t\t\t\t<code code=\"207QA0505X\" displayName=\"Adult Medicine\" codeSystem=\"2.16.840.1.113883.6.101\" codeSystemName=\"Healthcare Provider Taxonomy (HIPAA)\"/>\n\t\t\t\t\t<addr>\n\t\t\t\t\t\t<streetAddressLine>1004 Healthcare Drive </streetAddressLine>\n\t\t\t\t\t\t<city>Portland</city>\n\t\t\t\t\t\t<state>OR</state>\n\t\t\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t\t\t<country>US</country>\n\t\t\t\t\t</addr>\n\t\t\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)-1004\"/>\n\t\t\t\t\t<assignedPerson>\n\t\t\t\t\t\t<name>\n\t\t\t\t\t\t\t<given>Patricia</given>\n\t\t\t\t\t\t\t<given qualifier=\"CL\">Patty</given>\n\t\t\t\t\t\t\t<family>Primary</family>\n\t\t\t\t\t\t\t<suffix qualifier=\"AC\">M.D.</suffix>\n\t\t\t\t\t\t</name>\n\t\t\t\t\t</assignedPerson>\n\t\t\t\t</assignedEntity>\n\t\t\t</performer>\n\t\t</serviceEvent>\n\t</documentationOf>\n\t<!-- The Care Plan is continually evolving and dynamic. The Care Plan CDA instance \n     is NOT dynamic. Each time a Care Plan CDA is generated it represents a snapshot \n     in time of the Care Plan at that moment. Whenever a care provider or patient \n     generates a Care Plan, it should be noted through relatedDocument \n     whether the current Care Plan replaces or appends another Care Plan. \n     The relatedDocumentTypeCode indicates whether the current document is \n     an addendum to the ParentDocument (APND (append)) or the current document \n     is a replacement of the ParentDocument (RPLC (replace)). -->\n\t<!-- This document is the second in a set - relatedDocument\n      describes the parent document-->\n\t<relatedDocument typeCode=\"RPLC\">\n\t\t<parentDocument>\n\t\t\t<id root=\"223769be-f6ee-4b04-a0ce-b56ae998c880\"/>\n\t\t\t<code code=\"CarePlan-x\" codeSystem=\"2.16.840.1.113883.6.1\" codeSystemName=\"LOINC\" displayName=\"Care Plan\"/>\n\t\t\t<setId root=\"004bb033-b948-4f4c-b5bf-a8dbd7d8dd40\"/>\n\t\t\t<versionNumber value=\"1\"/>\n\t\t</parentDocument>\n\t</relatedDocument>\n\t<componentOf>\n\t\t<encompassingEncounter>\n\t\t\t<id extension=\"9937012\" root=\"2.16.840.1.113883.19\"/>\n\t\t\t<code codeSystem=\"2.16.840.1.113883.5.4\" code=\"IMP\" displayName=\"Inpatient\"/>\n\t\t\t<!-- captures that this is an inpatient encounter -->\n\t\t\t<effectiveTime>\n\t\t\t\t<low value=\"20130615\"/>\n\t\t\t\t<!-- No high value - this patient is still in hospital -->\n\t\t\t</effectiveTime>\n\t\t</encompassingEncounter>\n\t</componentOf>\n\t<!-- \n********************************************************\nCDA Body\n********************************************************\n-->\n\t<component>\n    <structuredBody>\n\t\t<!-- ***************** PROBLEM LIST *********************** -->\n\t\t<component>\n\t\t\t<!-- nullFlavor of NI indicates No Information.-->\n\t\t\t<!-- Note this pattern may not validate with schematron but has been SDWG approved -->\n\t\t\t<section nullFlavor=\"NI\">\n\t\t\t\t<!-- conforms to Problems section with entries required -->\n\t\t\t\t<templateId root=\"2.16.840.1.113883.10.20.22.2.5.1\" extension=\"2014-06-09\"/>\n\t\t\t\t<code code=\"11450-4\" codeSystem=\"2.16.840.1.113883.6.1\" codeSystemName=\"LOINC\" displayName=\"PROBLEM LIST\"/>\n\t\t\t\t<title>PROBLEMS</title>\n\t\t\t\t<text>No Information</text>\n\t\t\t</section>\n\t\t</component>\n    </structuredBody>\n\t</component>\n</ClinicalDocument>",
       "fileType": null
     }
   ]
diff --git a/http-client-tests/resources/sources/README.md b/http-client-tests/resources/sources/README.md
new file mode 100644
index 00000000..ee7c697e
--- /dev/null
+++ b/http-client-tests/resources/sources/README.md
@@ -0,0 +1,36 @@
+These examples are intended to test validation using several pre-defined validation engine bases (IGs, relevant 
+settings, etc). The test cases are only intended to ensure that the correct settings are being used. The test cases are
+not intended to test validation itself, as this is done through fhir-test-cases.
+
+The contents of these test files are described below:
+
+
+# ccda.xml
+
+This is a combination of examples. The base of the document is this complete example:
+
+https://github.com/HL7/CDA-ccda/blob/master/input/examples/care-plan-complete-example.xml
+
+To minimize the expected errors, the problem list from the following was added to the structured body element:
+
+https://github.com/HL7/C-CDA-Examples/blob/master/Documents/CCD/CCD%202/CCD.xml
+
+Validating through CDA and CCDA will give slightly different results. 
+
+# ips.json
+
+This was taken directly from https://build.fhir.org/ig/HL7/fhir-ips/Bundle-bundle-minimal.json.html
+
+# iss-nz.json
+
+This was taken from the confluence page for the NZ IPS: https://confluence.hl7.org/display/HNZ/8.+NZ+Patient+Summary+%28NZPS%29+profiling+test+track?focusedCommentId=208470365
+
+Specifically downloaded from this link: https://terminz.azurewebsites.net/fhir/Patient/$summary?profile=http://hl7.org/fhir/uv/ips/StructureDefinition/Bundle-uv-ips&identifier=https://standards.digital.health.nz/ns/nhi-id|ZKT9319&_format=json
+
+# sql-on-fhir
+
+This was taken directly from the simple example on https://build.fhir.org/ig/FHIR/sql-on-fhir-v2/ but with the additional
+structure and fields required to make it a valid resource.
+
+
+
diff --git a/http-client-tests/resources/sources/ccda.xml b/http-client-tests/resources/sources/ccda.xml
new file mode 100644
index 00000000..84be5c9e
--- /dev/null
+++ b/http-client-tests/resources/sources/ccda.xml
@@ -0,0 +1,460 @@
+<?xml version="1.0" encoding="utf-8"?>
+<?xml-stylesheet type="text/xsl" href="CDA.xsl"?>
+<!--
+ Title:        Care Plan
+ Filename:     C-CDA_R2_Care_Plan.xml
+ Created by:   Lantana Consulting Group, LLC
+
+ $LastChangedDate: 2014-11-12 23:25:09 -0500 (Wed, 12 Nov 2014) $
+
+ ********************************************************
+ Disclaimer: This sample file contains representative data elements to represent a Care Plan.
+ The file depicts a fictional character's health data. Any resemblance to a real person is coincidental.
+ To illustrate as many data elements as possible, the clinical scenario may not be plausible.
+ The data in this sample file is not intended to represent real patients, people or clinical events.
+ This sample is designed to be used in conjunction with the C-CDA Clinical Notes Implementation Guide.
+ ********************************************************
+  -->
+<ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:hl7-org:v3" xmlns:voc="urn:hl7-org:v3/voc" xmlns:sdtc="urn:hl7-org:sdtc">
+    <!-- ** CDA Header ** -->
+    <realmCode code="US"/>
+    <typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
+    <!-- US Realm Header -->
+    <templateId root="2.16.840.1.113883.10.20.22.1.1" extension="2023-05-01"/>
+    <!-- Care Plan -->
+    <templateId root="2.16.840.1.113883.10.20.22.1.15" extension="2015-08-01"/>
+    <id root="db734647-fc99-424c-a864-7e3cda82e703"/>
+    <code code="52521-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Overall Plan of Care/Advance Care Directives"/>
+    <title>Good Health Hospital Care Plan</title>
+    <effectiveTime value="201308201120-0800"/>
+    <confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25"/>
+    <languageCode code="en-US"/>
+    <!-- This document is the second document in the set (see setId for id for the set -->
+    <setId root="004bb033-b948-4f4c-b5bf-a8dbd7d8dd40"/>
+    <!-- See relatedDocument for the previous version in the set -->
+    <versionNumber value="2"/>
+    <!-- Patient (recordTarget) -->
+    <recordTarget>
+        <patientRole>
+            <id extension="444222222" root="2.16.840.1.113883.4.1"/>
+            <!-- Example Social Security Number using the actual SSN OID. -->
+            <addr use="HP">
+                <!-- HP is "primary home" from codeSystem 2.16.840.1.113883.5.1119 -->
+                <streetAddressLine>2222 Home Street</streetAddressLine>
+                <city>Beaverton</city>
+                <state>OR</state>
+                <postalCode>97867</postalCode>
+                <country>US</country>
+                <!-- US is "United States" from ISO 3166-1 Country Codes: 1.0.3166.1 -->
+            </addr>
+            <telecom value="tel:+1(555)555-2003" use="HP"/>
+            <!-- HP is "primary home" from HL7 AddressUse 2.16.840.1.113883.5.1119 -->
+            <patient>
+                <!-- The first name element represents what the patient is known as -->
+                <name use="L">
+                    <given>Eve</given>
+                    <!-- The "SP" is "Spouse" from HL7 Code System EntityNamePartQualifier 2.16.840.1.113883.5.43 -->
+                    <family qualifier="SP">Betterhalf</family>
+                </name>
+                <!-- The second name element represents another name associated with the patient -->
+                <name use="SRCH">
+                    <given>Eve</given>
+                    <!-- The "BR" is "Birth" from HL7 Code System EntityNamePartQualifier 2.16.840.1.113883.5.43 -->
+                    <family qualifier="BR">Everywoman</family>
+                </name>
+                <administrativeGenderCode code="F" displayName="Female" codeSystem="2.16.840.1.113883.5.1" codeSystemName="AdministrativeGender"/>
+                <!-- Date of birth need only be precise to the day -->
+                <birthTime value="19750501"/>
+                <maritalStatusCode code="M" displayName="Married" codeSystem="2.16.840.1.113883.5.2" codeSystemName="MaritalStatusCode"/>
+                <religiousAffiliationCode code="1013" displayName="Christian (non-Catholic, non-specific)" codeSystem="2.16.840.1.113883.5.1076" codeSystemName="HL7 Religious Affiliation"/>
+                <!-- CDC Race and Ethnicity code set contains the five minimum race and ethnicity categories defined by OMB Standards -->
+                <raceCode code="2106-3" displayName="White" codeSystem="2.16.840.1.113883.6.238" codeSystemName="Race &amp; Ethnicity - CDC"/>
+                <!-- The raceCode extension is only used if raceCode is valued -->
+                <sdtc:raceCode code="2076-8" displayName="Hawaiian or Other Pacific Islander" codeSystem="2.16.840.1.113883.6.238" codeSystemName="Race &amp; Ethnicity - CDC"/>
+                <ethnicGroupCode code="2186-5" displayName="Not Hispanic or Latino" codeSystem="2.16.840.1.113883.6.238" codeSystemName="Race &amp; Ethnicity - CDC"/>
+                <guardian>
+                    <code code="POWATT" displayName="Power of Attorney" codeSystem="2.16.840.1.113883.1.11.19830" codeSystemName="ResponsibleParty"/>
+                    <addr use="HP">
+                        <streetAddressLine>2222 Home Street</streetAddressLine>
+                        <city>Beaverton</city>
+                        <state>OR</state>
+                        <postalCode>97867</postalCode>
+                        <country>US</country>
+                    </addr>
+                    <telecom value="tel:+1(555)555-2008" use="MC"/>
+                    <guardianPerson>
+                        <name>
+                            <given>Boris</given>
+                            <given qualifier="CL">Bo</given>
+                            <family>Betterhalf</family>
+                        </name>
+                    </guardianPerson>
+                </guardian>
+                <birthplace>
+                    <place>
+                        <addr>
+                            <streetAddressLine>4444 Home Street</streetAddressLine>
+                            <city>Beaverton</city>
+                            <state>OR</state>
+                            <postalCode>97867</postalCode>
+                            <country>US</country>
+                        </addr>
+                    </place>
+                </birthplace>
+                <languageCommunication>
+                    <languageCode code="en"/>
+                    <modeCode code="ESP" displayName="Expressed spoken" codeSystem="2.16.840.1.113883.5.60" codeSystemName="LanguageAbilityMode"/>
+                    <proficiencyLevelCode code="G" displayName="Good" codeSystem="2.16.840.1.113883.5.61" codeSystemName="LanguageAbilityProficiency"/>
+                    <!-- Patient's preferred language -->
+                    <preferenceInd value="true"/>
+                </languageCommunication>
+            </patient>
+            <providerOrganization>
+                <id extension="219BX" root="2.16.840.1.113883.4.6"/>
+                <name>The DoctorsTogether Physician Group</name>
+                <telecom use="WP" value="tel:+1(555)555-5000"/>
+                <addr>
+                    <streetAddressLine>1007 Health Drive</streetAddressLine>
+                    <city>Portland</city>
+                    <state>OR</state>
+                    <postalCode>99123</postalCode>
+                    <country>US</country>
+                </addr>
+            </providerOrganization>
+        </patientRole>
+    </recordTarget>
+    <!-- Author -->
+    <author>
+        <time value="20130730"/>
+        <assignedAuthor>
+            <id root="20cf14fb-b65c-4c8c-a54d-b0cca834c18c"/>
+            <code code="163W00000X" codeSystem="2.16.840.1.113883.6.101" codeSystemName="Healthcare Provider Taxonomy (HIPAA)" displayName="Registered nurse"/>
+            <addr>
+                <streetAddressLine>1004 Healthcare Drive </streetAddressLine>
+                <city>Portland</city>
+                <state>OR</state>
+                <postalCode>99123</postalCode>
+                <country>US</country>
+            </addr>
+            <telecom use="WP" value="tel:+1(555)555-1004"/>
+            <assignedPerson>
+                <name>
+                    <given>Nurse</given>
+                    <family>Nightingale</family>
+                    <suffix>RN</suffix>
+                </name>
+            </assignedPerson>
+            <representedOrganization>
+                <id root="2.16.840.1.113883.19.5"/>
+                <name>Good Health Hospital</name>
+            </representedOrganization>
+        </assignedAuthor>
+    </author>
+    <!-- Data Enterer -->
+    <dataEnterer>
+        <assignedEntity>
+            <id extension="333777777" root="2.16.840.1.113883.4.6"/>
+            <addr>
+                <streetAddressLine>1007 Healthcare Drive</streetAddressLine>
+                <city>Portland</city>
+                <state>OR</state>
+                <postalCode>99123</postalCode>
+                <country>US</country>
+            </addr>
+            <telecom use="WP" value="tel:+1(555)-1050"/>
+            <assignedPerson>
+                <name>
+                    <given>Ellen</given>
+                    <family>Enter</family>
+                </name>
+            </assignedPerson>
+        </assignedEntity>
+    </dataEnterer>
+    <!-- Informant -->
+    <informant>
+        <assignedEntity>
+            <id extension="888888888" root="2.16.840.1.113883.19.5"/>
+            <addr>
+                <streetAddressLine>1007 Healthcare Drive</streetAddressLine>
+                <city>Portland</city>
+                <state>OR</state>
+                <postalCode>99123</postalCode>
+                <country>US</country>
+            </addr>
+            <telecom use="WP" value="tel:+1(555)-1003"/>
+            <assignedPerson>
+                <name>
+                    <given>Harold</given>
+                    <family>Hippocrates</family>
+                    <suffix qualifier="AC">D.O.</suffix>
+                </name>
+            </assignedPerson>
+        </assignedEntity>
+    </informant>
+    <!-- Custodian -->
+    <custodian>
+        <assignedCustodian>
+            <representedCustodianOrganization>
+                <id extension="321CX" root="2.16.840.1.113883.4.6"/>
+                <name>Good Health HIE</name>
+                <telecom use="WP" value="tel:+1(555)555-1009"/>
+                <addr use="WP">
+                    <streetAddressLine>1009 Healthcare Drive </streetAddressLine>
+                    <city>Portland</city>
+                    <state>OR</state>
+                    <postalCode>99123</postalCode>
+                    <country>US</country>
+                </addr>
+            </representedCustodianOrganization>
+        </assignedCustodian>
+    </custodian>
+    <informationRecipient>
+        <intendedRecipient>
+            <!-- Receiving Person Provider Id -->
+            <id root="a1cd2b74-c6de-44ee-b552-3adacb7983cc"/>
+            <!-- Receiving Medicare/Medicaid Provider Id-->
+            <id root="c72f64c2-b1db-444b-bbff-4d2e1d6bd659"/>
+            <!-- Receiving Person ID-->
+            <id root="fa883fee-b255-4465-8fb5-1d8135e39896"/>
+            <!-- Receiving Person Address-->
+            <addr>
+                <streetAddressLine>100 Better Health Rd.</streetAddressLine>
+                <city>Ann Arbor</city>
+                <state>MI</state>
+                <postalCode>97857</postalCode>
+                <country>US</country>
+            </addr>
+            <informationRecipient>
+                <!-- Receiving Person Name-->
+                <name>
+                    <given>Nurse</given>
+                    <family>Caresalot</family>
+                    <suffix>RN</suffix>
+                </name>
+            </informationRecipient>
+            <receivedOrganization>
+                <!-- Receiving Organization Id-->
+                <id root="c4c416a7-aeeb-4dcc-9662-ab836ff4d265"/>
+                <!-- Receiving Organization Provider ID (NPI) -->
+                <id root="ab47f3c4-1267-4b9e-9a29-e966b5a861c8"/>
+                <!-- Receiving Organization Name -->
+                <name>Better Health Hospital</name>
+                <!-- Receiving Organization Address -->
+                <addr>
+                    <streetAddressLine>100 Better Health Rd.</streetAddressLine>
+                    <city>Ann Arbor</city>
+                    <state>MI</state>
+                    <postalCode>97857</postalCode>
+                    <country>US</country>
+                </addr>
+                <!-- Receiving Care Setting Type Description: displayName.  Receiving Care Setting Type Code: code -->
+                <standardIndustryClassCode displayName="Long Term Care Hospital" code="282E00000X" codeSystem="2.16.840.1.114222.4.11.1066" codeSystemName="Healthcare Provider Taxonomy (HIPAA)"/>
+            </receivedOrganization>
+        </intendedRecipient>
+    </informationRecipient>
+    <!-- Legal Authenticator -->
+    <legalAuthenticator>
+        <time value="20130730"/>
+        <signatureCode code="S"/>
+        <sdtc:signatureText mediaType="text/xml" representation="B64">U2lnbmVkIGJ5IE51cnNlIE5pZ2h0aW5nYWxl</sdtc:signatureText>
+        <assignedEntity>
+            <id root="20cf14fb-b65c-4c8c-a54d-b0cca834c18c"/>
+            <code code="163W00000X" codeSystem="2.16.840.1.113883.6.101" displayName="Registered nurse"/>
+            <addr>
+                <streetAddressLine>1004 Healthcare Drive </streetAddressLine>
+                <city>Portland</city>
+                <state>OR</state>
+                <postalCode>99123</postalCode>
+                <country>US</country>
+            </addr>
+            <telecom use="WP" value="tel:+1(555)555-1004"/>
+            <assignedPerson>
+                <name>
+                    <given>Nurse</given>
+                    <family>Nightingale</family>
+                    <suffix>RN</suffix>
+                </name>
+            </assignedPerson>
+            <representedOrganization>
+                <id root="2.16.840.1.113883.19.5"/>
+                <name>Good Health Hospital</name>
+                <!-- the orgnaization id and name -->
+            </representedOrganization>
+        </assignedEntity>
+    </legalAuthenticator>
+    <!-- This authenticator represents patient agreement or sign-off of the Care Plan-->
+    <authenticator>
+        <time value="20130802"/>
+        <signatureCode code="S"/>
+        <sdtc:signatureText mediaType="text/xml" representation="B64">U2lnbmVkIGJ5IEV2ZSBFdmVyeXdvbWFu</sdtc:signatureText>
+        <assignedEntity>
+            <id extension="444222222" root="2.16.840.1.113883.4.1"/>
+            <code code="ONESELF" displayName="Self" codeSystem="2.16.840.1.113883.5.111" codeSystemName="RoleCode"/>
+            <addr use="HP">
+                <!-- HP is "primary home" from codeSystem 2.16.840.1.113883.5.1119 -->
+                <streetAddressLine>2222 Home Street</streetAddressLine>
+                <city>Beaverton</city>
+                <state>OR</state>
+                <postalCode>97867</postalCode>
+                <country>US</country>
+                <!-- US is "United States" from ISO 3166-1 Country Codes: 1.0.3166.1 -->
+            </addr>
+            <telecom value="tel:+1(555)555-2003" use="HP"/>
+            <assignedPerson>
+                <name use="L">
+                    <given>Eve</given>
+                    <family qualifier="SP">Everywoman</family>
+                </name>
+            </assignedPerson>
+        </assignedEntity>
+    </authenticator>
+    <!-- This participant represents the person who reviewed the Care Plan. If the date in the time element is in the past, then this review has already taken place.
+         If the date in the time element is in the future, then this is the date of the next scheduled review. -->
+    <!-- This example shows a Care Plan Review that has already taken place -->
+    <participant typeCode="VRF">
+        <functionCode code="425268008" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Review of Care Plan"/>
+        <time value="20130801"/>
+        <associatedEntity classCode="ASSIGNED">
+            <id root="20cf14fb-b65c-4c8c-a54d-b0cca834c18c"/>
+            <associatedPerson nullFlavor="NA" />
+        </associatedEntity>
+    </participant>
+    <!-- This participant represents the person who reviewed the Care Plan.   If the date in the time element is in the past, then this review has already taken place.
+  If the date in the time element is in the future,  then this is the date of the next scheduled review. -->
+    <!-- This example shows a Scheduled Care Plan Review that is in the future -->
+    <participant typeCode="VRF">
+        <functionCode code="425268008" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Review of Care Plan"/>
+        <time value="20131001"/>
+        <associatedEntity classCode="ASSIGNED">
+            <id root="20cf14fb-b65c-4c8c-a54d-b0cca834c18c"/>
+            <code code="SELF" displayName="self" codeSystem="2.16.840.1.113883.5.111"/>
+            <associatedPerson nullFlavor="NA" />
+        </associatedEntity>
+    </participant>
+    <!-- This participant identifies individuals who support the patient such as a relative or caregiver -->
+    <participant typeCode="IND">
+        <!-- Emergency Contact  -->
+        <associatedEntity classCode="ECON">
+            <addr>
+                <streetAddressLine>17 Daws Rd.</streetAddressLine>
+                <city>Ann Arbor</city>
+                <state>MI</state>
+                <postalCode>97857</postalCode>
+                <country>US</country>
+            </addr>
+            <telecom value="tel:(999)555-1212" use="WP"/>
+            <associatedPerson>
+                <name>
+                    <prefix>Mrs.</prefix>
+                    <given>Martha</given>
+                    <family>Jones</family>
+                </name>
+            </associatedPerson>
+        </associatedEntity>
+    </participant>
+    <!-- This participant identifies individuals who support the patient such as a relative or caregiver -->
+    <participant typeCode="IND">
+        <!-- Caregiver -->
+        <associatedEntity classCode="CAREGIVER">
+            <addr>
+                <streetAddressLine>17 Daws Rd.</streetAddressLine>
+                <city>Ann Arbor</city>
+                <state>MI</state>
+                <postalCode>97857</postalCode>
+                <country>US</country>
+            </addr>
+            <telecom value="tel:(999)555-1212" use="WP"/>
+            <associatedPerson>
+                <name>
+                    <prefix>Mrs.</prefix>
+                    <given>Martha</given>
+                    <family>Jones</family>
+                </name>
+            </associatedPerson>
+        </associatedEntity>
+    </participant>
+    <documentationOf>
+        <serviceEvent classCode="PCPR">
+            <effectiveTime>
+                <low value="20130720"/>
+                <high value="20130815"/>
+            </effectiveTime>
+            <!-- The performer(s) represents the healthcare providers involved in the current or historical care of the patient.
+                The patient’s key healthcare providers would be listed here which would include the primary physician and any
+                active consulting physicians, therapists, counselors, and care team members.  -->
+            <performer typeCode="PRF">
+                <time value="20130715223615-0800"/>
+                <assignedEntity>
+                    <id extension="5555555555" root="2.16.840.1.113883.4.6"/>
+                    <code code="207QA0505X" displayName="Adult Medicine" codeSystem="2.16.840.1.113883.6.101" codeSystemName="Healthcare Provider Taxonomy (HIPAA)"/>
+                    <addr>
+                        <streetAddressLine>1004 Healthcare Drive </streetAddressLine>
+                        <city>Portland</city>
+                        <state>OR</state>
+                        <postalCode>99123</postalCode>
+                        <country>US</country>
+                    </addr>
+                    <telecom use="WP" value="tel:+1(555)-1004"/>
+                    <assignedPerson>
+                        <name>
+                            <given>Patricia</given>
+                            <given qualifier="CL">Patty</given>
+                            <family>Primary</family>
+                            <suffix qualifier="AC">M.D.</suffix>
+                        </name>
+                    </assignedPerson>
+                </assignedEntity>
+            </performer>
+        </serviceEvent>
+    </documentationOf>
+    <!-- The Care Plan is continually evolving and dynamic. The Care Plan CDA instance
+     is NOT dynamic. Each time a Care Plan CDA is generated it represents a snapshot
+     in time of the Care Plan at that moment. Whenever a care provider or patient
+     generates a Care Plan, it should be noted through relatedDocument
+     whether the current Care Plan replaces or appends another Care Plan.
+     The relatedDocumentTypeCode indicates whether the current document is
+     an addendum to the ParentDocument (APND (append)) or the current document
+     is a replacement of the ParentDocument (RPLC (replace)). -->
+    <!-- This document is the second in a set - relatedDocument
+      describes the parent document-->
+    <relatedDocument typeCode="RPLC">
+        <parentDocument>
+            <id root="223769be-f6ee-4b04-a0ce-b56ae998c880"/>
+            <code code="CarePlan-x" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Care Plan"/>
+            <setId root="004bb033-b948-4f4c-b5bf-a8dbd7d8dd40"/>
+            <versionNumber value="1"/>
+        </parentDocument>
+    </relatedDocument>
+    <componentOf>
+        <encompassingEncounter>
+            <id extension="9937012" root="2.16.840.1.113883.19"/>
+            <code codeSystem="2.16.840.1.113883.5.4" code="IMP" displayName="Inpatient"/>
+            <!-- captures that this is an inpatient encounter -->
+            <effectiveTime>
+                <low value="20130615"/>
+                <!-- No high value - this patient is still in hospital -->
+            </effectiveTime>
+        </encompassingEncounter>
+    </componentOf>
+    <!--
+********************************************************
+CDA Body
+********************************************************
+-->
+    <component>
+        <structuredBody>
+            <!-- ***************** PROBLEM LIST *********************** -->
+            <component>
+                <!-- nullFlavor of NI indicates No Information.-->
+                <!-- Note this pattern may not validate with schematron but has been SDWG approved -->
+                <section nullFlavor="NI">
+                    <!-- conforms to Problems section with entries required -->
+                    <templateId root="2.16.840.1.113883.10.20.22.2.5.1" extension="2014-06-09"/>
+                    <code code="11450-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="PROBLEM LIST"/>
+                    <title>PROBLEMS</title>
+                    <text>No Information</text>
+                </section>
+            </component>
+        </structuredBody>
+    </component>
+</ClinicalDocument>
\ No newline at end of file
diff --git a/http-client-tests/resources/sources/ips-nz.json b/http-client-tests/resources/sources/ips-nz.json
new file mode 100644
index 00000000..45f85982
--- /dev/null
+++ b/http-client-tests/resources/sources/ips-nz.json
@@ -0,0 +1,3044 @@
+{
+  "resourceType": "Bundle",
+  "id": "NZ-IPS-20231121031219",
+  "language": "en-NZ",
+  "identifier": {
+    "system": "urn:oid:2.16.724.4.8.10.200.10",
+    "value": "3d5006e9-f003-4a78-a253-40ab405b7ef2"
+  },
+  "type": "document",
+  "timestamp": "2023-11-21T03:12:19.1242772+00:00",
+  "entry": [
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Composition/9b9e4f64-c976-47e9-a8a5-4b9b0484a709",
+      "resource": {
+        "resourceType": "Composition",
+        "id": "9b9e4f64-c976-47e9-a8a5-4b9b0484a709",
+        "meta": {
+          "versionId": "1"
+        },
+        "language": "en-NZ",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' lang='en-NZ' xml:lang='en-NZ'>International Patient Summary for Iosefa Test-Fuimaono</div>"
+        },
+        "identifier": {
+          "system": "urn:oid:2.16.840.1.113883.2.18.7.2",
+          "value": "3d5006e9-f003-4a78-a253-40ab405b7ef2"
+        },
+        "status": "final",
+        "type": {
+          "coding": [
+            {
+              "system": "http://loinc.org",
+              "code": "60591-5",
+              "display": "Patient summary Document"
+            }
+          ]
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "date": "2023-11-21",
+        "author": [
+          {
+            "reference": "Organization/9c9542df-e45f-4131-9d44-8f5974e56d5b"
+          }
+        ],
+        "title": "International Patient Summary",
+        "confidentiality": "N",
+        "attester": [
+          {
+            "mode": "professional",
+            "time": "2023-11-21",
+            "party": {
+              "reference": "PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244"
+            }
+          }
+        ],
+        "custodian": {
+          "reference": "Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b"
+        },
+        "relatesTo": [
+          {
+            "code": "transforms",
+            "targetIdentifier": {
+              "system": "urn:oid:2.16.840.1.113883.2.18.7.2",
+              "value": "3d5006e9-f003-4a78-a253-40ab405b7ef2"
+            }
+          }
+        ],
+        "event": [
+          {
+            "code": [
+              {
+                "coding": [
+                  {
+                    "system": "http://terminology.hl7.org/CodeSystem/v3-ActClass",
+                    "code": "PCPR"
+                  }
+                ]
+              }
+            ],
+            "period": {
+              "end": "2023-11-21"
+            }
+          }
+        ],
+        "section": [
+          {
+            "title": "Allergies and Intolerances",
+            "code": {
+              "coding": [
+                {
+                  "system": "http://loinc.org",
+                  "code": "48765-2",
+                  "display": "Allergies and adverse reactions Document"
+                }
+              ]
+            },
+            "text": {
+              "status": "generated",
+              "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">\r\n  <table>\r\n    <thead>\r\n      <tr>\r\n        <th>Code</th>\r\n        <th>Type</th>\r\n        <th>Recorded On</th>\r\n        <th>Asserted By</th>\r\n        <th>Clinical Status</th>\r\n        <th>Verification Status</th>\r\n      </tr>\r\n    </thead>\r\n    <tbody>\r\n      <tr>\r\n        <td>Flucloxacillin-containing product</td>\r\n        <td>Allergy</td>\r\n        <td />\r\n        <td>Patient/ZKT9319</td>\r\n        <td>active</td>\r\n        <td>confirmed</td>\r\n      </tr>\r\n      <tr>\r\n        <td>Diazepam-containing product</td>\r\n        <td>Allergy</td>\r\n        <td />\r\n        <td>Patient/ZKT9319</td>\r\n        <td>active</td>\r\n        <td>confirmed</td>\r\n      </tr>\r\n    </tbody>\r\n  </table>\r\n</div>"
+            },
+            "entry": [
+              {
+                "reference": "AllergyIntolerance/1dfacb6d-4260-4fd4-84e9-a1c13aafa72c"
+              },
+              {
+                "reference": "AllergyIntolerance/e9b9aeaf-e5ac-4f72-b01d-df4c6107f746"
+              }
+            ]
+          },
+          {
+            "title": "Problem List",
+            "code": {
+              "coding": [
+                {
+                  "system": "http://loinc.org",
+                  "code": "11450-4",
+                  "display": "Problem list - Reported"
+                }
+              ]
+            },
+            "text": {
+              "status": "generated",
+              "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">\r\n  <table>\r\n    <thead>\r\n      <tr>\r\n        <th>Condition</th>\r\n        <th>Category</th>\r\n        <th>Recorded On</th>\r\n        <th>Clinical Status</th>\r\n        <th>Verification Status</th>\r\n      </tr>\r\n    </thead>\r\n    <tbody>\r\n      <tr>\r\n        <td>Postconcussion syndrome</td>\r\n        <td>Problem List Item</td>\r\n        <td />\r\n        <td>active</td>\r\n        <td>confirmed</td>\r\n      </tr>\r\n      <tr>\r\n        <td>Diabetes type 2 on insulin</td>\r\n        <td>Problem List Item</td>\r\n        <td />\r\n        <td>active</td>\r\n        <td>confirmed</td>\r\n      </tr>\r\n      <tr>\r\n        <td>Gout</td>\r\n        <td>Problem List Item</td>\r\n        <td />\r\n        <td>active</td>\r\n        <td>confirmed</td>\r\n      </tr>\r\n      <tr>\r\n        <td>Benign essential hypertension</td>\r\n        <td>Problem List Item</td>\r\n        <td />\r\n        <td>active</td>\r\n        <td>confirmed</td>\r\n      </tr>\r\n      <tr>\r\n        <td>Anxiety disorder due to a general medical condition</td>\r\n        <td>Problem List Item</td>\r\n        <td />\r\n        <td>inactive</td>\r\n        <td>confirmed</td>\r\n      </tr>\r\n      <tr>\r\n        <td>Fracture of neck of femur</td>\r\n        <td>Problem List Item</td>\r\n        <td />\r\n        <td>inactive</td>\r\n        <td>confirmed</td>\r\n      </tr>\r\n    </tbody>\r\n  </table>\r\n</div>"
+            },
+            "entry": [
+              {
+                "reference": "Condition/2eafb947-e816-4d9f-978b-c91d0dbe4acc"
+              },
+              {
+                "reference": "Condition/1923f2ca-043b-432c-9eed-404c81474e60"
+              },
+              {
+                "reference": "Condition/4f40d5e3-9a5f-4e3f-b799-c3378da8e7dd"
+              },
+              {
+                "reference": "Condition/08992112-ac66-4c66-a803-89f80bb6d2aa"
+              },
+              {
+                "reference": "Condition/9b54fc7a-8302-45cc-9ff6-e60c623c5bf9"
+              },
+              {
+                "reference": "Condition/dd40111a-683f-4d72-bccc-3c6848bc0813"
+              }
+            ]
+          },
+          {
+            "title": "Medication Summary",
+            "code": {
+              "coding": [
+                {
+                  "system": "http://loinc.org",
+                  "code": "10160-0",
+                  "display": "History of Medication use Narrative"
+                }
+              ]
+            },
+            "text": {
+              "status": "generated",
+              "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">\r\n  <table>\r\n    <thead>\r\n      <tr>\r\n        <th>Drug</th>\r\n        <th>Status</th>\r\n        <th>Effective</th>\r\n        <th>Instructions</th>\r\n      </tr>\r\n    </thead>\r\n    <tbody>\r\n      <tr>\r\n        <td>insulin glargine 100 international units/mL injection, 10 mL vial</td>\r\n        <td>Active</td>\r\n        <td>2023-02-21</td>\r\n        <td>Inject 20 units per day into your upper arms, abdomen or thights.You should vary the site where you inject each dose of Lantus. This helps reduce your risk of certain side effects, such as pits or lumps in your skin.</td>\r\n      </tr>\r\n      <tr>\r\n        <td>dulaglutide 1.5 mg/0.5 mL injection, prefilled injection device</td>\r\n        <td>Active</td>\r\n        <td>2023-02-21</td>\r\n        <td>Inject once a week, on the same day each week, into the skin of your stomach, thigh or upper arm. You can use the same area of your body each time, but choose a different place within that area. You can inject it any time of the day, with or without meals.</td>\r\n      </tr>\r\n      <tr>\r\n        <td>metformin hydrochloride 1000 mg tablet</td>\r\n        <td>Active</td>\r\n        <td>2023-02-21</td>\r\n        <td>Take ONE tablet, two times a day, with meals.</td>\r\n      </tr>\r\n      <tr>\r\n        <td>amlodipine 5 mg tablet</td>\r\n        <td>Active</td>\r\n        <td>2023-02-21</td>\r\n        <td>Take ONE tablet at any time of day, but try to make sure it's around the same time every day.</td>\r\n      </tr>\r\n      <tr>\r\n        <td>losartan potassium 50 mg tablet</td>\r\n        <td>Active</td>\r\n        <td>2023-02-21</td>\r\n        <td>Take ONE tablet daily</td>\r\n      </tr>\r\n      <tr>\r\n        <td>aspirin 75 mg tablet: enteric-coated</td>\r\n        <td>Active</td>\r\n        <td>2023-02-21</td>\r\n        <td>Take ONE tablet daily</td>\r\n      </tr>\r\n      <tr>\r\n        <td>allopurinol 300 mg tablet</td>\r\n        <td>Active</td>\r\n        <td>2023-02-21</td>\r\n        <td>Take ONE tablet daily, after meals</td>\r\n      </tr>\r\n    </tbody>\r\n  </table>\r\n</div>"
+            },
+            "entry": [
+              {
+                "reference": "MedicationStatement/8ecbe74a-a3fa-4edf-8133-44ca8903a645"
+              },
+              {
+                "reference": "MedicationStatement/06c4eda2-df30-4231-af09-0135e5f84548"
+              },
+              {
+                "reference": "MedicationStatement/4b5f40b9-f59c-4090-81b1-4609ac6b7af8"
+              },
+              {
+                "reference": "MedicationStatement/e19dc087-0055-4feb-a847-72e77cf55a0a"
+              },
+              {
+                "reference": "MedicationStatement/f7a26186-dd57-420f-95be-c0deeee49367"
+              },
+              {
+                "reference": "MedicationStatement/b6b49f33-a0e4-4b94-92f3-caa3267ad4f7"
+              },
+              {
+                "reference": "MedicationStatement/ce2395b9-d7ef-4df0-b38f-fc9be0e44f94"
+              }
+            ]
+          },
+          {
+            "title": "Immunizations",
+            "code": {
+              "coding": [
+                {
+                  "system": "http://loinc.org",
+                  "code": "11369-6",
+                  "display": "History of Immunization Narrative"
+                }
+              ]
+            },
+            "text": {
+              "status": "generated",
+              "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">\r\n  <table>\r\n    <thead>\r\n      <tr>\r\n        <th>Vaccine</th>\r\n        <th>Status</th>\r\n        <th>Occurance</th>\r\n        <th>Route</th>\r\n        <th>Dose #</th>\r\n        <th>Series</th>\r\n      </tr>\r\n    </thead>\r\n    <tbody>\r\n      <tr>\r\n        <td>SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 30 mcg/0.3mL dose</td>\r\n        <td>Completed</td>\r\n        <td>2022-02-01</td>\r\n        <td>Injection, intramuscular</td>\r\n        <td>2</td>\r\n        <td>12 (At risk, no previous history)</td>\r\n      </tr>\r\n      <tr>\r\n        <td>SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 30 mcg/0.3mL dose</td>\r\n        <td>Completed</td>\r\n        <td>2021-08-05</td>\r\n        <td>Injection, intramuscular</td>\r\n        <td>1</td>\r\n        <td>12 (At risk, no previous history)</td>\r\n      </tr>\r\n      <tr>\r\n        <td>Influenza, seasonal, injectable</td>\r\n        <td>Completed</td>\r\n        <td>2019-05-20</td>\r\n        <td>Injection, intramuscular</td>\r\n        <td>1</td>\r\n        <td>1 (Over 65 years (Influenza))</td>\r\n      </tr>\r\n      <tr>\r\n        <td>diphtheria, tetanus toxoids and acellular pertussis vaccine</td>\r\n        <td>Completed</td>\r\n        <td>2019-04-24</td>\r\n        <td>Injection, intramuscular</td>\r\n        <td>1</td>\r\n        <td>6 (Booster)</td>\r\n      </tr>\r\n      <tr>\r\n        <td>tetanus and diphtheria toxoids, not adsorbed, for adult use</td>\r\n        <td>Completed</td>\r\n        <td>2018-04-05</td>\r\n        <td>Injection, intramuscular</td>\r\n        <td>1</td>\r\n        <td>6 (Booster)</td>\r\n      </tr>\r\n      <tr>\r\n        <td>pneumococcal conjugate vaccine, 13 valent</td>\r\n        <td>Completed</td>\r\n        <td>2015-09-25</td>\r\n        <td>Injection, intramuscular</td>\r\n        <td>1</td>\r\n        <td>21 (PCV catch up)</td>\r\n      </tr>\r\n      <tr>\r\n        <td>Influenza, seasonal, injectable</td>\r\n        <td>Completed</td>\r\n        <td>2015-05-01</td>\r\n        <td>Injection, intramuscular</td>\r\n        <td>1</td>\r\n        <td>1 (Over 65 years (Influenza))</td>\r\n      </tr>\r\n    </tbody>\r\n  </table>\r\n</div>"
+            },
+            "entry": [
+              {
+                "reference": "Immunization/998e59d9-a7f4-4503-b08e-85ce9b206b0a"
+              },
+              {
+                "reference": "Immunization/fc6b3454-527b-4deb-a266-7f52c63d0d3c"
+              },
+              {
+                "reference": "Immunization/33c971d3-0992-4e93-b904-6325ed4602e3"
+              },
+              {
+                "reference": "Immunization/12c253d4-20e8-4dd4-935c-fd1ec8a49279"
+              },
+              {
+                "reference": "Immunization/70308bba-2bc4-4505-ba9b-520f9d3dc30b"
+              },
+              {
+                "reference": "Immunization/acd3a963-0985-4679-a126-8eb9ed981d36"
+              },
+              {
+                "reference": "Immunization/bae44614-43cc-4df4-94b3-c26d34b0ea37"
+              }
+            ]
+          },
+          {
+            "title": "Procedures",
+            "code": {
+              "coding": [
+                {
+                  "system": "http://loinc.org",
+                  "code": "47519-4",
+                  "display": "History of Procedures Document"
+                }
+              ]
+            },
+            "text": {
+              "status": "generated",
+              "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'><table xmlns=\"http://www.w3.org/1999/xhtml\">        <thead>          <tr>            <th>Date(s)</th>            <th>Procedure</th>            <th>Location</th>            <th>Performer</th>            <th>Comments</th>                                  </tr>        </thead>        <tbody>          <tr>            <td>01/09/2020 to 01/09/2020</td>            <td>Operative procedure on hip</td>            <td>Waikato Hospital</td>                                                          </tr>          <tr>            <td>31/03/2018 to 31/03/2018</td>            <td>Hand closure</td>            <td>Samoa</td>                                                          </tr>        </tbody>      </table>    </div>"
+            },
+            "entry": [
+              {
+                "reference": "Procedure/8414198c-a43b-4ef1-b06f-3b39fb4b39cc"
+              },
+              {
+                "reference": "Procedure/1096ab80-e982-41b3-85c2-8e1d2466d147"
+              }
+            ]
+          },
+          {
+            "title": "Results",
+            "code": {
+              "coding": [
+                {
+                  "system": "http://loinc.org",
+                  "code": "30954-2",
+                  "display": "Relevant diagnostic tests/laboratory data Narrative"
+                }
+              ]
+            },
+            "text": {
+              "status": "generated",
+              "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'><table>        <tbody>          <tr>            <th>Result Group:</th>            <td>Lipids</td>            <th>Result Date:</th>            <td>05 Mar 2023 00:00</td>            <th>Result Status:</th>            <td>completed</td>          </tr>        </tbody>      </table>      <table xmlns=\"http://www.w3.org/1999/xhtml\">        <thead>          <tr>            <th>Result Name</th>            <th>Value</th>            <th>Reference Range</th>            <th>Abnormal Indicator</th>            <th>Comments</th>                                  </tr>        </thead>        <tbody>          <tr>            <td>Total cholesterol:HDL ratio</td>            <td>5.1 mmol/L</td>            <td>&lt;4 mmol/L (high risk)</td>            <td>H</td>                                              </tr>          <tr>            <td>HDL Cholesterol</td>            <td>1.5 mmol/L</td>            <td>&gt;1 mmol/L</td>            <td>N</td>                                              </tr>          <tr>            <td>LDL Cholesterol</td>            <td>3.4 mmol/L</td>            <td>&lt;1.8 mmol/L</td>            <td>H</td>                                              </tr>        </tbody>      </table>            <table>        <tbody>          <tr>            <th>Result Group:</th>            <td>HbA1C</td>            <th>Result Date:</th>            <td>05 Mar 2023 00:00</td>            <th>Result Status:</th>            <td>completed</td>          </tr>        </tbody>      </table>      <table xmlns=\"http://www.w3.org/1999/xhtml\">        <thead>          <tr>            <th>Result Name</th>            <th>Value</th>            <th>Reference Range</th>            <th>Abnormal Indicator</th>            <th>Comments</th>                                  </tr>        </thead>        <tbody>          <tr>            <td>HbA1c</td>            <td>60 mmol/mol</td>            <td>50 – 55 mmol/mol (diabetes)</td>            <td>H</td>                                              </tr>        </tbody>      </table>    </div>"
+            },
+            "entry": [
+              {
+                "reference": "Observation/2f3ad263-1b4e-443b-95ca-66d2abb6e927"
+              },
+              {
+                "reference": "Observation/fe53810f-a341-4093-a959-4048ad62f85b"
+              },
+              {
+                "reference": "Observation/6adb76b4-73f3-4552-87a6-09ac3dc1f558"
+              },
+              {
+                "reference": "DiagnosticReport/9e0d995f-a78d-45f4-b3aa-23037972a3e6"
+              },
+              {
+                "reference": "Observation/63ad8984-003c-4e44-bc56-31dd6abc0897"
+              },
+              {
+                "reference": "DiagnosticReport/2da4116e-7158-4d59-b6c4-873b37f7d65f"
+              }
+            ]
+          },
+          {
+            "title": "Vital Signs",
+            "code": {
+              "coding": [
+                {
+                  "system": "http://loinc.org",
+                  "code": "8716-3",
+                  "display": "Vital signs"
+                }
+              ]
+            },
+            "text": {
+              "status": "generated",
+              "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'><table>        <tbody>          <tr>            <th>Result Group:</th>            <td>Vital signs, weight, height, head circumference, oxygen saturation and BMI panel</td>            <th>Result Date:</th>            <td>29 Sep 2023 00:00</td>            <th>Result Status:</th>            <td>completed</td>          </tr>        </tbody>      </table>      <table xmlns=\"http://www.w3.org/1999/xhtml\">        <thead>          <tr>            <th>Result Name</th>            <th>Value</th>                                  </tr>        </thead>        <tbody>          <tr>            <td>Body temperature</td>            <td>37.5 C</td>                                  </tr>          <tr>            <td>Heart rate</td>            <td>84 beats/minute</td>                                  </tr>          <tr>            <td>Respiratory rate</td>            <td>18 breaths/minute</td>                                  </tr>          <tr>            <td>Systolic blood pressure</td>            <td>136 mm[Hg]</td>                                  </tr>          <tr>            <td>Diastolic blood pressure</td>            <td>88 mm[Hg]</td>                                  </tr>          <tr>            <td>Body height</td>            <td>1.84 cm</td>                                  </tr>          <tr>            <td>Body weight</td>            <td>104 kg</td>                                  </tr>        </tbody>      </table>            <table>        <tbody>          <tr>            <th>Result Group:</th>            <td>Vital signs, weight, height, head circumference, oxygen saturation and BMI panel</td>            <th>Result Date:</th>            <td>05 Mar 2023 00:00</td>            <th>Result Status:</th>            <td>completed</td>          </tr>        </tbody>      </table>      <table xmlns=\"http://www.w3.org/1999/xhtml\">        <thead>          <tr>            <th>Result Name</th>            <th>Value</th>                                  </tr>        </thead>        <tbody>          <tr>            <td>Body temperature</td>            <td>37.2 C</td>                                  </tr>          <tr>            <td>Heart rate</td>            <td>86 beats/minute</td>                                  </tr>          <tr>            <td>Respiratory rate</td>            <td>14 breaths/minute</td>                                  </tr>          <tr>            <td>Systolic blood pressure</td>            <td>130 mm[Hg]</td>                                  </tr>          <tr>            <td>Diastolic blood pressure</td>            <td>82 mm[Hg]</td>                                  </tr>          <tr>            <td>Body weight</td>            <td>103 kg</td>                                  </tr>        </tbody>      </table>    </div>"
+            },
+            "entry": [
+              {
+                "reference": "Observation/6f64547c-89a3-459d-a993-b89e995c1f14"
+              },
+              {
+                "reference": "Observation/da3bbb11-e485-4396-a25c-611354789c65"
+              },
+              {
+                "reference": "Observation/5dead0bd-80c7-42f7-9720-3aaf047eb89b"
+              },
+              {
+                "reference": "Observation/126f25f0-d921-4d9a-85a2-5b847cfb89fb"
+              },
+              {
+                "reference": "Observation/cf628f81-f66b-42a7-a33a-c5d38a604861"
+              },
+              {
+                "reference": "Observation/dd309bef-3b36-4422-a202-39d040113a5d"
+              },
+              {
+                "reference": "Observation/4c5e0a16-2e2c-47cc-8e1d-a87afee4d6f1"
+              },
+              {
+                "reference": "Observation/eda3092b-5228-420b-b0ce-f5eb77e73942"
+              },
+              {
+                "reference": "Observation/2d420435-f380-46e1-ad93-b9fef57f4b71"
+              },
+              {
+                "reference": "Observation/7a422837-80f5-4fa6-b3ac-8a0e44b99356"
+              },
+              {
+                "reference": "Observation/af9ae822-ae5d-4bec-88bf-4dd250350783"
+              }
+            ]
+          },
+          {
+            "title": "Social History",
+            "code": {
+              "coding": [
+                {
+                  "system": "http://loinc.org",
+                  "code": "29762-2",
+                  "display": "Social history Narrative"
+                }
+              ]
+            },
+            "text": {
+              "status": "generated",
+              "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'><table xmlns=\"http://www.w3.org/1999/xhtml\">        <thead>          <tr>            <th>Type</th>            <th>Item</th>            <th>Date(s)</th>            <th>Comment</th>                                  </tr>        </thead>        <tbody>          <tr>            <td>other</td>            <td>Worked as a forestry worker.</td>                        <td>Worked as a forestry worker. Was always physically active until 2020 fall.Has had subsequent falls. Now depends on a walker or scooter.</td>                                  </tr>          <tr>            <td>smoking</td>            <td>Ex-smoker</td>            <td>30/06/2005</td>            <td>30 - pack - year smoking history, quit smoking ~2005.</td>                                  </tr>        </tbody>      </table>    </div>"
+            },
+            "entry": [
+              {
+                "reference": "Observation/33624327-7e1b-4912-bca1-2d0c8d36b952"
+              }
+            ]
+          },
+          {
+            "title": "Functional Status",
+            "code": {
+              "coding": [
+                {
+                  "system": "http://loinc.org",
+                  "code": "47420-5",
+                  "display": "Functional status assessment note"
+                }
+              ]
+            },
+            "text": {
+              "status": "generated",
+              "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'><table xmlns=\"http://www.w3.org/1999/xhtml\">        <thead>          <tr>            <th>Functional Condition</th>            <th>Effective Dates</th>            <th>Condition Status</th>          </tr>        </thead>        <tbody>          <tr>            <td>Often confused, struggles to communicate in English</td>                        <td>Active</td>          </tr>          <tr>            <td>Depends on a walking frame or electric scooter to get around.</td>                        <td>Active</td>          </tr>          <tr>            <td>Doesn’t leave the house much.</td>                        <td>Active</td>          </tr>          <tr>            <td>Relies on caregiver Cindy for assistance with many activities of daily living.</td>                        <td>Active</td>          </tr>          <tr>            <td>Family has made the decision to transfer Iosefa to residential care soon, arrangements currently being finalised.</td>                        <td>Active</td>          </tr>        </tbody>      </table>    </div>"
+            },
+            "entry": [
+              {
+                "reference": "Condition/4464bdfe-dc87-4179-a10d-2884c975a6eb"
+              },
+              {
+                "reference": "Condition/f0982a2a-8eb2-4b1a-9e73-6a82d2102003"
+              },
+              {
+                "reference": "Condition/94c0216a-183b-45e9-9e98-f244ac0b4d4f"
+              },
+              {
+                "reference": "Condition/14863bd8-1d6d-4c85-9bcc-1b33699908c4"
+              },
+              {
+                "reference": "Condition/b008f275-c141-4cd5-b1bb-46c399eaf42d"
+              }
+            ]
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Patient/ZKT9319",
+      "resource": {
+        "resourceType": "Patient",
+        "id": "ZKT9319",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Name: Iosefa Test-Fuimaono</div>"
+        },
+        "identifier": [
+          {
+            "system": "https://standards.digital.health.nz/ns/nhi-id",
+            "value": "ZKT9319"
+          }
+        ],
+        "name": [
+          {
+            "use": "usual",
+            "family": "Test-Fuimaono",
+            "given": [
+              "Iosefa"
+            ]
+          }
+        ],
+        "gender": "male",
+        "birthDate": "1950-07-04",
+        "address": [
+          {
+            "use": "home",
+            "type": "physical",
+            "line": [
+              "Flat 1",
+              "1 Brooklyn Road",
+              "Claudelands"
+            ],
+            "city": "Hamilton",
+            "postalCode": "3214",
+            "country": "NZ"
+          }
+        ],
+        "maritalStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/v3-MaritalStatus",
+              "code": "W",
+              "display": "Widowed"
+            }
+          ]
+        },
+        "contact": [
+          {
+            "relationship": [
+              {
+                "coding": [
+                  {
+                    "system": "http://terminology.hl7.org/CodeSystem/v2-0131",
+                    "code": "N",
+                    "display": "Next-of-Kin"
+                  }
+                ]
+              }
+            ],
+            "name": {
+              "use": "usual",
+              "family": "Test-Fuimaono",
+              "given": [
+                "Cindy",
+                "Test-Fuimaono"
+              ]
+            },
+            "telecom": [
+              {
+                "system": "phone",
+                "value": "021 111111",
+                "use": "mobile"
+              }
+            ],
+            "address": {
+              "use": "home",
+              "type": "physical",
+              "line": [
+                "Flat 1",
+                "1 Brooklyn Road",
+                "Claudelands"
+              ],
+              "city": "Hamilton",
+              "postalCode": "3214",
+              "country": "NZ"
+            }
+          },
+          {
+            "relationship": [
+              {
+                "coding": [
+                  {
+                    "system": "http://terminology.hl7.org/CodeSystem/v2-0131",
+                    "code": "C",
+                    "display": "Emergency Contact"
+                  }
+                ]
+              }
+            ],
+            "name": {
+              "use": "usual",
+              "family": "Test-Fuimaono",
+              "given": [
+                "Cindy",
+                "Test-Fuimaono"
+              ]
+            },
+            "telecom": [
+              {
+                "system": "phone",
+                "value": "021 111111",
+                "use": "mobile"
+              }
+            ],
+            "address": {
+              "use": "home",
+              "type": "physical",
+              "line": [
+                "Flat 1",
+                "1 Brooklyn Road",
+                "Claudelands"
+              ],
+              "city": "Hamilton",
+              "postalCode": "3214",
+              "country": "NZ"
+            }
+          }
+        ],
+        "communication": [
+          {
+            "language": {
+              "text": "en-NZ"
+            }
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Organization/9c9542df-e45f-4131-9d44-8f5974e56d5b",
+      "resource": {
+        "resourceType": "Organization",
+        "id": "9c9542df-e45f-4131-9d44-8f5974e56d5b",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Name: Fairfield Medical Centre</div>"
+        },
+        "identifier": [
+          {
+            "system": "https://standards.digital.health.nz/ns/hpi-facility-id",
+            "value": "F0U044-C"
+          }
+        ],
+        "name": "Fairfield Medical Centre"
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244",
+      "resource": {
+        "resourceType": "PractitionerRole",
+        "id": "c9288aea-5e73-4182-8231-aacbe50d3244",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Role: Doctor</div>"
+        },
+        "practitioner": {
+          "reference": "Practitioner/4d4b76bf-55b5-40b8-a130-99ea24a84c23"
+        },
+        "code": [
+          {
+            "coding": [
+              {
+                "system": "http://snomed.info/sct",
+                "code": "158965000",
+                "display": "Doctor"
+              }
+            ]
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Practitioner/4d4b76bf-55b5-40b8-a130-99ea24a84c23",
+      "resource": {
+        "resourceType": "Practitioner",
+        "id": "4d4b76bf-55b5-40b8-a130-99ea24a84c23",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Name: Dr James Test-Smith</div>"
+        },
+        "name": [
+          {
+            "use": "usual",
+            "family": "Test-Smith",
+            "given": [
+              "Dr",
+              "James",
+              "Test-Smith"
+            ]
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b",
+      "resource": {
+        "resourceType": "Organization",
+        "id": "644f2fb9-c264-4c32-898b-4048dddd6d1b",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Name: Fairfield Medical Centre</div>"
+        },
+        "identifier": [
+          {
+            "system": "https://standards.digital.health.nz/ns/hpi-facility-id",
+            "value": "F0U044-C"
+          }
+        ],
+        "name": "Fairfield Medical Centre"
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Location/F05076-A",
+      "resource": {
+        "resourceType": "Location",
+        "id": "F05076-A",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">\r\n  <h2>Waikato Hospital</h2>\r\n  <table>\r\n    <tr>\r\n      <td>Identifier</td>\r\n      <td>F05076-A</td>\r\n    </tr>\r\n    <tr>\r\n      <td>Identifier System</td>\r\n      <td>https://standards.digital.health.nz/ns/hpi-facility-id</td>\r\n    </tr>\r\n    <tr>\r\n      <td>Status</td>\r\n      <td>Active</td>\r\n    </tr>\r\n    <tr>\r\n      <td>Mode</td>\r\n      <td>Instance</td>\r\n    </tr>\r\n    <tr>\r\n      <td>Type</td>\r\n      <td>Location</td>\r\n    </tr>\r\n    <tr>\r\n      <td>Address</td>\r\n      <td>183 Pembroke Street, Waikato Hospital, Hamilton 3204</td>\r\n    </tr>\r\n  </table>\r\n</div>"
+        },
+        "identifier": [
+          {
+            "system": "https://standards.digital.health.nz/ns/hpi-facility-id",
+            "value": "F05076-A"
+          }
+        ],
+        "status": "active",
+        "name": "Waikato Hospital"
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/AllergyIntolerance/1dfacb6d-4260-4fd4-84e9-a1c13aafa72c",
+      "resource": {
+        "resourceType": "AllergyIntolerance",
+        "id": "1dfacb6d-4260-4fd4-84e9-a1c13aafa72c",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Flucloxacillin-containing product (Penicillin adverse reaction)</div>"
+        },
+        "clinicalStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
+              "code": "active"
+            }
+          ]
+        },
+        "verificationStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
+              "code": "confirmed"
+            }
+          ]
+        },
+        "type": "allergy",
+        "category": [
+          "medication"
+        ],
+        "code": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "96067005",
+              "display": "Flucloxacillin-containing product"
+            }
+          ]
+        },
+        "patient": {
+          "reference": "Patient/ZKT9319"
+        },
+        "asserter": {
+          "reference": "Patient/ZKT9319"
+        },
+        "reaction": [
+          {
+            "manifestation": [
+              {
+                "coding": [
+                  {
+                    "system": "http://snomed.info/sct",
+                    "code": "292954005",
+                    "display": "Penicillin adverse reaction"
+                  }
+                ]
+              }
+            ]
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/AllergyIntolerance/e9b9aeaf-e5ac-4f72-b01d-df4c6107f746",
+      "resource": {
+        "resourceType": "AllergyIntolerance",
+        "id": "e9b9aeaf-e5ac-4f72-b01d-df4c6107f746",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Diazepam-containing product (Diazepam adverse reaction)</div>"
+        },
+        "clinicalStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
+              "code": "active"
+            }
+          ]
+        },
+        "verificationStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
+              "code": "confirmed"
+            }
+          ]
+        },
+        "type": "allergy",
+        "category": [
+          "medication"
+        ],
+        "code": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "48546005",
+              "display": "Diazepam-containing product"
+            }
+          ]
+        },
+        "patient": {
+          "reference": "Patient/ZKT9319"
+        },
+        "asserter": {
+          "reference": "Patient/ZKT9319"
+        },
+        "reaction": [
+          {
+            "manifestation": [
+              {
+                "coding": [
+                  {
+                    "system": "http://snomed.info/sct",
+                    "code": "292360004",
+                    "display": "Diazepam adverse reaction"
+                  }
+                ]
+              }
+            ]
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Condition/2eafb947-e816-4d9f-978b-c91d0dbe4acc",
+      "resource": {
+        "resourceType": "Condition",
+        "id": "2eafb947-e816-4d9f-978b-c91d0dbe4acc",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Postconcussion</div>"
+        },
+        "clinicalStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
+              "code": "active"
+            }
+          ]
+        },
+        "verificationStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
+              "code": "confirmed"
+            }
+          ]
+        },
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/condition-category",
+                "code": "problem-list-item",
+                "display": "Problem List Item"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "40425004",
+              "display": "Postconcussion syndrome"
+            }
+          ]
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        }
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Condition/1923f2ca-043b-432c-9eed-404c81474e60",
+      "resource": {
+        "resourceType": "Condition",
+        "id": "1923f2ca-043b-432c-9eed-404c81474e60",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Diabetes type 2 on insulin</div>"
+        },
+        "clinicalStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
+              "code": "active"
+            }
+          ]
+        },
+        "verificationStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
+              "code": "confirmed"
+            }
+          ]
+        },
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/condition-category",
+                "code": "problem-list-item",
+                "display": "Problem List Item"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "237599002",
+              "display": "Diabetes type 2 on insulin"
+            }
+          ]
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        }
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Condition/4f40d5e3-9a5f-4e3f-b799-c3378da8e7dd",
+      "resource": {
+        "resourceType": "Condition",
+        "id": "4f40d5e3-9a5f-4e3f-b799-c3378da8e7dd",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Gout</div>"
+        },
+        "clinicalStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
+              "code": "active"
+            }
+          ]
+        },
+        "verificationStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
+              "code": "confirmed"
+            }
+          ]
+        },
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/condition-category",
+                "code": "problem-list-item",
+                "display": "Problem List Item"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "90560007",
+              "display": "Gout"
+            }
+          ]
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        }
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Condition/08992112-ac66-4c66-a803-89f80bb6d2aa",
+      "resource": {
+        "resourceType": "Condition",
+        "id": "08992112-ac66-4c66-a803-89f80bb6d2aa",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Benign essential hypertension</div>"
+        },
+        "clinicalStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
+              "code": "active"
+            }
+          ]
+        },
+        "verificationStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
+              "code": "confirmed"
+            }
+          ]
+        },
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/condition-category",
+                "code": "problem-list-item",
+                "display": "Problem List Item"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "1201005",
+              "display": "Benign essential hypertension"
+            }
+          ]
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        }
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Condition/9b54fc7a-8302-45cc-9ff6-e60c623c5bf9",
+      "resource": {
+        "resourceType": "Condition",
+        "id": "9b54fc7a-8302-45cc-9ff6-e60c623c5bf9",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Anxiety disorder due to a general medical condition</div>"
+        },
+        "clinicalStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
+              "code": "inactive"
+            }
+          ]
+        },
+        "verificationStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
+              "code": "confirmed"
+            }
+          ]
+        },
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/condition-category",
+                "code": "problem-list-item",
+                "display": "Problem List Item"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "52910006",
+              "display": "Anxiety disorder due to a general medical condition"
+            }
+          ]
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        }
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Condition/dd40111a-683f-4d72-bccc-3c6848bc0813",
+      "resource": {
+        "resourceType": "Condition",
+        "id": "dd40111a-683f-4d72-bccc-3c6848bc0813",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Fracture of neck of femur</div>"
+        },
+        "clinicalStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
+              "code": "inactive"
+            }
+          ]
+        },
+        "verificationStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
+              "code": "confirmed"
+            }
+          ]
+        },
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/condition-category",
+                "code": "problem-list-item",
+                "display": "Problem List Item"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "5913000",
+              "display": "Fracture of neck of femur"
+            }
+          ]
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        }
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Condition/4464bdfe-dc87-4179-a10d-2884c975a6eb",
+      "resource": {
+        "resourceType": "Condition",
+        "id": "4464bdfe-dc87-4179-a10d-2884c975a6eb",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Often confused, struggles to communicate in English</div>"
+        },
+        "clinicalStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
+              "code": "active"
+            }
+          ]
+        },
+        "code": {
+          "text": "Often confused, struggles to communicate in English"
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        }
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Condition/f0982a2a-8eb2-4b1a-9e73-6a82d2102003",
+      "resource": {
+        "resourceType": "Condition",
+        "id": "f0982a2a-8eb2-4b1a-9e73-6a82d2102003",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Depends on a walking frame or electric scooter to get around.</div>"
+        },
+        "clinicalStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
+              "code": "active"
+            }
+          ]
+        },
+        "code": {
+          "text": "Depends on a walking frame or electric scooter to get around."
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        }
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Condition/94c0216a-183b-45e9-9e98-f244ac0b4d4f",
+      "resource": {
+        "resourceType": "Condition",
+        "id": "94c0216a-183b-45e9-9e98-f244ac0b4d4f",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Doesn’t leave the house much.</div>"
+        },
+        "clinicalStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
+              "code": "active"
+            }
+          ]
+        },
+        "code": {
+          "text": "Doesn’t leave the house much."
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        }
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Condition/14863bd8-1d6d-4c85-9bcc-1b33699908c4",
+      "resource": {
+        "resourceType": "Condition",
+        "id": "14863bd8-1d6d-4c85-9bcc-1b33699908c4",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Relies on caregiver Cindy for assistance with many activities of daily living.</div>"
+        },
+        "clinicalStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
+              "code": "active"
+            }
+          ]
+        },
+        "code": {
+          "text": "Relies on caregiver Cindy for assistance with many activities of daily living."
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        }
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Condition/b008f275-c141-4cd5-b1bb-46c399eaf42d",
+      "resource": {
+        "resourceType": "Condition",
+        "id": "b008f275-c141-4cd5-b1bb-46c399eaf42d",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Family has made the decision to transfer Iosefa to residential care soon, arrangements currently being finalised.</div>"
+        },
+        "clinicalStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
+              "code": "active"
+            }
+          ]
+        },
+        "code": {
+          "text": "Family has made the decision to transfer Iosefa to residential care soon, arrangements currently being finalised."
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        }
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/MedicationStatement/8ecbe74a-a3fa-4edf-8133-44ca8903a645",
+      "resource": {
+        "resourceType": "MedicationStatement",
+        "id": "8ecbe74a-a3fa-4edf-8133-44ca8903a645",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>10368421000116106 (insulin glargine 100 international units/mL injection, 10 mL vial)</div>"
+        },
+        "status": "active",
+        "medicationCodeableConcept": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "126212009",
+              "display": "Product containing insulin glargine (medicinal product)"
+            }
+          ],
+          "text": "insulin glargine 100 international units/mL injection, 10 mL vial"
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-02-21",
+        "informationSource": {
+          "reference": "Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b"
+        },
+        "dosage": [
+          {
+            "text": "Inject 20 units per day into your upper arms, abdomen or thights.You should vary the site where you inject each dose of Lantus. This helps reduce your risk of certain side effects, such as pits or lumps in your skin.",
+            "timing": {
+              "repeat": {
+                "frequency": 1,
+                "period": 1,
+                "periodUnit": "d"
+              }
+            },
+            "route": {
+              "coding": [
+                {
+                  "system": "http://snomed.info/sct",
+                  "code": "34206005",
+                  "display": "subcutaneous route"
+                }
+              ]
+            },
+            "doseAndRate": [
+              {
+                "type": {
+                  "coding": [
+                    {
+                      "system": "http://terminology.hl7.org/CodeSystem/dose-rate-type",
+                      "code": "ordered",
+                      "display": "Ordered"
+                    }
+                  ]
+                },
+                "doseQuantity": {
+                  "value": 1,
+                  "unit": "unit",
+                  "system": "http://snomed.info/sct",
+                  "code": "767525000"
+                }
+              }
+            ]
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/MedicationStatement/06c4eda2-df30-4231-af09-0135e5f84548",
+      "resource": {
+        "resourceType": "MedicationStatement",
+        "id": "06c4eda2-df30-4231-af09-0135e5f84548",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>47230201000116108 (dulaglutide 1.5 mg/0.5 mL injection, prefilled injection device)</div>"
+        },
+        "status": "active",
+        "medicationCodeableConcept": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "714081009",
+              "display": "Product containing dulaglutide (medicinal product)"
+            }
+          ],
+          "text": "dulaglutide 1.5 mg/0.5 mL injection, prefilled injection device"
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-02-21",
+        "informationSource": {
+          "reference": "Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b"
+        },
+        "dosage": [
+          {
+            "text": "Inject once a week, on the same day each week, into the skin of your stomach, thigh or upper arm. You can use the same area of your body each time, but choose a different place within that area. You can inject it any time of the day, with or without meals.",
+            "route": {
+              "coding": [
+                {
+                  "system": "http://snomed.info/sct",
+                  "code": "34206005",
+                  "display": "subcutaneous route"
+                }
+              ]
+            },
+            "doseAndRate": [
+              {
+                "type": {
+                  "coding": [
+                    {
+                      "system": "http://terminology.hl7.org/CodeSystem/dose-rate-type",
+                      "code": "ordered",
+                      "display": "Ordered"
+                    }
+                  ]
+                }
+              }
+            ]
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/MedicationStatement/4b5f40b9-f59c-4090-81b1-4609ac6b7af8",
+      "resource": {
+        "resourceType": "MedicationStatement",
+        "id": "4b5f40b9-f59c-4090-81b1-4609ac6b7af8",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>44221701000116102 (metformin hydrochloride 1000 mg tablet)</div>"
+        },
+        "status": "active",
+        "medicationCodeableConcept": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "109081006",
+              "display": "Product containing metformin (medicinal product)"
+            }
+          ],
+          "text": "metformin hydrochloride 1000 mg tablet"
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-02-21",
+        "informationSource": {
+          "reference": "Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b"
+        },
+        "dosage": [
+          {
+            "text": "Take ONE tablet, two times a day, with meals.",
+            "timing": {
+              "repeat": {
+                "frequency": 2,
+                "period": 1,
+                "periodUnit": "d"
+              }
+            },
+            "route": {
+              "coding": [
+                {
+                  "system": "http://snomed.info/sct",
+                  "code": "26643006",
+                  "display": "Oral route"
+                }
+              ]
+            },
+            "doseAndRate": [
+              {
+                "type": {
+                  "coding": [
+                    {
+                      "system": "http://terminology.hl7.org/CodeSystem/dose-rate-type",
+                      "code": "ordered",
+                      "display": "Ordered"
+                    }
+                  ]
+                },
+                "doseQuantity": {
+                  "value": 1,
+                  "unit": "Tablet - unit of product usage",
+                  "system": "http://snomed.info/sct",
+                  "code": "428673006"
+                }
+              }
+            ]
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/MedicationStatement/e19dc087-0055-4feb-a847-72e77cf55a0a",
+      "resource": {
+        "resourceType": "MedicationStatement",
+        "id": "e19dc087-0055-4feb-a847-72e77cf55a0a",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>10109621000116108 (amlodipine 5 mg tablet)</div>"
+        },
+        "status": "active",
+        "medicationCodeableConcept": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "108537001",
+              "display": "Product containing amlodipine (medicinal product)"
+            }
+          ],
+          "text": "amlodipine 5 mg tablet"
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-02-21",
+        "informationSource": {
+          "reference": "Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b"
+        },
+        "dosage": [
+          {
+            "text": "Take ONE tablet at any time of day, but try to make sure it's around the same time every day.",
+            "timing": {
+              "repeat": {
+                "frequency": 1,
+                "period": 1,
+                "periodUnit": "d"
+              }
+            },
+            "route": {
+              "coding": [
+                {
+                  "system": "http://snomed.info/sct",
+                  "code": "26643006",
+                  "display": "Oral route"
+                }
+              ]
+            },
+            "doseAndRate": [
+              {
+                "type": {
+                  "coding": [
+                    {
+                      "system": "http://terminology.hl7.org/CodeSystem/dose-rate-type",
+                      "code": "ordered",
+                      "display": "Ordered"
+                    }
+                  ]
+                },
+                "doseQuantity": {
+                  "value": 1,
+                  "unit": "Tablet - unit of product usage",
+                  "system": "http://snomed.info/sct",
+                  "code": "428673006"
+                }
+              }
+            ]
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/MedicationStatement/f7a26186-dd57-420f-95be-c0deeee49367",
+      "resource": {
+        "resourceType": "MedicationStatement",
+        "id": "f7a26186-dd57-420f-95be-c0deeee49367",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>10195211000116102 (losartan potassium 50 mg tablet)</div>"
+        },
+        "status": "active",
+        "medicationCodeableConcept": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "96309000",
+              "display": "Product containing losartan (medicinal product)"
+            }
+          ],
+          "text": "losartan potassium 50 mg tablet"
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-02-21",
+        "informationSource": {
+          "reference": "Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b"
+        },
+        "dosage": [
+          {
+            "text": "Take ONE tablet daily",
+            "timing": {
+              "repeat": {
+                "frequency": 1,
+                "period": 1,
+                "periodUnit": "d"
+              }
+            },
+            "route": {
+              "coding": [
+                {
+                  "system": "http://snomed.info/sct",
+                  "code": "26643006",
+                  "display": "Oral route"
+                }
+              ]
+            },
+            "doseAndRate": [
+              {
+                "type": {
+                  "coding": [
+                    {
+                      "system": "http://terminology.hl7.org/CodeSystem/dose-rate-type",
+                      "code": "ordered",
+                      "display": "Ordered"
+                    }
+                  ]
+                },
+                "doseQuantity": {
+                  "value": 1,
+                  "unit": "Tablet - unit of product usage",
+                  "system": "http://snomed.info/sct",
+                  "code": "428673006"
+                }
+              }
+            ]
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/MedicationStatement/b6b49f33-a0e4-4b94-92f3-caa3267ad4f7",
+      "resource": {
+        "resourceType": "MedicationStatement",
+        "id": "b6b49f33-a0e4-4b94-92f3-caa3267ad4f7",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>10077081000116106 (aspirin 75 mg tablet: enteric-coated)</div>"
+        },
+        "status": "active",
+        "medicationCodeableConcept": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "7947003",
+              "display": "Product containing aspirin (medicinal product)"
+            }
+          ],
+          "text": "aspirin 75 mg tablet: enteric-coated"
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-02-21",
+        "informationSource": {
+          "reference": "Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b"
+        },
+        "dosage": [
+          {
+            "text": "Take ONE tablet daily",
+            "timing": {
+              "repeat": {
+                "frequency": 1,
+                "period": 1,
+                "periodUnit": "d"
+              }
+            },
+            "route": {
+              "coding": [
+                {
+                  "system": "http://snomed.info/sct",
+                  "code": "26643006",
+                  "display": "Oral route"
+                }
+              ]
+            },
+            "doseAndRate": [
+              {
+                "type": {
+                  "coding": [
+                    {
+                      "system": "http://terminology.hl7.org/CodeSystem/dose-rate-type",
+                      "code": "ordered",
+                      "display": "Ordered"
+                    }
+                  ]
+                },
+                "doseQuantity": {
+                  "value": 1,
+                  "unit": "Tablet - unit of product usage",
+                  "system": "http://snomed.info/sct",
+                  "code": "428673006"
+                }
+              }
+            ]
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/MedicationStatement/ce2395b9-d7ef-4df0-b38f-fc9be0e44f94",
+      "resource": {
+        "resourceType": "MedicationStatement",
+        "id": "ce2395b9-d7ef-4df0-b38f-fc9be0e44f94",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>10030521000116104 (allopurinol 300 mg tablet)</div>"
+        },
+        "status": "active",
+        "medicationCodeableConcept": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "25246002",
+              "display": "Product containing allopurinol (medicinal product)"
+            }
+          ],
+          "text": "allopurinol 300 mg tablet"
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-02-21",
+        "informationSource": {
+          "reference": "Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b"
+        },
+        "dosage": [
+          {
+            "text": "Take ONE tablet daily, after meals",
+            "timing": {
+              "repeat": {
+                "frequency": 1,
+                "period": 1,
+                "periodUnit": "d"
+              }
+            },
+            "route": {
+              "coding": [
+                {
+                  "system": "http://snomed.info/sct",
+                  "code": "26643006",
+                  "display": "Oral route"
+                }
+              ]
+            },
+            "doseAndRate": [
+              {
+                "type": {
+                  "coding": [
+                    {
+                      "system": "http://terminology.hl7.org/CodeSystem/dose-rate-type",
+                      "code": "ordered",
+                      "display": "Ordered"
+                    }
+                  ]
+                },
+                "doseQuantity": {
+                  "value": 1,
+                  "unit": "Tablet - unit of product usage",
+                  "system": "http://snomed.info/sct",
+                  "code": "428673006"
+                }
+              }
+            ]
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Immunization/998e59d9-a7f4-4503-b08e-85ce9b206b0a",
+      "resource": {
+        "resourceType": "Immunization",
+        "id": "998e59d9-a7f4-4503-b08e-85ce9b206b0a",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>208 (Pfizer/BioNtech)</div>"
+        },
+        "status": "completed",
+        "vaccineCode": {
+          "coding": [
+            {
+              "system": "http://hl7.org/fhir/sid/cvx",
+              "code": "208",
+              "display": "SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 30 mcg/0.3mL dose"
+            }
+          ]
+        },
+        "patient": {
+          "reference": "Patient/ZKT9319"
+        },
+        "occurrenceDateTime": "2022-02-01",
+        "site": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "16217701000119102",
+              "display": "Structure of left deltoid muscle"
+            }
+          ]
+        },
+        "route": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration",
+              "code": "IM",
+              "display": "Injection, intramuscular"
+            }
+          ]
+        },
+        "performer": [
+          {
+            "actor": {
+              "reference": "Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b"
+            }
+          }
+        ],
+        "protocolApplied": [
+          {
+            "series": "12 (At risk, no previous history)",
+            "doseNumberPositiveInt": 2
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Immunization/fc6b3454-527b-4deb-a266-7f52c63d0d3c",
+      "resource": {
+        "resourceType": "Immunization",
+        "id": "fc6b3454-527b-4deb-a266-7f52c63d0d3c",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>208 (Pfizer/BioNtech)</div>"
+        },
+        "status": "completed",
+        "vaccineCode": {
+          "coding": [
+            {
+              "system": "http://hl7.org/fhir/sid/cvx",
+              "code": "208",
+              "display": "SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 30 mcg/0.3mL dose"
+            }
+          ]
+        },
+        "patient": {
+          "reference": "Patient/ZKT9319"
+        },
+        "occurrenceDateTime": "2021-08-05",
+        "site": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "16217701000119102",
+              "display": "Structure of left deltoid muscle"
+            }
+          ]
+        },
+        "route": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration",
+              "code": "IM",
+              "display": "Injection, intramuscular"
+            }
+          ]
+        },
+        "performer": [
+          {
+            "actor": {
+              "reference": "Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b"
+            }
+          }
+        ],
+        "protocolApplied": [
+          {
+            "series": "12 (At risk, no previous history)",
+            "doseNumberPositiveInt": 1
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Immunization/33c971d3-0992-4e93-b904-6325ed4602e3",
+      "resource": {
+        "resourceType": "Immunization",
+        "id": "33c971d3-0992-4e93-b904-6325ed4602e3",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>99006 (Influenza)</div>"
+        },
+        "status": "completed",
+        "vaccineCode": {
+          "coding": [
+            {
+              "system": "http://hl7.org/fhir/sid/cvx",
+              "code": "141",
+              "display": "Influenza, seasonal, injectable"
+            }
+          ]
+        },
+        "patient": {
+          "reference": "Patient/ZKT9319"
+        },
+        "occurrenceDateTime": "2019-05-20",
+        "site": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "16217701000119102",
+              "display": "Structure of left deltoid muscle"
+            }
+          ]
+        },
+        "route": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration",
+              "code": "IM",
+              "display": "Injection, intramuscular"
+            }
+          ]
+        },
+        "performer": [
+          {
+            "actor": {
+              "reference": "Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b"
+            }
+          }
+        ],
+        "protocolApplied": [
+          {
+            "series": "1 (Over 65 years (Influenza))",
+            "doseNumberPositiveInt": 1
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Immunization/12c253d4-20e8-4dd4-935c-fd1ec8a49279",
+      "resource": {
+        "resourceType": "Immunization",
+        "id": "12c253d4-20e8-4dd4-935c-fd1ec8a49279",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>20 (DTaP)</div>"
+        },
+        "status": "completed",
+        "vaccineCode": {
+          "coding": [
+            {
+              "system": "http://hl7.org/fhir/sid/cvx",
+              "code": "20",
+              "display": "diphtheria, tetanus toxoids and acellular pertussis vaccine"
+            }
+          ]
+        },
+        "patient": {
+          "reference": "Patient/ZKT9319"
+        },
+        "occurrenceDateTime": "2019-04-24",
+        "site": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "16217701000119102",
+              "display": "Structure of left deltoid muscle"
+            }
+          ]
+        },
+        "route": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration",
+              "code": "IM",
+              "display": "Injection, intramuscular"
+            }
+          ]
+        },
+        "performer": [
+          {
+            "actor": {
+              "reference": "Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b"
+            }
+          }
+        ],
+        "protocolApplied": [
+          {
+            "series": "6 (Booster)",
+            "doseNumberPositiveInt": 1
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Immunization/70308bba-2bc4-4505-ba9b-520f9d3dc30b",
+      "resource": {
+        "resourceType": "Immunization",
+        "id": "70308bba-2bc4-4505-ba9b-520f9d3dc30b",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'> [Tetanus booster (given as DT)]</div>"
+        },
+        "status": "completed",
+        "vaccineCode": {
+          "coding": [
+            {
+              "system": "http://hl7.org/fhir/sid/cvx",
+              "code": "138",
+              "display": "tetanus and diphtheria toxoids, not adsorbed, for adult use"
+            }
+          ]
+        },
+        "patient": {
+          "reference": "Patient/ZKT9319"
+        },
+        "occurrenceDateTime": "2018-04-05",
+        "site": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "16217701000119102",
+              "display": "Structure of left deltoid muscle"
+            }
+          ]
+        },
+        "route": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration",
+              "code": "IM",
+              "display": "Injection, intramuscular"
+            }
+          ]
+        },
+        "performer": [
+          {
+            "actor": {
+              "reference": "Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b"
+            }
+          }
+        ],
+        "protocolApplied": [
+          {
+            "series": "6 (Booster)",
+            "doseNumberPositiveInt": 1
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Immunization/acd3a963-0985-4679-a126-8eb9ed981d36",
+      "resource": {
+        "resourceType": "Immunization",
+        "id": "acd3a963-0985-4679-a126-8eb9ed981d36",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>133 (PCV13)</div>"
+        },
+        "status": "completed",
+        "vaccineCode": {
+          "coding": [
+            {
+              "system": "http://hl7.org/fhir/sid/cvx",
+              "code": "133",
+              "display": "pneumococcal conjugate vaccine, 13 valent"
+            }
+          ]
+        },
+        "patient": {
+          "reference": "Patient/ZKT9319"
+        },
+        "occurrenceDateTime": "2015-09-25",
+        "site": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "16217701000119102",
+              "display": "Structure of left deltoid muscle"
+            }
+          ]
+        },
+        "route": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration",
+              "code": "IM",
+              "display": "Injection, intramuscular"
+            }
+          ]
+        },
+        "performer": [
+          {
+            "actor": {
+              "reference": "Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b"
+            }
+          }
+        ],
+        "protocolApplied": [
+          {
+            "series": "21 (PCV catch up)",
+            "doseNumberPositiveInt": 1
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Immunization/bae44614-43cc-4df4-94b3-c26d34b0ea37",
+      "resource": {
+        "resourceType": "Immunization",
+        "id": "bae44614-43cc-4df4-94b3-c26d34b0ea37",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>99006 (Influenza)</div>"
+        },
+        "status": "completed",
+        "vaccineCode": {
+          "coding": [
+            {
+              "system": "http://hl7.org/fhir/sid/cvx",
+              "code": "141",
+              "display": "Influenza, seasonal, injectable"
+            }
+          ]
+        },
+        "patient": {
+          "reference": "Patient/ZKT9319"
+        },
+        "occurrenceDateTime": "2015-05-01",
+        "site": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "16217701000119102",
+              "display": "Structure of left deltoid muscle"
+            }
+          ]
+        },
+        "route": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration",
+              "code": "IM",
+              "display": "Injection, intramuscular"
+            }
+          ]
+        },
+        "performer": [
+          {
+            "actor": {
+              "reference": "Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b"
+            }
+          }
+        ],
+        "protocolApplied": [
+          {
+            "series": "1 (Over 65 years (Influenza))",
+            "doseNumberPositiveInt": 1
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Procedure/8414198c-a43b-4ef1-b06f-3b39fb4b39cc",
+      "resource": {
+        "resourceType": "Procedure",
+        "id": "8414198c-a43b-4ef1-b06f-3b39fb4b39cc",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Operative procedure on hip</div>"
+        },
+        "status": "unknown",
+        "code": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "265132005",
+              "display": "Primary open reduction and internal fixation of proximal femoral fracture with screw/nail and plate device"
+            }
+          ],
+          "text": "Operative procedure on hip"
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "performedDateTime": "2020-09-01",
+        "location": {
+          "reference": "Location/F05076-A"
+        }
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Procedure/1096ab80-e982-41b3-85c2-8e1d2466d147",
+      "resource": {
+        "resourceType": "Procedure",
+        "id": "1096ab80-e982-41b3-85c2-8e1d2466d147",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Hand closure</div>"
+        },
+        "status": "unknown",
+        "code": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "287903004",
+              "display": "Suturing of hand"
+            }
+          ],
+          "text": "Hand closure"
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "performedDateTime": "2018-03-31"
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/DiagnosticReport/9e0d995f-a78d-45f4-b3aa-23037972a3e6",
+      "resource": {
+        "resourceType": "DiagnosticReport",
+        "id": "9e0d995f-a78d-45f4-b3aa-23037972a3e6",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'> [Lipids]</div>"
+        },
+        "status": "final",
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/v2-0074",
+                "code": "LAB",
+                "display": "Laboratory"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "text": "[Lipids]"
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-03-05T00:00:00+00:00",
+        "result": [
+          {
+            "reference": "Observation/2f3ad263-1b4e-443b-95ca-66d2abb6e927"
+          },
+          {
+            "reference": "Observation/fe53810f-a341-4093-a959-4048ad62f85b"
+          },
+          {
+            "reference": "Observation/6adb76b4-73f3-4552-87a6-09ac3dc1f558"
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/DiagnosticReport/2da4116e-7158-4d59-b6c4-873b37f7d65f",
+      "resource": {
+        "resourceType": "DiagnosticReport",
+        "id": "2da4116e-7158-4d59-b6c4-873b37f7d65f",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'> [HbA1C]</div>"
+        },
+        "status": "final",
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/v2-0074",
+                "code": "LAB",
+                "display": "Laboratory"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "text": "[HbA1C]"
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-03-05T00:00:00+00:00",
+        "result": [
+          {
+            "reference": "Observation/63ad8984-003c-4e44-bc56-31dd6abc0897"
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Observation/2f3ad263-1b4e-443b-95ca-66d2abb6e927",
+      "resource": {
+        "resourceType": "Observation",
+        "id": "2f3ad263-1b4e-443b-95ca-66d2abb6e927",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'> [Total cholesterol:HDL ratio]</div>"
+        },
+        "status": "final",
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
+                "code": "laboratory"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "text": "[Total cholesterol:HDL ratio]"
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-03-05T00:00:00+00:00",
+        "performer": [
+          {
+            "reference": "PractitionerRole/8363e64e-f639-4f55-bd3c-6302bf87a6d3"
+          }
+        ],
+        "valueQuantity": {
+          "value": 5.1,
+          "unit": "mmol/L",
+          "system": "http://unitsofmeasure.org",
+          "code": "mmol/L"
+        },
+        "interpretation": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
+                "code": "H",
+                "display": "High"
+              }
+            ]
+          }
+        ],
+        "referenceRange": [
+          {
+            "text": "<4 mmol/L (high risk)"
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Observation/fe53810f-a341-4093-a959-4048ad62f85b",
+      "resource": {
+        "resourceType": "Observation",
+        "id": "fe53810f-a341-4093-a959-4048ad62f85b",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'> [HDL Cholesterol]</div>"
+        },
+        "status": "final",
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
+                "code": "laboratory"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "text": "[HDL Cholesterol]"
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-03-05T00:00:00+00:00",
+        "performer": [
+          {
+            "reference": "PractitionerRole/8363e64e-f639-4f55-bd3c-6302bf87a6d3"
+          }
+        ],
+        "valueQuantity": {
+          "value": 1.5,
+          "unit": "mmol/L",
+          "system": "http://unitsofmeasure.org",
+          "code": "mmol/L"
+        },
+        "interpretation": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
+                "code": "N",
+                "display": "Normal"
+              }
+            ]
+          }
+        ],
+        "referenceRange": [
+          {
+            "text": ">1 mmol/L"
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Observation/6adb76b4-73f3-4552-87a6-09ac3dc1f558",
+      "resource": {
+        "resourceType": "Observation",
+        "id": "6adb76b4-73f3-4552-87a6-09ac3dc1f558",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'> [LDL Cholesterol]</div>"
+        },
+        "status": "final",
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
+                "code": "laboratory"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "text": "[LDL Cholesterol]"
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-03-05T00:00:00+00:00",
+        "performer": [
+          {
+            "reference": "PractitionerRole/8363e64e-f639-4f55-bd3c-6302bf87a6d3"
+          }
+        ],
+        "valueQuantity": {
+          "value": 3.4,
+          "unit": "mmol/L",
+          "system": "http://unitsofmeasure.org",
+          "code": "mmol/L"
+        },
+        "interpretation": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
+                "code": "H",
+                "display": "High"
+              }
+            ]
+          }
+        ],
+        "referenceRange": [
+          {
+            "text": "<1.8 mmol/L"
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Observation/63ad8984-003c-4e44-bc56-31dd6abc0897",
+      "resource": {
+        "resourceType": "Observation",
+        "id": "63ad8984-003c-4e44-bc56-31dd6abc0897",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'> [HbA1c]</div>"
+        },
+        "status": "final",
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
+                "code": "laboratory"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "text": "[HbA1c]"
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-03-05T00:00:00+00:00",
+        "performer": [
+          {
+            "reference": "PractitionerRole/8363e64e-f639-4f55-bd3c-6302bf87a6d3"
+          }
+        ],
+        "valueQuantity": {
+          "value": 60,
+          "unit": "mmol/mol",
+          "system": "http://unitsofmeasure.org",
+          "code": "mmol/mol"
+        },
+        "interpretation": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
+                "code": "H",
+                "display": "High"
+              }
+            ]
+          }
+        ],
+        "referenceRange": [
+          {
+            "text": "50 – 55 mmol/mol (diabetes)"
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Observation/6f64547c-89a3-459d-a993-b89e995c1f14",
+      "resource": {
+        "resourceType": "Observation",
+        "id": "6f64547c-89a3-459d-a993-b89e995c1f14",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Body temperature</div>"
+        },
+        "status": "final",
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
+                "code": "vital-signs"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "coding": [
+            {
+              "system": "http://loinc.org",
+              "code": "8310-5",
+              "display": "Body temperature"
+            }
+          ]
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-09-29T00:00:00+00:00",
+        "performer": [
+          {
+            "reference": "PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244"
+          }
+        ],
+        "valueQuantity": {
+          "value": 37.5,
+          "unit": "Cel",
+          "system": "http://unitsofmeasure.org",
+          "code": "Cel"
+        }
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Observation/da3bbb11-e485-4396-a25c-611354789c65",
+      "resource": {
+        "resourceType": "Observation",
+        "id": "da3bbb11-e485-4396-a25c-611354789c65",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Heart rate</div>"
+        },
+        "status": "final",
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
+                "code": "vital-signs"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "coding": [
+            {
+              "system": "http://loinc.org",
+              "code": "8867-4",
+              "display": "Heart rate"
+            }
+          ]
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-09-29T00:00:00+00:00",
+        "performer": [
+          {
+            "reference": "PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244"
+          }
+        ],
+        "valueQuantity": {
+          "value": 84,
+          "unit": "/min",
+          "system": "http://unitsofmeasure.org",
+          "code": "/min"
+        }
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Observation/5dead0bd-80c7-42f7-9720-3aaf047eb89b",
+      "resource": {
+        "resourceType": "Observation",
+        "id": "5dead0bd-80c7-42f7-9720-3aaf047eb89b",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Respiratory rate</div>"
+        },
+        "status": "final",
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
+                "code": "vital-signs"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "coding": [
+            {
+              "system": "http://loinc.org",
+              "code": "9279-1",
+              "display": "Respiratory rate"
+            }
+          ]
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-09-29T00:00:00+00:00",
+        "performer": [
+          {
+            "reference": "PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244"
+          }
+        ],
+        "valueQuantity": {
+          "value": 18,
+          "unit": "/min",
+          "system": "http://unitsofmeasure.org",
+          "code": "/min"
+        }
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Observation/126f25f0-d921-4d9a-85a2-5b847cfb89fb",
+      "resource": {
+        "resourceType": "Observation",
+        "id": "126f25f0-d921-4d9a-85a2-5b847cfb89fb",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Blood pressure panel with all children optional</div>"
+        },
+        "status": "final",
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
+                "code": "vital-signs"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "coding": [
+            {
+              "system": "http://loinc.org",
+              "code": "85354-9",
+              "display": "Blood pressure panel with all children optional"
+            }
+          ]
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-09-29T00:00:00+00:00",
+        "performer": [
+          {
+            "reference": "PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244"
+          }
+        ],
+        "component": [
+          {
+            "code": {
+              "coding": [
+                {
+                  "system": "http://loinc.org",
+                  "code": "8480-6",
+                  "display": "Systolic blood pressure"
+                }
+              ]
+            },
+            "valueQuantity": {
+              "value": 136,
+              "unit": "mmHg",
+              "system": "http://unitsofmeasure.org",
+              "code": "mm[Hg]"
+            }
+          },
+          {
+            "code": {
+              "coding": [
+                {
+                  "system": "http://loinc.org",
+                  "code": "8462-4",
+                  "display": "Diastolic blood pressure"
+                }
+              ]
+            },
+            "valueQuantity": {
+              "value": 88,
+              "unit": "mmHg",
+              "system": "http://unitsofmeasure.org",
+              "code": "mm[Hg]"
+            }
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Observation/cf628f81-f66b-42a7-a33a-c5d38a604861",
+      "resource": {
+        "resourceType": "Observation",
+        "id": "cf628f81-f66b-42a7-a33a-c5d38a604861",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Body height</div>"
+        },
+        "status": "final",
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
+                "code": "vital-signs"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "coding": [
+            {
+              "system": "http://loinc.org",
+              "code": "8302-2",
+              "display": "Body height"
+            }
+          ]
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-09-29T00:00:00+00:00",
+        "performer": [
+          {
+            "reference": "PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244"
+          }
+        ],
+        "valueQuantity": {
+          "value": 1.84,
+          "unit": "cm",
+          "system": "http://unitsofmeasure.org",
+          "code": "cm"
+        }
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Observation/dd309bef-3b36-4422-a202-39d040113a5d",
+      "resource": {
+        "resourceType": "Observation",
+        "id": "dd309bef-3b36-4422-a202-39d040113a5d",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Body weight</div>"
+        },
+        "status": "final",
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
+                "code": "vital-signs"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "coding": [
+            {
+              "system": "http://loinc.org",
+              "code": "29463-7",
+              "display": "Body weight"
+            }
+          ]
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-09-29T00:00:00+00:00",
+        "performer": [
+          {
+            "reference": "PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244"
+          }
+        ],
+        "valueQuantity": {
+          "value": 104,
+          "unit": "kg",
+          "system": "http://unitsofmeasure.org",
+          "code": "kg"
+        }
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Observation/4c5e0a16-2e2c-47cc-8e1d-a87afee4d6f1",
+      "resource": {
+        "resourceType": "Observation",
+        "id": "4c5e0a16-2e2c-47cc-8e1d-a87afee4d6f1",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Body temperature</div>"
+        },
+        "status": "final",
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
+                "code": "vital-signs"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "coding": [
+            {
+              "system": "http://loinc.org",
+              "code": "8310-5",
+              "display": "Body temperature"
+            }
+          ]
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-03-05T00:00:00+00:00",
+        "performer": [
+          {
+            "reference": "PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244"
+          }
+        ],
+        "valueQuantity": {
+          "value": 37.2,
+          "unit": "Cel",
+          "system": "http://unitsofmeasure.org",
+          "code": "Cel"
+        }
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Observation/eda3092b-5228-420b-b0ce-f5eb77e73942",
+      "resource": {
+        "resourceType": "Observation",
+        "id": "eda3092b-5228-420b-b0ce-f5eb77e73942",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Heart rate</div>"
+        },
+        "status": "final",
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
+                "code": "vital-signs"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "coding": [
+            {
+              "system": "http://loinc.org",
+              "code": "8867-4",
+              "display": "Heart rate"
+            }
+          ]
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-03-05T00:00:00+00:00",
+        "performer": [
+          {
+            "reference": "PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244"
+          }
+        ],
+        "valueQuantity": {
+          "value": 86,
+          "unit": "/min",
+          "system": "http://unitsofmeasure.org",
+          "code": "/min"
+        }
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Observation/2d420435-f380-46e1-ad93-b9fef57f4b71",
+      "resource": {
+        "resourceType": "Observation",
+        "id": "2d420435-f380-46e1-ad93-b9fef57f4b71",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Respiratory rate</div>"
+        },
+        "status": "final",
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
+                "code": "vital-signs"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "coding": [
+            {
+              "system": "http://loinc.org",
+              "code": "9279-1",
+              "display": "Respiratory rate"
+            }
+          ]
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-03-05T00:00:00+00:00",
+        "performer": [
+          {
+            "reference": "PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244"
+          }
+        ],
+        "valueQuantity": {
+          "value": 14,
+          "unit": "/min",
+          "system": "http://unitsofmeasure.org",
+          "code": "/min"
+        }
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Observation/7a422837-80f5-4fa6-b3ac-8a0e44b99356",
+      "resource": {
+        "resourceType": "Observation",
+        "id": "7a422837-80f5-4fa6-b3ac-8a0e44b99356",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Blood pressure panel with all children optional</div>"
+        },
+        "status": "final",
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
+                "code": "vital-signs"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "coding": [
+            {
+              "system": "http://loinc.org",
+              "code": "85354-9",
+              "display": "Blood pressure panel with all children optional"
+            }
+          ]
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-03-05T00:00:00+00:00",
+        "performer": [
+          {
+            "reference": "PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244"
+          }
+        ],
+        "component": [
+          {
+            "code": {
+              "coding": [
+                {
+                  "system": "http://loinc.org",
+                  "code": "8480-6",
+                  "display": "Systolic blood pressure"
+                }
+              ]
+            },
+            "valueQuantity": {
+              "value": 130,
+              "unit": "mmHg",
+              "system": "http://unitsofmeasure.org",
+              "code": "mm[Hg]"
+            }
+          },
+          {
+            "code": {
+              "coding": [
+                {
+                  "system": "http://loinc.org",
+                  "code": "8462-4",
+                  "display": "Diastolic blood pressure"
+                }
+              ]
+            },
+            "valueQuantity": {
+              "value": 82,
+              "unit": "mmHg",
+              "system": "http://unitsofmeasure.org",
+              "code": "mm[Hg]"
+            }
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Observation/af9ae822-ae5d-4bec-88bf-4dd250350783",
+      "resource": {
+        "resourceType": "Observation",
+        "id": "af9ae822-ae5d-4bec-88bf-4dd250350783",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Body weight</div>"
+        },
+        "status": "final",
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
+                "code": "vital-signs"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "coding": [
+            {
+              "system": "http://loinc.org",
+              "code": "29463-7",
+              "display": "Body weight"
+            }
+          ]
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2023-03-05T00:00:00+00:00",
+        "performer": [
+          {
+            "reference": "PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244"
+          }
+        ],
+        "valueQuantity": {
+          "value": 103,
+          "unit": "kg",
+          "system": "http://unitsofmeasure.org",
+          "code": "kg"
+        }
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/Observation/33624327-7e1b-4912-bca1-2d0c8d36b952",
+      "resource": {
+        "resourceType": "Observation",
+        "id": "33624327-7e1b-4912-bca1-2d0c8d36b952",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Tobacco smoking status</div>"
+        },
+        "status": "final",
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
+                "code": "social-history"
+              }
+            ]
+          }
+        ],
+        "code": {
+          "coding": [
+            {
+              "system": "http://loinc.org",
+              "code": "72166-2",
+              "display": "Tobacco smoking status"
+            }
+          ]
+        },
+        "subject": {
+          "reference": "Patient/ZKT9319"
+        },
+        "effectiveDateTime": "2005-06-30",
+        "performer": [
+          {
+            "reference": "Patient/ZKT9319"
+          }
+        ],
+        "valueCodeableConcept": {
+          "coding": [
+            {
+              "system": "http://loinc.org",
+              "code": "LA15920-4",
+              "display": "Former smoker"
+            }
+          ]
+        },
+        "note": [
+          {
+            "text": "30 - pack - year smoking history, quit smoking ~2005."
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "https://terminz.azurewebsites.net/fhir/PractitionerRole/8363e64e-f639-4f55-bd3c-6302bf87a6d3",
+      "resource": {
+        "resourceType": "PractitionerRole",
+        "id": "8363e64e-f639-4f55-bd3c-6302bf87a6d3",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Role: Clinical pathologist</div>"
+        },
+        "code": [
+          {
+            "coding": [
+              {
+                "system": "http://snomed.info/sct",
+                "code": "81464008",
+                "display": "Clinical pathologist"
+              }
+            ]
+          }
+        ]
+      }
+    }
+  ]
+}
\ No newline at end of file
diff --git a/http-client-tests/resources/sources/ips.json b/http-client-tests/resources/sources/ips.json
new file mode 100644
index 00000000..056dc5de
--- /dev/null
+++ b/http-client-tests/resources/sources/ips.json
@@ -0,0 +1,555 @@
+{
+  "resourceType": "Bundle",
+  "id": "bundle-minimal",
+  "language": "en-US",
+  "identifier": {
+    "system": "urn:oid:2.16.724.4.8.10.200.10",
+    "value": "28b95815-76ce-457b-b7ae-a972e527db40"
+  },
+  "type": "document",
+  "timestamp": "2020-12-11T14:30:00+01:00",
+  "entry": [
+    {
+      "fullUrl": "urn:uuid:6e1fb74a-742b-4c7b-8487-171dacb88766",
+      "resource": {
+        "resourceType": "Composition",
+        "id": "6e1fb74a-742b-4c7b-8487-171dacb88766",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative</b></p><div style=\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\"><p style=\"margin-bottom: 0px\">Resource \"6e1fb74a-742b-4c7b-8487-171dacb88766\" </p></div><p><b>status</b>: final</p><p><b>type</b>: Patient summary Document <span style=\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\"> (<a href=\"https://loinc.org/\">LOINC</a>#60591-5)</span></p><p><b>date</b>: 2020-12-11 02:30:00+0100</p><p><b>author</b>: Beetje van Hulp, MD </p><p><b>title</b>: Patient Summary as of December 11, 2020 14:30</p><p><b>confidentiality</b>: N</p><blockquote><p><b>attester</b></p><p><b>mode</b>: legal</p><p><b>time</b>: 2020-12-11 02:30:00+0100</p><p><b>party</b>: Beetje van Hulp, MD </p></blockquote><blockquote><p><b>attester</b></p><p><b>mode</b>: legal</p><p><b>time</b>: 2020-12-11 02:30:00+0100</p><p><b>party</b>: Anorg Aniza Tion BV </p></blockquote><p><b>custodian</b>: Anorg Aniza Tion BV</p><h3>RelatesTos</h3><table class=\"grid\"><tr><td>-</td><td><b>Code</b></td><td><b>Target[x]</b></td></tr><tr><td>*</td><td>appends</td><td>id: 20e12ce3-857f-49c0-b888-cb670597f191</td></tr></table><h3>Events</h3><table class=\"grid\"><tr><td>-</td><td><b>Code</b></td><td><b>Period</b></td></tr><tr><td>*</td><td>care provision <span style=\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\"> (<a href=\"http://terminology.hl7.org/CodeSystem/v3-ActClass\">ActClass</a>#PCPR)</span></td><td>?? --&gt; 2020-12-11 02:30:00+0100</td></tr></table></div>"
+        },
+        "status": "final",
+        "type": {
+          "coding": [
+            {
+              "system": "http://loinc.org",
+              "code": "60591-5",
+              "display": "Patient summary Document"
+            }
+          ]
+        },
+        "subject": {
+          "reference": "Patient/7685713c-e29e-4a75-8a90-45be7ba3be94"
+        },
+        "date": "2020-12-11T14:30:00+01:00",
+        "author": [
+          {
+            "reference": "Practitioner/98315ba9-ffea-41ef-b59b-a836c039858f"
+          }
+        ],
+        "title": "Patient Summary as of December 11, 2020 14:30",
+        "confidentiality": "N",
+        "attester": [
+          {
+            "mode": "legal",
+            "time": "2020-12-11T14:30:00+01:00",
+            "party": {
+              "reference": "Practitioner/98315ba9-ffea-41ef-b59b-a836c039858f"
+            }
+          },
+          {
+            "mode": "legal",
+            "time": "2020-12-11T14:30:00+01:00",
+            "party": {
+              "reference": "Organization/bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d"
+            }
+          }
+        ],
+        "custodian": {
+          "reference": "Organization/bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d"
+        },
+        "relatesTo": [
+          {
+            "code": "appends",
+            "targetIdentifier": {
+              "system": "urn:oid:2.16.724.4.8.10.200.10",
+              "value": "20e12ce3-857f-49c0-b888-cb670597f191"
+            }
+          }
+        ],
+        "event": [
+          {
+            "code": [
+              {
+                "coding": [
+                  {
+                    "system": "http://terminology.hl7.org/CodeSystem/v3-ActClass",
+                    "code": "PCPR"
+                  }
+                ]
+              }
+            ],
+            "period": {
+              "end": "2020-12-11T14:30:00+01:00"
+            }
+          }
+        ],
+        "section": [
+          {
+            "title": "Active Problems",
+            "code": {
+              "coding": [
+                {
+                  "system": "http://loinc.org",
+                  "code": "11450-4",
+                  "display": "Problem list Reported"
+                }
+              ]
+            },
+            "text": {
+              "status": "generated",
+              "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><ul><li><div><b>Condition Name</b>: Menopausal Flushing</div><div><b>Code</b>: <span>198436008</span></div><div><b>Status</b>: <span>Active</span></div></li></ul></div>"
+            },
+            "entry": [
+              {
+                "reference": "Condition/ad84b7a2-b4dd-474e-bef3-0779e6cb595f"
+              }
+            ]
+          },
+          {
+            "title": "Medication",
+            "code": {
+              "coding": [
+                {
+                  "system": "http://loinc.org",
+                  "code": "10160-0",
+                  "display": "History of Medication use Narrative"
+                }
+              ]
+            },
+            "text": {
+              "status": "generated",
+              "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><ul><li><div><b>Medication Name</b>: Oral anastrozole 1mg tablet</div><div><b>Code</b>: <span></span></div><div><b>Status</b>: <span>Active, started March 2015</span></div><div>Instructions: Take 1 time per day</div></li></ul></div>"
+            },
+            "entry": [
+              {
+                "reference": "MedicationStatement/6e883e5e-7648-485a-86de-3640a61601fe"
+              }
+            ]
+          },
+          {
+            "title": "Allergies and Intolerances",
+            "code": {
+              "coding": [
+                {
+                  "system": "http://loinc.org",
+                  "code": "48765-2",
+                  "display": "Allergies and adverse reactions Document"
+                }
+              ]
+            },
+            "text": {
+              "status": "generated",
+              "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><ul><li><div><b>Allergy Name</b>: Pencillins</div><div><b>Verification Status</b>: Confirmed</div><div><b>Reaction</b>: <span>no information</span></div></li></ul></div>"
+            },
+            "entry": [
+              {
+                "reference": "AllergyIntolerance/fe2769fd-22c9-4307-9122-ee0466e5aebb"
+              }
+            ]
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "urn:uuid:7685713c-e29e-4a75-8a90-45be7ba3be94",
+      "resource": {
+        "resourceType": "Patient",
+        "id": "7685713c-e29e-4a75-8a90-45be7ba3be94",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative: Patient</b><a name=\"7685713c-e29e-4a75-8a90-45be7ba3be94\"> </a></p><div style=\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\"><p style=\"margin-bottom: 0px\">Resource Patient &quot;7685713c-e29e-4a75-8a90-45be7ba3be94&quot; </p></div><p><b>identifier</b>: id:\u00a0574687583</p><p><b>active</b>: true</p><p><b>name</b>: Martha DeLarosa </p><p><b>telecom</b>: <a href=\"tel:+31788700800\">+31788700800</a></p><p><b>gender</b>: female</p><p><b>birthDate</b>: 1972-05-01</p><p><b>address</b>: Laan Van Europa 1600 Dordrecht 3317 DB NL </p><h3>Contacts</h3><table class=\"grid\"><tr><td style=\"display: none\">-</td><td><b>Relationship</b></td><td><b>Name</b></td><td><b>Telecom</b></td><td><b>Address</b></td></tr><tr><td style=\"display: none\">*</td><td>mother <span style=\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\"> (<a href=\"http://terminology.hl7.org/5.3.0/CodeSystem-v3-RoleCode.html\">RoleCode</a>#MTH)</span></td><td>Martha Mum </td><td><a href=\"tel:+33-555-20036\">+33-555-20036</a></td><td>Promenade des Anglais 111 Lyon 69001 FR </td></tr></table></div>"
+        },
+        "identifier": [
+          {
+            "system": "urn:oid:2.16.840.1.113883.2.4.6.3",
+            "value": "574687583"
+          }
+        ],
+        "active": true,
+        "name": [
+          {
+            "family": "DeLarosa",
+            "given": [
+              "Martha"
+            ]
+          }
+        ],
+        "telecom": [
+          {
+            "system": "phone",
+            "value": "+31788700800",
+            "use": "home"
+          }
+        ],
+        "gender": "female",
+        "birthDate": "1972-05-01",
+        "address": [
+          {
+            "line": [
+              "Laan Van Europa 1600"
+            ],
+            "city": "Dordrecht",
+            "postalCode": "3317 DB",
+            "country": "NL"
+          }
+        ],
+        "contact": [
+          {
+            "relationship": [
+              {
+                "coding": [
+                  {
+                    "system": "http://terminology.hl7.org/CodeSystem/v3-RoleCode",
+                    "code": "MTH"
+                  }
+                ]
+              }
+            ],
+            "name": {
+              "family": "Mum",
+              "given": [
+                "Martha"
+              ]
+            },
+            "telecom": [
+              {
+                "system": "phone",
+                "value": "+33-555-20036",
+                "use": "home"
+              }
+            ],
+            "address": {
+              "line": [
+                "Promenade des Anglais 111"
+              ],
+              "city": "Lyon",
+              "postalCode": "69001",
+              "country": "FR"
+            }
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "urn:uuid:98315ba9-ffea-41ef-b59b-a836c039858f",
+      "resource": {
+        "resourceType": "Practitioner",
+        "id": "98315ba9-ffea-41ef-b59b-a836c039858f",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative: Practitioner</b><a name=\"98315ba9-ffea-41ef-b59b-a836c039858f\"> </a></p><div style=\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\"><p style=\"margin-bottom: 0px\">Resource Practitioner &quot;98315ba9-ffea-41ef-b59b-a836c039858f&quot; </p></div><p><b>identifier</b>: id:\u00a0129854633</p><p><b>active</b>: true</p><p><b>name</b>: Beetje van Hulp </p><h3>Qualifications</h3><table class=\"grid\"><tr><td style=\"display: none\">-</td><td><b>Code</b></td></tr><tr><td style=\"display: none\">*</td><td>Doctor of Medicine <span style=\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\"> (degreeLicenseCertificate[2.7]#MD)</span></td></tr></table></div>"
+        },
+        "identifier": [
+          {
+            "system": "urn:oid:2.16.528.1.1007.3.1",
+            "value": "129854633",
+            "assigner": {
+              "display": "CIBG"
+            }
+          }
+        ],
+        "active": true,
+        "name": [
+          {
+            "family": "van Hulp",
+            "given": [
+              "Beetje"
+            ]
+          }
+        ],
+        "qualification": [
+          {
+            "code": {
+              "coding": [
+                {
+                  "system": "http://terminology.hl7.org/CodeSystem/v2-0360",
+                  "version": "2.7",
+                  "code": "MD",
+                  "display": "Doctor of Medicine"
+                }
+              ]
+            }
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "urn:uuid:bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d",
+      "resource": {
+        "resourceType": "Organization",
+        "id": "bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative: Organization</b><a name=\"bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d\"> </a></p><div style=\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\"><p style=\"margin-bottom: 0px\">Resource Organization &quot;bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d&quot; </p></div><p><b>identifier</b>: id:\u00a0564738757</p><p><b>active</b>: true</p><p><b>name</b>: Anorg Aniza Tion BV / The best custodian ever</p><p><b>telecom</b>: <a href=\"tel:+31-51-34343400\">+31-51-34343400</a></p><p><b>address</b>: Houttuinen 27 Dordrecht 3311 CE NL (WORK)</p></div>"
+        },
+        "identifier": [
+          {
+            "system": "urn:oid:2.16.528.1.1007.3.3",
+            "value": "564738757"
+          }
+        ],
+        "active": true,
+        "name": "Anorg Aniza Tion BV / The best custodian ever",
+        "telecom": [
+          {
+            "system": "phone",
+            "value": "+31-51-34343400",
+            "use": "work"
+          }
+        ],
+        "address": [
+          {
+            "use": "work",
+            "line": [
+              "Houttuinen 27"
+            ],
+            "city": "Dordrecht",
+            "postalCode": "3311 CE",
+            "country": "NL"
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "urn:uuid:ad84b7a2-b4dd-474e-bef3-0779e6cb595f",
+      "resource": {
+        "resourceType": "Condition",
+        "id": "ad84b7a2-b4dd-474e-bef3-0779e6cb595f",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative: Condition</b><a name=\"ad84b7a2-b4dd-474e-bef3-0779e6cb595f\"> </a></p><div style=\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\"><p style=\"margin-bottom: 0px\">Resource Condition &quot;ad84b7a2-b4dd-474e-bef3-0779e6cb595f&quot; </p></div><p><b>identifier</b>: id:\u00a0cacceb57-395f-48e1-9c88-e9c9704dc2d2</p><p><b>clinicalStatus</b>: Active <span style=\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\"> (<a href=\"http://terminology.hl7.org/5.3.0/CodeSystem-condition-clinical.html\">Condition Clinical Status Codes</a>#active)</span></p><p><b>verificationStatus</b>: Confirmed <span style=\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\"> (<a href=\"http://terminology.hl7.org/5.3.0/CodeSystem-condition-ver-status.html\">ConditionVerificationStatus</a>#confirmed)</span></p><p><b>category</b>: Problem <span style=\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\"> (<a href=\"https://loinc.org/\">LOINC</a>#75326-9)</span></p><p><b>severity</b>: Moderate <span style=\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\"> (<a href=\"https://loinc.org/\">LOINC</a>#LA6751-7)</span></p><p><b>code</b>: Menopausal flushing (finding) <span style=\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\"> (<a href=\"https://browser.ihtsdotools.org/\">SNOMED CT</a>#198436008; <a href=\"http://terminology.hl7.org/5.3.0/CodeSystem-icd10.html\">ICD-10</a>#N95.1 &quot;Menopausal and female climacteric states&quot;)</span></p><p><b>subject</b>: <a href=\"#Patient_7685713c-e29e-4a75-8a90-45be7ba3be94\">See above (Patient/7685713c-e29e-4a75-8a90-45be7ba3be94)</a></p><p><b>onset</b>: 2015</p><p><b>recordedDate</b>: 2016-10</p></div>"
+        },
+        "identifier": [
+          {
+            "system": "urn:oid:1.2.3.999",
+            "value": "cacceb57-395f-48e1-9c88-e9c9704dc2d2"
+          }
+        ],
+        "clinicalStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
+              "code": "active"
+            }
+          ]
+        },
+        "verificationStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
+              "code": "confirmed"
+            }
+          ]
+        },
+        "category": [
+          {
+            "coding": [
+              {
+                "system": "http://loinc.org",
+                "code": "75326-9",
+                "display": "Problem"
+              }
+            ]
+          }
+        ],
+        "severity": {
+          "coding": [
+            {
+              "system": "http://loinc.org",
+              "code": "LA6751-7",
+              "display": "Moderate"
+            }
+          ]
+        },
+        "code": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "198436008",
+              "display": "Menopausal flushing (finding)",
+              "_display": {
+                "extension": [
+                  {
+                    "extension": [
+                      {
+                        "url": "lang",
+                        "valueCode": "nl-NL"
+                      },
+                      {
+                        "url": "content",
+                        "valueString": "opvliegers"
+                      }
+                    ],
+                    "url": "http://hl7.org/fhir/StructureDefinition/translation"
+                  }
+                ]
+              }
+            },
+            {
+              "system": "http://hl7.org/fhir/sid/icd-10",
+              "code": "N95.1",
+              "display": "Menopausal and female climacteric states"
+            }
+          ]
+        },
+        "subject": {
+          "reference": "Patient/7685713c-e29e-4a75-8a90-45be7ba3be94"
+        },
+        "onsetDateTime": "2015",
+        "recordedDate": "2016-10"
+      }
+    },
+    {
+      "fullUrl": "urn:uuid:6e883e5e-7648-485a-86de-3640a61601fe",
+      "resource": {
+        "resourceType": "MedicationStatement",
+        "id": "6e883e5e-7648-485a-86de-3640a61601fe",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative: MedicationStatement</b><a name=\"6e883e5e-7648-485a-86de-3640a61601fe\"> </a></p><div style=\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\"><p style=\"margin-bottom: 0px\">Resource MedicationStatement &quot;6e883e5e-7648-485a-86de-3640a61601fe&quot; </p></div><p><b>identifier</b>: id:\u00a08faf0319-89d3-427c-b9d1-e8c8fd390dca</p><p><b>status</b>: active</p><p><b>medication</b>: <a href=\"#Medication_6369a973-afc7-4617-8877-3e9811e05a5b\">See above (Medication/6369a973-afc7-4617-8877-3e9811e05a5b)</a></p><p><b>subject</b>: <a href=\"#Patient_7685713c-e29e-4a75-8a90-45be7ba3be94\">See above (Patient/7685713c-e29e-4a75-8a90-45be7ba3be94)</a></p><p><b>effective</b>: 2015-03 --&gt; (ongoing)</p><blockquote><p><b>dosage</b></p><p><b>timing</b>: Count 1 times, Once</p><p><b>route</b>: Oral use <span style=\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\"> (standardterms.edqm.eu#20053000)</span></p><blockquote><p><b>doseAndRate</b></p></blockquote></blockquote></div>"
+        },
+        "identifier": [
+          {
+            "system": "urn:oid:1.2.3.999",
+            "value": "8faf0319-89d3-427c-b9d1-e8c8fd390dca"
+          }
+        ],
+        "status": "active",
+        "medicationReference": {
+          "reference": "Medication/6369a973-afc7-4617-8877-3e9811e05a5b"
+        },
+        "subject": {
+          "reference": "Patient/7685713c-e29e-4a75-8a90-45be7ba3be94"
+        },
+        "effectivePeriod": {
+          "start": "2015-03"
+        },
+        "dosage": [
+          {
+            "timing": {
+              "repeat": {
+                "count": 1,
+                "periodUnit": "d"
+              }
+            },
+            "route": {
+              "coding": [
+                {
+                  "system": "http://standardterms.edqm.eu",
+                  "code": "20053000",
+                  "display": "Oral use"
+                }
+              ]
+            },
+            "doseAndRate": [
+              {
+                "type": {
+                  "coding": [
+                    {
+                      "system": "http://terminology.hl7.org/CodeSystem/dose-rate-type",
+                      "code": "ordered",
+                      "display": "Ordered"
+                    }
+                  ]
+                },
+                "doseQuantity": {
+                  "value": 1,
+                  "unit": "tablet",
+                  "system": "http://unitsofmeasure.org",
+                  "code": "1"
+                }
+              }
+            ]
+          }
+        ]
+      }
+    },
+    {
+      "fullUrl": "urn:uuid:6369a973-afc7-4617-8877-3e9811e05a5b",
+      "resource": {
+        "resourceType": "Medication",
+        "id": "6369a973-afc7-4617-8877-3e9811e05a5b",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative: Medication</b><a name=\"6369a973-afc7-4617-8877-3e9811e05a5b\"> </a></p><div style=\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\"><p style=\"margin-bottom: 0px\">Resource Medication &quot;6369a973-afc7-4617-8877-3e9811e05a5b&quot; </p></div><p><b>code</b>: Product containing anastrozole (medicinal product) <span style=\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\"> (<a href=\"https://browser.ihtsdotools.org/\">SNOMED CT</a>#108774000; unknown#99872 &quot;ANASTROZOL 1MG TABLET&quot;; unknown#2076667 &quot;ANASTROZOL CF TABLET FILMOMHULD 1MG&quot;; <a href=\"http://terminology.hl7.org/5.3.0/CodeSystem-v3-WC.html\">WHO ATC</a>#L02BG03 &quot;anastrozole&quot;)</span></p></div>"
+        },
+        "code": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "108774000",
+              "display": "Product containing anastrozole (medicinal product)"
+            },
+            {
+              "system": "urn:oid:2.16.840.1.113883.2.4.4.1",
+              "code": "99872",
+              "display": "ANASTROZOL 1MG TABLET"
+            },
+            {
+              "system": "urn:oid:2.16.840.1.113883.2.4.4.7",
+              "code": "2076667",
+              "display": "ANASTROZOL CF TABLET FILMOMHULD 1MG"
+            },
+            {
+              "system": "http://www.whocc.no/atc",
+              "code": "L02BG03",
+              "display": "anastrozole"
+            }
+          ]
+        }
+      }
+    },
+    {
+      "fullUrl": "urn:uuid:fe2769fd-22c9-4307-9122-ee0466e5aebb",
+      "resource": {
+        "resourceType": "AllergyIntolerance",
+        "id": "fe2769fd-22c9-4307-9122-ee0466e5aebb",
+        "text": {
+          "status": "generated",
+          "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative: AllergyIntolerance</b><a name=\"fe2769fd-22c9-4307-9122-ee0466e5aebb\"> </a></p><div style=\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\"><p style=\"margin-bottom: 0px\">Resource AllergyIntolerance &quot;fe2769fd-22c9-4307-9122-ee0466e5aebb&quot; </p></div><p><b>identifier</b>: id:\u00a08d9566a4-d26d-46be-a3e4-c9f3a0e5cd83</p><p><b>clinicalStatus</b>: Active <span style=\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\"> (<a href=\"http://terminology.hl7.org/5.3.0/CodeSystem-allergyintolerance-clinical.html\">AllergyIntolerance Clinical Status Codes</a>#active)</span></p><p><b>verificationStatus</b>: Confirmed <span style=\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\"> (<a href=\"http://terminology.hl7.org/5.3.0/CodeSystem-allergyintolerance-verification.html\">AllergyIntolerance Verification Status</a>#confirmed)</span></p><p><b>type</b>: allergy</p><p><b>category</b>: medication</p><p><b>criticality</b>: high</p><p><b>code</b>: Substance with penicillin structure and antibacterial mechanism of action (substance) <span style=\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\"> (<a href=\"https://browser.ihtsdotools.org/\">SNOMED CT</a>#373270004)</span></p><p><b>patient</b>: <a href=\"#Patient_7685713c-e29e-4a75-8a90-45be7ba3be94\">See above (Patient/7685713c-e29e-4a75-8a90-45be7ba3be94)</a></p><p><b>onset</b>: 2010</p></div>"
+        },
+        "identifier": [
+          {
+            "system": "urn:oid:1.2.3.999",
+            "value": "8d9566a4-d26d-46be-a3e4-c9f3a0e5cd83"
+          }
+        ],
+        "clinicalStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
+              "code": "active"
+            }
+          ]
+        },
+        "verificationStatus": {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
+              "code": "confirmed"
+            }
+          ]
+        },
+        "type": "allergy",
+        "category": [
+          "medication"
+        ],
+        "criticality": "high",
+        "code": {
+          "coding": [
+            {
+              "system": "http://snomed.info/sct",
+              "code": "373270004",
+              "display": "Substance with penicillin structure and antibacterial mechanism of action (substance)"
+            }
+          ]
+        },
+        "patient": {
+          "reference": "Patient/7685713c-e29e-4a75-8a90-45be7ba3be94"
+        },
+        "onsetDateTime": "2010"
+      }
+    }
+  ]
+}
\ No newline at end of file
diff --git a/http-client-tests/resources/sources/sql-on-fhir.json b/http-client-tests/resources/sources/sql-on-fhir.json
new file mode 100644
index 00000000..62e64932
--- /dev/null
+++ b/http-client-tests/resources/sources/sql-on-fhir.json
@@ -0,0 +1,38 @@
+{
+  "resourceType": "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition",
+  "select": [
+    {
+      "column": [
+        {
+          "path": "getResourceKey()",
+          "name": "patient_id"
+        }
+      ]
+    },
+    {
+      "column": [
+        {
+          "path": "line.join('\n')",
+          "name": "street",
+          "description": "The full street address, including newlines if present."
+        },
+        {
+          "path": "use",
+          "name": "use"
+        },
+        {
+          "path": "city",
+          "name": "city"
+        },
+        {
+          "path": "postalCode",
+          "name": "zip"
+        }
+      ],
+      "forEach": "address"
+    }
+  ],
+  "name": "patient_addresses",
+  "status": "draft",
+  "resource": "Patient"
+}
\ No newline at end of file
diff --git a/http-client-tests/tests/explicit-queries.http b/http-client-tests/tests/explicit-queries.http
index 0ea166a4..84dd5345 100644
--- a/http-client-tests/tests/explicit-queries.http
+++ b/http-client-tests/tests/explicit-queries.http
@@ -8,7 +8,7 @@
 
 
 ### CDA
-# Check that a request with explicit IG settings returns an expected response
+# This example is compo
 POST {{host}}/validate
 Content-Type: application/json
 
@@ -21,8 +21,12 @@ Content-Type: application/json
     import { containsIssue } from "../utilities/assertions";
     client.test("Issues are Correct", function() {
         let issues = response.body.outcomes[0].issues
+client.log("issues:" + issues.length)
+        client.assert(issues.length === 5);
+        client.assert(containsIssue(issues, 20, 24, "Binding has no source, so can''t be checked", "CODEINVALID", "INFORMATION"))
+
+        client.assert(containsIssue(issues, 251, 184, "The OID '2.16.840.1.114222.4.11.1066' is not known, so the code cant be validated", "CODEINVALID", "WARNING"))
 
-        client.assert(issues.length === 7);
     });
 %}
 
@@ -42,8 +46,10 @@ Content-Type: application/json
     client.test("Issues are Correct", function() {
         let issues = response.body.outcomes[0].issues
 
-        client.assert(issues.length === 7);
-    });
+        client.assert(issues.length === 4)
+        client.assert(containsIssue(issues, 20, 24, "Binding has no source, so can''t be checked", "CODEINVALID", "INFORMATION"))
+        client.assert(!containsIssue(issues, 251, 184, "The OID '2.16.840.1.114222.4.11.1066' is not known, so the code cant be validated", "CODEINVALID", "WARNING"))
+    })
 %}
 
 ### IPS
@@ -63,9 +69,55 @@ Content-Type: application/json
         client.assert(issues.length === 32);
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 373270004 (Substance with penicillin structure and antibacterial mechanism of action) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 108774000 (Product containing anastrozole (medicinal product)) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
+
+        client.assert(!containsIssue(issues, 314, 4, "This element does not match any known slice defined in the profile http://hl7.org.au/fhir/ips/StructureDefinition/Bundle-au-ips|0.0.1 (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL", "INFORMATION"))
+        client.assert(!containsIssue(issues, 134, 8, "This element does not match any known slice defined in the profile http://hl7.org.au/fhir/core/StructureDefinition/au-core-patient|0.3.0 (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL","INFORMATION"))
+
+    });
+%}
+
+### IPS-AU
+#
+POST {{host}}/validate
+Content-Type: application/json
+
+< ../resources/explicit-preset-requests/ips-au.json
+
+> {%
+    client.test("Validated Successfully", function() {
+        client.assert(response.status === 200, "Response status is not 201");
+    });
+    import { containsIssue } from "../utilities/assertions";
+    client.test("Issues are Correct", function() {
+        let issues = response.body.outcomes[0].issues
+        client.log("issues:" + issues.length)
+        client.assert(issues.length === 45);
+        client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 373270004 (Substance with penicillin structure and antibacterial mechanism of action) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
+        client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 108774000 (Product containing anastrozole (medicinal product)) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
+        client.assert(containsIssue(issues, 314, 4, "This element does not match any known slice defined in the profile http://hl7.org.au/fhir/ips/StructureDefinition/Bundle-au-ips|0.0.1 (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL", "INFORMATION"))
+        client.assert(containsIssue(issues, 134, 8, "This element does not match any known slice defined in the profile http://hl7.org.au/fhir/core/StructureDefinition/au-core-patient|0.3.0 (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL","INFORMATION"))
     });
 %}
 
+### IPS-NZ
+#
+POST {{host}}/validate
+Content-Type: application/json
+
+< ../resources/explicit-preset-requests/ips-nz.json
+
+> {%
+    client.test("Validated Successfully", function() {
+        client.assert(response.status === 200, "Response status is not 201");
+    });
+    import { containsIssue } from "../utilities/assertions";
+    client.test("Issues are Correct", function() {
+        let issues = response.body.outcomes[0].issues
+        client.log("issues:" + issues.length)
+        client.assert(issues.length === 98);
+        client.assert(containsIssue(issues, 12,10,"This element does not match any known slice defined in the profile https://standards.digital.health.nz/fhir/StructureDefinition/nzps-bundle|0.1.0 (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL", "INFORMATION"))
+    });
+%}
 
 ### SQL-ON-FHIR
 # Check that a request with explicit IG settings returns an expected response
diff --git a/http-client-tests/utilities/assertions.js b/http-client-tests/utilities/assertions.js
index 57e6a402..5f43feda 100644
--- a/http-client-tests/utilities/assertions.js
+++ b/http-client-tests/utilities/assertions.js
@@ -11,15 +11,16 @@
  */
 export function containsIssue(issues, line, col, message, type, level) {
     for (let index in issues) {
-
-        if (issues[index].line === line
+       if (issues[index].line === line
             && issues[index].col === col
             && issues[index].message === message
             && issues[index].type === type
             && issues[index].level === level
         ) {
+
             return true;
         }
     }
+
     return false;
 }
\ No newline at end of file

From 2af5989ef40c262c660efedea91ad2c9e5823780 Mon Sep 17 00:00:00 2001
From: "dotasek.dev" <dotasek.dev@gmail.com>
Date: Wed, 6 Mar 2024 16:34:33 -0500
Subject: [PATCH 07/22] More test cases

---
 gradle.properties                             |  2 +-
 .../resources/base-engine-requests/cda.json   | 13 +++++++++
 .../base-engine-requests/ips-au.json          | 29 +++++++++++++++++++
 .../base-engine-requests/ips-nz.json          | 29 +++++++++++++++++++
 .../resources/base-engine-requests/ips.json   | 29 +++++++++++++++++++
 .../base-engine-requests/sql-on-fhir.json     | 16 ++++++++++
 .../base-engine-requests/us-ccda.json         | 16 ++++++++++
 7 files changed, 133 insertions(+), 1 deletion(-)
 create mode 100644 http-client-tests/resources/base-engine-requests/cda.json
 create mode 100644 http-client-tests/resources/base-engine-requests/ips-au.json
 create mode 100644 http-client-tests/resources/base-engine-requests/ips-nz.json
 create mode 100644 http-client-tests/resources/base-engine-requests/ips.json
 create mode 100644 http-client-tests/resources/base-engine-requests/sql-on-fhir.json
 create mode 100644 http-client-tests/resources/base-engine-requests/us-ccda.json

diff --git a/gradle.properties b/gradle.properties
index 2d5a0907..2e1722d1 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -2,7 +2,7 @@ kotlin.code.style=official
 kotlin.js.generate.executable.default=false
 
 # versions
-fhirCoreVersion=6.2.15
+fhirCoreVersion=6.2.16-SNAPSHOT
 
 junitVersion=5.7.1
 mockk_version=1.10.2
diff --git a/http-client-tests/resources/base-engine-requests/cda.json b/http-client-tests/resources/base-engine-requests/cda.json
new file mode 100644
index 00000000..1bd1e3f6
--- /dev/null
+++ b/http-client-tests/resources/base-engine-requests/cda.json
@@ -0,0 +1,13 @@
+{
+  "cliContext": {
+
+    "locale": "en"
+  },
+  "filesToValidate": [
+    {
+      "fileName": "manually_entered_file.xml",
+      "fileContent": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<?xml-stylesheet type=\"text/xsl\" href=\"CDA.xsl\"?>\n<!--\n Title:        Care Plan\n Filename:     C-CDA_R2_Care_Plan.xml\n Created by:   Lantana Consulting Group, LLC\n \n $LastChangedDate: 2014-11-12 23:25:09 -0500 (Wed, 12 Nov 2014) $\n  \n ********************************************************\n Disclaimer: This sample file contains representative data elements to represent a Care Plan. \n The file depicts a fictional character's health data. Any resemblance to a real person is coincidental. \n To illustrate as many data elements as possible, the clinical scenario may not be plausible. \n The data in this sample file is not intended to represent real patients, people or clinical events. \n This sample is designed to be used in conjunction with the C-CDA Clinical Notes Implementation Guide.\n ********************************************************\n  -->\n<ClinicalDocument xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:hl7-org:v3\" xmlns:voc=\"urn:hl7-org:v3/voc\" xmlns:sdtc=\"urn:hl7-org:sdtc\">\n\t<!-- ** CDA Header ** -->\n\t<realmCode code=\"US\"/>\n\t<typeId root=\"2.16.840.1.113883.1.3\" extension=\"POCD_HD000040\"/>\n  <!-- US Realm Header -->\n  <templateId root=\"2.16.840.1.113883.10.20.22.1.1\" extension=\"2023-05-01\"/>\n  <!-- Care Plan -->\n\t<templateId root=\"2.16.840.1.113883.10.20.22.1.15\" extension=\"2015-08-01\"/>\n\t<id root=\"db734647-fc99-424c-a864-7e3cda82e703\"/>\n\t<code code=\"52521-2\" codeSystem=\"2.16.840.1.113883.6.1\" codeSystemName=\"LOINC\" displayName=\"Overall Plan of Care/Advance Care Directives\"/>\n\t<title>Good Health Hospital Care Plan</title>\n\t<effectiveTime value=\"201308201120-0800\"/>\n\t<confidentialityCode code=\"N\" codeSystem=\"2.16.840.1.113883.5.25\"/>\n\t<languageCode code=\"en-US\"/>\n\t<!-- This document is the second document in the set (see setId for id for the set -->\n\t<setId root=\"004bb033-b948-4f4c-b5bf-a8dbd7d8dd40\"/>\n\t<!-- See relatedDocument for the previous version in the set -->\n\t<versionNumber value=\"2\"/>\n\t<!-- Patient (recordTarget) -->\n\t<recordTarget>\n\t\t<patientRole>\n\t\t\t<id extension=\"444222222\" root=\"2.16.840.1.113883.4.1\"/>\n\t\t\t<!-- Example Social Security Number using the actual SSN OID. -->\n\t\t\t<addr use=\"HP\">\n\t\t\t\t<!-- HP is \"primary home\" from codeSystem 2.16.840.1.113883.5.1119 -->\n\t\t\t\t<streetAddressLine>2222 Home Street</streetAddressLine>\n\t\t\t\t<city>Beaverton</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>97867</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t\t<!-- US is \"United States\" from ISO 3166-1 Country Codes: 1.0.3166.1 -->\n\t\t\t</addr>\n\t\t\t<telecom value=\"tel:+1(555)555-2003\" use=\"HP\"/>\n\t\t\t<!-- HP is \"primary home\" from HL7 AddressUse 2.16.840.1.113883.5.1119 -->\n\t\t\t<patient>\n\t\t\t\t<!-- The first name element represents what the patient is known as -->\n\t\t\t\t<name use=\"L\">\n\t\t\t\t\t<given>Eve</given>\n\t\t\t\t\t<!-- The \"SP\" is \"Spouse\" from HL7 Code System EntityNamePartQualifier 2.16.840.1.113883.5.43 -->\n\t\t\t\t\t<family qualifier=\"SP\">Betterhalf</family>\n\t\t\t\t</name>\n\t\t\t\t<!-- The second name element represents another name associated with the patient -->\n\t\t\t\t<name use=\"SRCH\">\n\t\t\t\t\t<given>Eve</given>\n\t\t\t\t\t<!-- The \"BR\" is \"Birth\" from HL7 Code System EntityNamePartQualifier 2.16.840.1.113883.5.43 -->\n\t\t\t\t\t<family qualifier=\"BR\">Everywoman</family>\n\t\t\t\t</name>\n\t\t\t\t<administrativeGenderCode code=\"F\" displayName=\"Female\" codeSystem=\"2.16.840.1.113883.5.1\" codeSystemName=\"AdministrativeGender\"/>\n\t\t\t\t<!-- Date of birth need only be precise to the day -->\n\t\t\t\t<birthTime value=\"19750501\"/>\n\t\t\t\t<maritalStatusCode code=\"M\" displayName=\"Married\" codeSystem=\"2.16.840.1.113883.5.2\" codeSystemName=\"MaritalStatusCode\"/>\n\t\t\t\t<religiousAffiliationCode code=\"1013\" displayName=\"Christian (non-Catholic, non-specific)\" codeSystem=\"2.16.840.1.113883.5.1076\" codeSystemName=\"HL7 Religious Affiliation\"/>\n\t\t\t\t<!-- CDC Race and Ethnicity code set contains the five minimum race and ethnicity categories defined by OMB Standards -->\n\t\t\t\t<raceCode code=\"2106-3\" displayName=\"White\" codeSystem=\"2.16.840.1.113883.6.238\" codeSystemName=\"Race &amp; Ethnicity - CDC\"/>\n\t\t\t\t<!-- The raceCode extension is only used if raceCode is valued -->\n\t\t\t\t<sdtc:raceCode code=\"2076-8\" displayName=\"Hawaiian or Other Pacific Islander\" codeSystem=\"2.16.840.1.113883.6.238\" codeSystemName=\"Race &amp; Ethnicity - CDC\"/>\n\t\t\t\t<ethnicGroupCode code=\"2186-5\" displayName=\"Not Hispanic or Latino\" codeSystem=\"2.16.840.1.113883.6.238\" codeSystemName=\"Race &amp; Ethnicity - CDC\"/>\n\t\t\t\t<guardian>\n\t\t\t\t\t<code code=\"POWATT\" displayName=\"Power of Attorney\" codeSystem=\"2.16.840.1.113883.1.11.19830\" codeSystemName=\"ResponsibleParty\"/>\n\t\t\t\t\t<addr use=\"HP\">\n\t\t\t\t\t\t<streetAddressLine>2222 Home Street</streetAddressLine>\n\t\t\t\t\t\t<city>Beaverton</city>\n\t\t\t\t\t\t<state>OR</state>\n\t\t\t\t\t\t<postalCode>97867</postalCode>\n\t\t\t\t\t\t<country>US</country>\n\t\t\t\t\t</addr>\n\t\t\t\t\t<telecom value=\"tel:+1(555)555-2008\" use=\"MC\"/>\n\t\t\t\t\t<guardianPerson>\n\t\t\t\t\t\t<name>\n\t\t\t\t\t\t\t<given>Boris</given>\n\t\t\t\t\t\t\t<given qualifier=\"CL\">Bo</given>\n\t\t\t\t\t\t\t<family>Betterhalf</family>\n\t\t\t\t\t\t</name>\n\t\t\t\t\t</guardianPerson>\n\t\t\t\t</guardian>\n\t\t\t\t<birthplace>\n\t\t\t\t\t<place>\n\t\t\t\t\t\t<addr>\n\t\t\t\t\t\t\t<streetAddressLine>4444 Home Street</streetAddressLine>\n\t\t\t\t\t\t\t<city>Beaverton</city>\n\t\t\t\t\t\t\t<state>OR</state>\n\t\t\t\t\t\t\t<postalCode>97867</postalCode>\n\t\t\t\t\t\t\t<country>US</country>\n\t\t\t\t\t\t</addr>\n\t\t\t\t\t</place>\n\t\t\t\t</birthplace>\n\t\t\t\t<languageCommunication>\n\t\t\t\t\t<languageCode code=\"en\"/>\n\t\t\t\t\t<modeCode code=\"ESP\" displayName=\"Expressed spoken\" codeSystem=\"2.16.840.1.113883.5.60\" codeSystemName=\"LanguageAbilityMode\"/>\n\t\t\t\t\t<proficiencyLevelCode code=\"G\" displayName=\"Good\" codeSystem=\"2.16.840.1.113883.5.61\" codeSystemName=\"LanguageAbilityProficiency\"/>\n\t\t\t\t\t<!-- Patient's preferred language -->\n\t\t\t\t\t<preferenceInd value=\"true\"/>\n\t\t\t\t</languageCommunication>\n\t\t\t</patient>\n\t\t\t<providerOrganization>\n\t\t\t\t<id extension=\"219BX\" root=\"2.16.840.1.113883.4.6\"/>\n\t\t\t\t<name>The DoctorsTogether Physician Group</name>\n\t\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)555-5000\"/>\n\t\t\t\t<addr>\n\t\t\t\t\t<streetAddressLine>1007 Health Drive</streetAddressLine>\n\t\t\t\t\t<city>Portland</city>\n\t\t\t\t\t<state>OR</state>\n\t\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t\t<country>US</country>\n\t\t\t\t</addr>\n\t\t\t</providerOrganization>\n\t\t</patientRole>\n\t</recordTarget>\n\t<!-- Author -->\n\t<author>\n\t\t<time value=\"20130730\"/>\n\t\t<assignedAuthor>\n\t\t\t<id root=\"20cf14fb-b65c-4c8c-a54d-b0cca834c18c\"/>\n\t\t\t<code code=\"163W00000X\" codeSystem=\"2.16.840.1.113883.6.101\" codeSystemName=\"Healthcare Provider Taxonomy (HIPAA)\" displayName=\"Registered nurse\"/>\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>1004 Healthcare Drive </streetAddressLine>\n\t\t\t\t<city>Portland</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)555-1004\"/>\n\t\t\t<assignedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<given>Nurse</given>\n\t\t\t\t\t<family>Nightingale</family>\n\t\t\t\t\t<suffix>RN</suffix>\n\t\t\t\t</name>\n\t\t\t</assignedPerson>\n\t\t\t<representedOrganization>\n\t\t\t\t<id root=\"2.16.840.1.113883.19.5\"/>\n\t\t\t\t<name>Good Health Hospital</name>\n\t\t\t</representedOrganization>\n\t\t</assignedAuthor>\n\t</author>\n\t<!-- Data Enterer -->\n\t<dataEnterer>\n\t\t<assignedEntity>\n\t\t\t<id extension=\"333777777\" root=\"2.16.840.1.113883.4.6\"/>\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>1007 Healthcare Drive</streetAddressLine>\n\t\t\t\t<city>Portland</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)-1050\"/>\n\t\t\t<assignedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<given>Ellen</given>\n\t\t\t\t\t<family>Enter</family>\n\t\t\t\t</name>\n\t\t\t</assignedPerson>\n\t\t</assignedEntity>\n\t</dataEnterer>\n\t<!-- Informant -->\n\t<informant>\n\t\t<assignedEntity>\n\t\t\t<id extension=\"888888888\" root=\"2.16.840.1.113883.19.5\"/>\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>1007 Healthcare Drive</streetAddressLine>\n\t\t\t\t<city>Portland</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)-1003\"/>\n\t\t\t<assignedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<given>Harold</given>\n\t\t\t\t\t<family>Hippocrates</family>\n\t\t\t\t\t<suffix qualifier=\"AC\">D.O.</suffix>\n\t\t\t\t</name>\n\t\t\t</assignedPerson>\n\t\t</assignedEntity>\n\t</informant>\n\t<!-- Custodian -->\n\t<custodian>\n\t\t<assignedCustodian>\n\t\t\t<representedCustodianOrganization>\n\t\t\t\t<id extension=\"321CX\" root=\"2.16.840.1.113883.4.6\"/>\n\t\t\t\t<name>Good Health HIE</name>\n\t\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)555-1009\"/>\n\t\t\t\t<addr use=\"WP\">\n\t\t\t\t\t<streetAddressLine>1009 Healthcare Drive </streetAddressLine>\n\t\t\t\t\t<city>Portland</city>\n\t\t\t\t\t<state>OR</state>\n\t\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t\t<country>US</country>\n\t\t\t\t</addr>\n\t\t\t</representedCustodianOrganization>\n\t\t</assignedCustodian>\n\t</custodian>\n\t<informationRecipient>\n\t\t<intendedRecipient>\n\t\t\t<!-- Receiving Person Provider Id -->\n\t\t\t<id root=\"a1cd2b74-c6de-44ee-b552-3adacb7983cc\"/>\n\t\t\t<!-- Receiving Medicare/Medicaid Provider Id-->\n\t\t\t<id root=\"c72f64c2-b1db-444b-bbff-4d2e1d6bd659\"/>\n\t\t\t<!-- Receiving Person ID-->\n\t\t\t<id root=\"fa883fee-b255-4465-8fb5-1d8135e39896\"/>\n\t\t\t<!-- Receiving Person Address-->\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>100 Better Health Rd.</streetAddressLine>\n\t\t\t\t<city>Ann Arbor</city>\n\t\t\t\t<state>MI</state>\n\t\t\t\t<postalCode>97857</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<informationRecipient>\n\t\t\t\t<!-- Receiving Person Name-->\n\t\t\t\t<name>\n\t\t\t\t\t<given>Nurse</given>\n\t\t\t\t\t<family>Caresalot</family>\n\t\t\t\t\t<suffix>RN</suffix>\n\t\t\t\t</name>\n\t\t\t</informationRecipient>\n\t\t\t<receivedOrganization>\n\t\t\t\t<!-- Receiving Organization Id-->\n\t\t\t\t<id root=\"c4c416a7-aeeb-4dcc-9662-ab836ff4d265\"/>\n\t\t\t\t<!-- Receiving Organization Provider ID (NPI) -->\n\t\t\t\t<id root=\"ab47f3c4-1267-4b9e-9a29-e966b5a861c8\"/>\n\t\t\t\t<!-- Receiving Organization Name -->\n\t\t\t\t<name>Better Health Hospital</name>\n\t\t\t\t<!-- Receiving Organization Address -->\n\t\t\t\t<addr>\n\t\t\t\t\t<streetAddressLine>100 Better Health Rd.</streetAddressLine>\n\t\t\t\t\t<city>Ann Arbor</city>\n\t\t\t\t\t<state>MI</state>\n\t\t\t\t\t<postalCode>97857</postalCode>\n\t\t\t\t\t<country>US</country>\n\t\t\t\t</addr>\n\t\t\t\t<!-- Receiving Care Setting Type Description: displayName.  Receiving Care Setting Type Code: code -->\n\t\t\t\t<standardIndustryClassCode displayName=\"Long Term Care Hospital\" code=\"282E00000X\" codeSystem=\"2.16.840.1.114222.4.11.1066\" codeSystemName=\"Healthcare Provider Taxonomy (HIPAA)\"/>\n\t\t\t</receivedOrganization>\n\t\t</intendedRecipient>\n\t</informationRecipient>\n\t<!-- Legal Authenticator -->\n\t<legalAuthenticator>\n\t\t<time value=\"20130730\"/>\n\t\t<signatureCode code=\"S\"/>\n\t\t<sdtc:signatureText mediaType=\"text/xml\" representation=\"B64\">U2lnbmVkIGJ5IE51cnNlIE5pZ2h0aW5nYWxl</sdtc:signatureText>\n\t\t<assignedEntity>\n\t\t\t<id root=\"20cf14fb-b65c-4c8c-a54d-b0cca834c18c\"/>\n\t\t\t<code code=\"163W00000X\" codeSystem=\"2.16.840.1.113883.6.101\" displayName=\"Registered nurse\"/>\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>1004 Healthcare Drive </streetAddressLine>\n\t\t\t\t<city>Portland</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)555-1004\"/>\n\t\t\t<assignedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<given>Nurse</given>\n\t\t\t\t\t<family>Nightingale</family>\n\t\t\t\t\t<suffix>RN</suffix>\n\t\t\t\t</name>\n\t\t\t</assignedPerson>\n\t\t\t<representedOrganization>\n\t\t\t\t<id root=\"2.16.840.1.113883.19.5\"/>\n\t\t\t\t<name>Good Health Hospital</name>\n\t\t\t\t<!-- the orgnaization id and name -->\n\t\t\t</representedOrganization>\n\t\t</assignedEntity>\n\t</legalAuthenticator>\n\t<!-- This authenticator represents patient agreement or sign-off of the Care Plan-->\n\t<authenticator>\n\t\t<time value=\"20130802\"/>\n\t\t<signatureCode code=\"S\"/>\n\t\t<sdtc:signatureText mediaType=\"text/xml\" representation=\"B64\">U2lnbmVkIGJ5IEV2ZSBFdmVyeXdvbWFu</sdtc:signatureText>\n\t\t<assignedEntity>\n\t\t\t<id extension=\"444222222\" root=\"2.16.840.1.113883.4.1\"/>\n\t\t\t<code code=\"ONESELF\" displayName=\"Self\" codeSystem=\"2.16.840.1.113883.5.111\" codeSystemName=\"RoleCode\"/>\n\t\t\t<addr use=\"HP\">\n\t\t\t\t<!-- HP is \"primary home\" from codeSystem 2.16.840.1.113883.5.1119 -->\n\t\t\t\t<streetAddressLine>2222 Home Street</streetAddressLine>\n\t\t\t\t<city>Beaverton</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>97867</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t\t<!-- US is \"United States\" from ISO 3166-1 Country Codes: 1.0.3166.1 -->\n\t\t\t</addr>\n\t\t\t<telecom value=\"tel:+1(555)555-2003\" use=\"HP\"/>\n\t\t\t<assignedPerson>\n\t\t\t\t<name use=\"L\">\n\t\t\t\t\t<given>Eve</given>\n\t\t\t\t\t<family qualifier=\"SP\">Everywoman</family>\n\t\t\t\t</name>\n\t\t\t</assignedPerson>\n\t\t</assignedEntity>\n\t</authenticator>\n\t<!-- This participant represents the person who reviewed the Care Plan. If the date in the time element is in the past, then this review has already taken place. \n         If the date in the time element is in the future, then this is the date of the next scheduled review. -->\n\t<!-- This example shows a Care Plan Review that has already taken place -->\n\t<participant typeCode=\"VRF\">\n\t\t<functionCode code=\"425268008\" codeSystem=\"2.16.840.1.113883.6.96\" codeSystemName=\"SNOMED CT\" displayName=\"Review of Care Plan\"/>\n\t\t<time value=\"20130801\"/>\n\t\t<associatedEntity classCode=\"ASSIGNED\">\n\t\t\t<id root=\"20cf14fb-b65c-4c8c-a54d-b0cca834c18c\"/>\n      <associatedPerson nullFlavor=\"NA\" />\n\t\t</associatedEntity>\n\t</participant>\n\t<!-- This participant represents the person who reviewed the Care Plan.   If the date in the time element is in the past, then this review has already taken place. \n  If the date in the time element is in the future,  then this is the date of the next scheduled review. -->\n\t<!-- This example shows a Scheduled Care Plan Review that is in the future -->\n\t<participant typeCode=\"VRF\">\n\t\t<functionCode code=\"425268008\" codeSystem=\"2.16.840.1.113883.6.96\" codeSystemName=\"SNOMED CT\" displayName=\"Review of Care Plan\"/>\n\t\t<time value=\"20131001\"/>\n\t\t<associatedEntity classCode=\"ASSIGNED\">\n\t\t\t<id root=\"20cf14fb-b65c-4c8c-a54d-b0cca834c18c\"/>\n\t\t\t<code code=\"SELF\" displayName=\"self\" codeSystem=\"2.16.840.1.113883.5.111\"/>\n      <associatedPerson nullFlavor=\"NA\" />\n\t\t</associatedEntity>\n\t</participant>\n\t<!-- This participant identifies individuals who support the patient such as a relative or caregiver -->\n\t<participant typeCode=\"IND\">\n\t\t<!-- Emergency Contact  -->\n\t\t<associatedEntity classCode=\"ECON\">\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>17 Daws Rd.</streetAddressLine>\n\t\t\t\t<city>Ann Arbor</city>\n\t\t\t\t<state>MI</state>\n\t\t\t\t<postalCode>97857</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom value=\"tel:(999)555-1212\" use=\"WP\"/>\n\t\t\t<associatedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<prefix>Mrs.</prefix>\n\t\t\t\t\t<given>Martha</given>\n\t\t\t\t\t<family>Jones</family>\n\t\t\t\t</name>\n\t\t\t</associatedPerson>\n\t\t</associatedEntity>\n\t</participant>\n\t<!-- This participant identifies individuals who support the patient such as a relative or caregiver -->\n\t<participant typeCode=\"IND\">\n\t\t<!-- Caregiver -->\n\t\t<associatedEntity classCode=\"CAREGIVER\">\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>17 Daws Rd.</streetAddressLine>\n\t\t\t\t<city>Ann Arbor</city>\n\t\t\t\t<state>MI</state>\n\t\t\t\t<postalCode>97857</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom value=\"tel:(999)555-1212\" use=\"WP\"/>\n\t\t\t<associatedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<prefix>Mrs.</prefix>\n\t\t\t\t\t<given>Martha</given>\n\t\t\t\t\t<family>Jones</family>\n\t\t\t\t</name>\n\t\t\t</associatedPerson>\n\t\t</associatedEntity>\n\t</participant>\n\t<documentationOf>\n\t\t<serviceEvent classCode=\"PCPR\">\n\t\t\t<effectiveTime>\n\t\t\t\t<low value=\"20130720\"/>\n\t\t\t\t<high value=\"20130815\"/>\n\t\t\t</effectiveTime>\n\t\t\t<!-- The performer(s) represents the healthcare providers involved in the current or historical care of the patient.\n                The patient’s key healthcare providers would be listed here which would include the primary physician and any \n                active consulting physicians, therapists, counselors, and care team members.  -->\n\t\t\t<performer typeCode=\"PRF\">\n\t\t\t\t<time value=\"20130715223615-0800\"/>\n\t\t\t\t<assignedEntity>\n\t\t\t\t\t<id extension=\"5555555555\" root=\"2.16.840.1.113883.4.6\"/>\n\t\t\t\t\t<code code=\"207QA0505X\" displayName=\"Adult Medicine\" codeSystem=\"2.16.840.1.113883.6.101\" codeSystemName=\"Healthcare Provider Taxonomy (HIPAA)\"/>\n\t\t\t\t\t<addr>\n\t\t\t\t\t\t<streetAddressLine>1004 Healthcare Drive </streetAddressLine>\n\t\t\t\t\t\t<city>Portland</city>\n\t\t\t\t\t\t<state>OR</state>\n\t\t\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t\t\t<country>US</country>\n\t\t\t\t\t</addr>\n\t\t\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)-1004\"/>\n\t\t\t\t\t<assignedPerson>\n\t\t\t\t\t\t<name>\n\t\t\t\t\t\t\t<given>Patricia</given>\n\t\t\t\t\t\t\t<given qualifier=\"CL\">Patty</given>\n\t\t\t\t\t\t\t<family>Primary</family>\n\t\t\t\t\t\t\t<suffix qualifier=\"AC\">M.D.</suffix>\n\t\t\t\t\t\t</name>\n\t\t\t\t\t</assignedPerson>\n\t\t\t\t</assignedEntity>\n\t\t\t</performer>\n\t\t</serviceEvent>\n\t</documentationOf>\n\t<!-- The Care Plan is continually evolving and dynamic. The Care Plan CDA instance \n     is NOT dynamic. Each time a Care Plan CDA is generated it represents a snapshot \n     in time of the Care Plan at that moment. Whenever a care provider or patient \n     generates a Care Plan, it should be noted through relatedDocument \n     whether the current Care Plan replaces or appends another Care Plan. \n     The relatedDocumentTypeCode indicates whether the current document is \n     an addendum to the ParentDocument (APND (append)) or the current document \n     is a replacement of the ParentDocument (RPLC (replace)). -->\n\t<!-- This document is the second in a set - relatedDocument\n      describes the parent document-->\n\t<relatedDocument typeCode=\"RPLC\">\n\t\t<parentDocument>\n\t\t\t<id root=\"223769be-f6ee-4b04-a0ce-b56ae998c880\"/>\n\t\t\t<code code=\"CarePlan-x\" codeSystem=\"2.16.840.1.113883.6.1\" codeSystemName=\"LOINC\" displayName=\"Care Plan\"/>\n\t\t\t<setId root=\"004bb033-b948-4f4c-b5bf-a8dbd7d8dd40\"/>\n\t\t\t<versionNumber value=\"1\"/>\n\t\t</parentDocument>\n\t</relatedDocument>\n\t<componentOf>\n\t\t<encompassingEncounter>\n\t\t\t<id extension=\"9937012\" root=\"2.16.840.1.113883.19\"/>\n\t\t\t<code codeSystem=\"2.16.840.1.113883.5.4\" code=\"IMP\" displayName=\"Inpatient\"/>\n\t\t\t<!-- captures that this is an inpatient encounter -->\n\t\t\t<effectiveTime>\n\t\t\t\t<low value=\"20130615\"/>\n\t\t\t\t<!-- No high value - this patient is still in hospital -->\n\t\t\t</effectiveTime>\n\t\t</encompassingEncounter>\n\t</componentOf>\n\t<!-- \n********************************************************\nCDA Body\n********************************************************\n-->\n\t<component>\n    <structuredBody>\n\t\t<!-- ***************** PROBLEM LIST *********************** -->\n\t\t<component>\n\t\t\t<!-- nullFlavor of NI indicates No Information.-->\n\t\t\t<!-- Note this pattern may not validate with schematron but has been SDWG approved -->\n\t\t\t<section nullFlavor=\"NI\">\n\t\t\t\t<!-- conforms to Problems section with entries required -->\n\t\t\t\t<templateId root=\"2.16.840.1.113883.10.20.22.2.5.1\" extension=\"2014-06-09\"/>\n\t\t\t\t<code code=\"11450-4\" codeSystem=\"2.16.840.1.113883.6.1\" codeSystemName=\"LOINC\" displayName=\"PROBLEM LIST\"/>\n\t\t\t\t<title>PROBLEMS</title>\n\t\t\t\t<text>No Information</text>\n\t\t\t</section>\n\t\t</component>\n    </structuredBody>\n\t</component>\n</ClinicalDocument>",
+      "fileType": null
+    }
+  ]
+}
\ No newline at end of file
diff --git a/http-client-tests/resources/base-engine-requests/ips-au.json b/http-client-tests/resources/base-engine-requests/ips-au.json
new file mode 100644
index 00000000..31b0f152
--- /dev/null
+++ b/http-client-tests/resources/base-engine-requests/ips-au.json
@@ -0,0 +1,29 @@
+{
+  "cliContext": {
+    "extensions": [
+      "any"
+    ],
+    "sv": "4.0.1",
+    "igs": [
+      "hl7.fhir.au.ips#current"
+    ],
+    "profiles": [
+      "http://hl7.org.au/fhir/ips/StructureDefinition/Bundle-au-ips"
+    ],
+    "checkIPSCodes": true,
+    "bundleValidationRules": [
+      {
+        "rule": "Composition:0",
+        "profile": "http://hl7.org.au/fhir/ips/StructureDefinition/Composition-au-ips"
+      }
+    ],
+    "locale": "en"
+  },
+  "filesToValidate": [
+    {
+      "fileName": "manually_entered_file.json",
+      "fileContent": "{\n  \"resourceType\" : \"Bundle\",\n  \"id\" : \"bundle-minimal\",\n  \"language\" : \"en-US\",\n  \"identifier\" : {\n    \"system\" : \"urn:oid:2.16.724.4.8.10.200.10\",\n    \"value\" : \"28b95815-76ce-457b-b7ae-a972e527db40\"\n  },\n  \"type\" : \"document\",\n  \"timestamp\" : \"2020-12-11T14:30:00+01:00\",\n  \"entry\" : [{\n    \"fullUrl\" : \"urn:uuid:6e1fb74a-742b-4c7b-8487-171dacb88766\",\n    \"resource\" : {\n      \"resourceType\" : \"Composition\",\n      \"id\" : \"6e1fb74a-742b-4c7b-8487-171dacb88766\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative</b></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource \\\"6e1fb74a-742b-4c7b-8487-171dacb88766\\\" </p></div><p><b>status</b>: final</p><p><b>type</b>: Patient summary Document <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://loinc.org/\\\">LOINC</a>#60591-5)</span></p><p><b>date</b>: 2020-12-11 02:30:00+0100</p><p><b>author</b>: Beetje van Hulp, MD </p><p><b>title</b>: Patient Summary as of December 11, 2020 14:30</p><p><b>confidentiality</b>: N</p><blockquote><p><b>attester</b></p><p><b>mode</b>: legal</p><p><b>time</b>: 2020-12-11 02:30:00+0100</p><p><b>party</b>: Beetje van Hulp, MD </p></blockquote><blockquote><p><b>attester</b></p><p><b>mode</b>: legal</p><p><b>time</b>: 2020-12-11 02:30:00+0100</p><p><b>party</b>: Anorg Aniza Tion BV </p></blockquote><p><b>custodian</b>: Anorg Aniza Tion BV</p><h3>RelatesTos</h3><table class=\\\"grid\\\"><tr><td>-</td><td><b>Code</b></td><td><b>Target[x]</b></td></tr><tr><td>*</td><td>appends</td><td>id: 20e12ce3-857f-49c0-b888-cb670597f191</td></tr></table><h3>Events</h3><table class=\\\"grid\\\"><tr><td>-</td><td><b>Code</b></td><td><b>Period</b></td></tr><tr><td>*</td><td>care provision <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/CodeSystem/v3-ActClass\\\">ActClass</a>#PCPR)</span></td><td>?? --&gt; 2020-12-11 02:30:00+0100</td></tr></table></div>\"\n      },\n      \"status\" : \"final\",\n      \"type\" : {\n        \"coding\" : [{\n          \"system\" : \"http://loinc.org\",\n          \"code\" : \"60591-5\",\n          \"display\" : \"Patient summary Document\"\n        }]\n      },\n      \"subject\" : {\n        \"reference\" : \"Patient/7685713c-e29e-4a75-8a90-45be7ba3be94\"\n      },\n      \"date\" : \"2020-12-11T14:30:00+01:00\",\n      \"author\" : [{\n        \"reference\" : \"Practitioner/98315ba9-ffea-41ef-b59b-a836c039858f\"\n      }],\n      \"title\" : \"Patient Summary as of December 11, 2020 14:30\",\n      \"confidentiality\" : \"N\",\n      \"attester\" : [{\n        \"mode\" : \"legal\",\n        \"time\" : \"2020-12-11T14:30:00+01:00\",\n        \"party\" : {\n          \"reference\" : \"Practitioner/98315ba9-ffea-41ef-b59b-a836c039858f\"\n        }\n      },\n      {\n        \"mode\" : \"legal\",\n        \"time\" : \"2020-12-11T14:30:00+01:00\",\n        \"party\" : {\n          \"reference\" : \"Organization/bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d\"\n        }\n      }],\n      \"custodian\" : {\n        \"reference\" : \"Organization/bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d\"\n      },\n      \"relatesTo\" : [{\n        \"code\" : \"appends\",\n        \"targetIdentifier\" : {\n          \"system\" : \"urn:oid:2.16.724.4.8.10.200.10\",\n          \"value\" : \"20e12ce3-857f-49c0-b888-cb670597f191\"\n        }\n      }],\n      \"event\" : [{\n        \"code\" : [{\n          \"coding\" : [{\n            \"system\" : \"http://terminology.hl7.org/CodeSystem/v3-ActClass\",\n            \"code\" : \"PCPR\"\n          }]\n        }],\n        \"period\" : {\n          \"end\" : \"2020-12-11T14:30:00+01:00\"\n        }\n      }],\n      \"section\" : [{\n        \"title\" : \"Active Problems\",\n        \"code\" : {\n          \"coding\" : [{\n            \"system\" : \"http://loinc.org\",\n            \"code\" : \"11450-4\",\n            \"display\" : \"Problem list Reported\"\n          }]\n        },\n        \"text\" : {\n          \"status\" : \"generated\",\n          \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><ul><li><div><b>Condition Name</b>: Menopausal Flushing</div><div><b>Code</b>: <span>198436008</span></div><div><b>Status</b>: <span>Active</span></div></li></ul></div>\"\n        },\n        \"entry\" : [{\n          \"reference\" : \"Condition/ad84b7a2-b4dd-474e-bef3-0779e6cb595f\"\n        }]\n      },\n      {\n        \"title\" : \"Medication\",\n        \"code\" : {\n          \"coding\" : [{\n            \"system\" : \"http://loinc.org\",\n            \"code\" : \"10160-0\",\n            \"display\" : \"History of Medication use Narrative\"\n          }]\n        },\n        \"text\" : {\n          \"status\" : \"generated\",\n          \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><ul><li><div><b>Medication Name</b>: Oral anastrozole 1mg tablet</div><div><b>Code</b>: <span></span></div><div><b>Status</b>: <span>Active, started March 2015</span></div><div>Instructions: Take 1 time per day</div></li></ul></div>\"\n        },\n        \"entry\" : [{\n          \"reference\" : \"MedicationStatement/6e883e5e-7648-485a-86de-3640a61601fe\"\n        }]\n      },\n      {\n        \"title\" : \"Allergies and Intolerances\",\n        \"code\" : {\n          \"coding\" : [{\n            \"system\" : \"http://loinc.org\",\n            \"code\" : \"48765-2\",\n            \"display\" : \"Allergies and adverse reactions Document\"\n          }]\n        },\n        \"text\" : {\n          \"status\" : \"generated\",\n          \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><ul><li><div><b>Allergy Name</b>: Pencillins</div><div><b>Verification Status</b>: Confirmed</div><div><b>Reaction</b>: <span>no information</span></div></li></ul></div>\"\n        },\n        \"entry\" : [{\n          \"reference\" : \"AllergyIntolerance/fe2769fd-22c9-4307-9122-ee0466e5aebb\"\n        }]\n      }]\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:7685713c-e29e-4a75-8a90-45be7ba3be94\",\n    \"resource\" : {\n      \"resourceType\" : \"Patient\",\n      \"id\" : \"7685713c-e29e-4a75-8a90-45be7ba3be94\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: Patient</b><a name=\\\"7685713c-e29e-4a75-8a90-45be7ba3be94\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource Patient &quot;7685713c-e29e-4a75-8a90-45be7ba3be94&quot; </p></div><p><b>identifier</b>: id:\\u00a0574687583</p><p><b>active</b>: true</p><p><b>name</b>: Martha DeLarosa </p><p><b>telecom</b>: <a href=\\\"tel:+31788700800\\\">+31788700800</a></p><p><b>gender</b>: female</p><p><b>birthDate</b>: 1972-05-01</p><p><b>address</b>: Laan Van Europa 1600 Dordrecht 3317 DB NL </p><h3>Contacts</h3><table class=\\\"grid\\\"><tr><td style=\\\"display: none\\\">-</td><td><b>Relationship</b></td><td><b>Name</b></td><td><b>Telecom</b></td><td><b>Address</b></td></tr><tr><td style=\\\"display: none\\\">*</td><td>mother <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-v3-RoleCode.html\\\">RoleCode</a>#MTH)</span></td><td>Martha Mum </td><td><a href=\\\"tel:+33-555-20036\\\">+33-555-20036</a></td><td>Promenade des Anglais 111 Lyon 69001 FR </td></tr></table></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:2.16.840.1.113883.2.4.6.3\",\n        \"value\" : \"574687583\"\n      }],\n      \"active\" : true,\n      \"name\" : [{\n        \"family\" : \"DeLarosa\",\n        \"given\" : [\"Martha\"]\n      }],\n      \"telecom\" : [{\n        \"system\" : \"phone\",\n        \"value\" : \"+31788700800\",\n        \"use\" : \"home\"\n      }],\n      \"gender\" : \"female\",\n      \"birthDate\" : \"1972-05-01\",\n      \"address\" : [{\n        \"line\" : [\"Laan Van Europa 1600\"],\n        \"city\" : \"Dordrecht\",\n        \"postalCode\" : \"3317 DB\",\n        \"country\" : \"NL\"\n      }],\n      \"contact\" : [{\n        \"relationship\" : [{\n          \"coding\" : [{\n            \"system\" : \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n            \"code\" : \"MTH\"\n          }]\n        }],\n        \"name\" : {\n          \"family\" : \"Mum\",\n          \"given\" : [\"Martha\"]\n        },\n        \"telecom\" : [{\n          \"system\" : \"phone\",\n          \"value\" : \"+33-555-20036\",\n          \"use\" : \"home\"\n        }],\n        \"address\" : {\n          \"line\" : [\"Promenade des Anglais 111\"],\n          \"city\" : \"Lyon\",\n          \"postalCode\" : \"69001\",\n          \"country\" : \"FR\"\n        }\n      }]\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:98315ba9-ffea-41ef-b59b-a836c039858f\",\n    \"resource\" : {\n      \"resourceType\" : \"Practitioner\",\n      \"id\" : \"98315ba9-ffea-41ef-b59b-a836c039858f\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: Practitioner</b><a name=\\\"98315ba9-ffea-41ef-b59b-a836c039858f\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource Practitioner &quot;98315ba9-ffea-41ef-b59b-a836c039858f&quot; </p></div><p><b>identifier</b>: id:\\u00a0129854633</p><p><b>active</b>: true</p><p><b>name</b>: Beetje van Hulp </p><h3>Qualifications</h3><table class=\\\"grid\\\"><tr><td style=\\\"display: none\\\">-</td><td><b>Code</b></td></tr><tr><td style=\\\"display: none\\\">*</td><td>Doctor of Medicine <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (degreeLicenseCertificate[2.7]#MD)</span></td></tr></table></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:2.16.528.1.1007.3.1\",\n        \"value\" : \"129854633\",\n        \"assigner\" : {\n          \"display\" : \"CIBG\"\n        }\n      }],\n      \"active\" : true,\n      \"name\" : [{\n        \"family\" : \"van Hulp\",\n        \"given\" : [\"Beetje\"]\n      }],\n      \"qualification\" : [{\n        \"code\" : {\n          \"coding\" : [{\n            \"system\" : \"http://terminology.hl7.org/CodeSystem/v2-0360\",\n            \"version\" : \"2.7\",\n            \"code\" : \"MD\",\n            \"display\" : \"Doctor of Medicine\"\n          }]\n        }\n      }]\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d\",\n    \"resource\" : {\n      \"resourceType\" : \"Organization\",\n      \"id\" : \"bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: Organization</b><a name=\\\"bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource Organization &quot;bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d&quot; </p></div><p><b>identifier</b>: id:\\u00a0564738757</p><p><b>active</b>: true</p><p><b>name</b>: Anorg Aniza Tion BV / The best custodian ever</p><p><b>telecom</b>: <a href=\\\"tel:+31-51-34343400\\\">+31-51-34343400</a></p><p><b>address</b>: Houttuinen 27 Dordrecht 3311 CE NL (WORK)</p></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:2.16.528.1.1007.3.3\",\n        \"value\" : \"564738757\"\n      }],\n      \"active\" : true,\n      \"name\" : \"Anorg Aniza Tion BV / The best custodian ever\",\n      \"telecom\" : [{\n        \"system\" : \"phone\",\n        \"value\" : \"+31-51-34343400\",\n        \"use\" : \"work\"\n      }],\n      \"address\" : [{\n        \"use\" : \"work\",\n        \"line\" : [\"Houttuinen 27\"],\n        \"city\" : \"Dordrecht\",\n        \"postalCode\" : \"3311 CE\",\n        \"country\" : \"NL\"\n      }]\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:ad84b7a2-b4dd-474e-bef3-0779e6cb595f\",\n    \"resource\" : {\n      \"resourceType\" : \"Condition\",\n      \"id\" : \"ad84b7a2-b4dd-474e-bef3-0779e6cb595f\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: Condition</b><a name=\\\"ad84b7a2-b4dd-474e-bef3-0779e6cb595f\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource Condition &quot;ad84b7a2-b4dd-474e-bef3-0779e6cb595f&quot; </p></div><p><b>identifier</b>: id:\\u00a0cacceb57-395f-48e1-9c88-e9c9704dc2d2</p><p><b>clinicalStatus</b>: Active <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-condition-clinical.html\\\">Condition Clinical Status Codes</a>#active)</span></p><p><b>verificationStatus</b>: Confirmed <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-condition-ver-status.html\\\">ConditionVerificationStatus</a>#confirmed)</span></p><p><b>category</b>: Problem <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://loinc.org/\\\">LOINC</a>#75326-9)</span></p><p><b>severity</b>: Moderate <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://loinc.org/\\\">LOINC</a>#LA6751-7)</span></p><p><b>code</b>: Menopausal flushing (finding) <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://browser.ihtsdotools.org/\\\">SNOMED CT</a>#198436008; <a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-icd10.html\\\">ICD-10</a>#N95.1 &quot;Menopausal and female climacteric states&quot;)</span></p><p><b>subject</b>: <a href=\\\"#Patient_7685713c-e29e-4a75-8a90-45be7ba3be94\\\">See above (Patient/7685713c-e29e-4a75-8a90-45be7ba3be94)</a></p><p><b>onset</b>: 2015</p><p><b>recordedDate</b>: 2016-10</p></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:1.2.3.999\",\n        \"value\" : \"cacceb57-395f-48e1-9c88-e9c9704dc2d2\"\n      }],\n      \"clinicalStatus\" : {\n        \"coding\" : [{\n          \"system\" : \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n          \"code\" : \"active\"\n        }]\n      },\n      \"verificationStatus\" : {\n        \"coding\" : [{\n          \"system\" : \"http://terminology.hl7.org/CodeSystem/condition-ver-status\",\n          \"code\" : \"confirmed\"\n        }]\n      },\n      \"category\" : [{\n        \"coding\" : [{\n          \"system\" : \"http://loinc.org\",\n          \"code\" : \"75326-9\",\n          \"display\" : \"Problem\"\n        }]\n      }],\n      \"severity\" : {\n        \"coding\" : [{\n          \"system\" : \"http://loinc.org\",\n          \"code\" : \"LA6751-7\",\n          \"display\" : \"Moderate\"\n        }]\n      },\n      \"code\" : {\n        \"coding\" : [{\n          \"system\" : \"http://snomed.info/sct\",\n          \"code\" : \"198436008\",\n          \"display\" : \"Menopausal flushing (finding)\",\n          \"_display\" : {\n            \"extension\" : [{\n              \"extension\" : [{\n                \"url\" : \"lang\",\n                \"valueCode\" : \"nl-NL\"\n              },\n              {\n                \"url\" : \"content\",\n                \"valueString\" : \"opvliegers\"\n              }],\n              \"url\" : \"http://hl7.org/fhir/StructureDefinition/translation\"\n            }]\n          }\n        },\n        {\n          \"system\" : \"http://hl7.org/fhir/sid/icd-10\",\n          \"code\" : \"N95.1\",\n          \"display\" : \"Menopausal and female climacteric states\"\n        }]\n      },\n      \"subject\" : {\n        \"reference\" : \"Patient/7685713c-e29e-4a75-8a90-45be7ba3be94\"\n      },\n      \"onsetDateTime\" : \"2015\",\n      \"recordedDate\" : \"2016-10\"\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:6e883e5e-7648-485a-86de-3640a61601fe\",\n    \"resource\" : {\n      \"resourceType\" : \"MedicationStatement\",\n      \"id\" : \"6e883e5e-7648-485a-86de-3640a61601fe\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: MedicationStatement</b><a name=\\\"6e883e5e-7648-485a-86de-3640a61601fe\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource MedicationStatement &quot;6e883e5e-7648-485a-86de-3640a61601fe&quot; </p></div><p><b>identifier</b>: id:\\u00a08faf0319-89d3-427c-b9d1-e8c8fd390dca</p><p><b>status</b>: active</p><p><b>medication</b>: <a href=\\\"#Medication_6369a973-afc7-4617-8877-3e9811e05a5b\\\">See above (Medication/6369a973-afc7-4617-8877-3e9811e05a5b)</a></p><p><b>subject</b>: <a href=\\\"#Patient_7685713c-e29e-4a75-8a90-45be7ba3be94\\\">See above (Patient/7685713c-e29e-4a75-8a90-45be7ba3be94)</a></p><p><b>effective</b>: 2015-03 --&gt; (ongoing)</p><blockquote><p><b>dosage</b></p><p><b>timing</b>: Count 1 times, Once</p><p><b>route</b>: Oral use <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (standardterms.edqm.eu#20053000)</span></p><blockquote><p><b>doseAndRate</b></p></blockquote></blockquote></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:1.2.3.999\",\n        \"value\" : \"8faf0319-89d3-427c-b9d1-e8c8fd390dca\"\n      }],\n      \"status\" : \"active\",\n      \"medicationReference\" : {\n        \"reference\" : \"Medication/6369a973-afc7-4617-8877-3e9811e05a5b\"\n      },\n      \"subject\" : {\n        \"reference\" : \"Patient/7685713c-e29e-4a75-8a90-45be7ba3be94\"\n      },\n      \"effectivePeriod\" : {\n        \"start\" : \"2015-03\"\n      },\n      \"dosage\" : [{\n        \"timing\" : {\n          \"repeat\" : {\n            \"count\" : 1,\n            \"periodUnit\" : \"d\"\n          }\n        },\n        \"route\" : {\n          \"coding\" : [{\n            \"system\" : \"http://standardterms.edqm.eu\",\n            \"code\" : \"20053000\",\n            \"display\" : \"Oral use\"\n          }]\n        },\n        \"doseAndRate\" : [{\n          \"type\" : {\n            \"coding\" : [{\n              \"system\" : \"http://terminology.hl7.org/CodeSystem/dose-rate-type\",\n              \"code\" : \"ordered\",\n              \"display\" : \"Ordered\"\n            }]\n          },\n          \"doseQuantity\" : {\n            \"value\" : 1,\n            \"unit\" : \"tablet\",\n            \"system\" : \"http://unitsofmeasure.org\",\n            \"code\" : \"1\"\n          }\n        }]\n      }]\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:6369a973-afc7-4617-8877-3e9811e05a5b\",\n    \"resource\" : {\n      \"resourceType\" : \"Medication\",\n      \"id\" : \"6369a973-afc7-4617-8877-3e9811e05a5b\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: Medication</b><a name=\\\"6369a973-afc7-4617-8877-3e9811e05a5b\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource Medication &quot;6369a973-afc7-4617-8877-3e9811e05a5b&quot; </p></div><p><b>code</b>: Product containing anastrozole (medicinal product) <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://browser.ihtsdotools.org/\\\">SNOMED CT</a>#108774000; unknown#99872 &quot;ANASTROZOL 1MG TABLET&quot;; unknown#2076667 &quot;ANASTROZOL CF TABLET FILMOMHULD 1MG&quot;; <a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-v3-WC.html\\\">WHO ATC</a>#L02BG03 &quot;anastrozole&quot;)</span></p></div>\"\n      },\n      \"code\" : {\n        \"coding\" : [{\n          \"system\" : \"http://snomed.info/sct\",\n          \"code\" : \"108774000\",\n          \"display\" : \"Product containing anastrozole (medicinal product)\"\n        },\n        {\n          \"system\" : \"urn:oid:2.16.840.1.113883.2.4.4.1\",\n          \"code\" : \"99872\",\n          \"display\" : \"ANASTROZOL 1MG TABLET\"\n        },\n        {\n          \"system\" : \"urn:oid:2.16.840.1.113883.2.4.4.7\",\n          \"code\" : \"2076667\",\n          \"display\" : \"ANASTROZOL CF TABLET FILMOMHULD 1MG\"\n        },\n        {\n          \"system\" : \"http://www.whocc.no/atc\",\n          \"code\" : \"L02BG03\",\n          \"display\" : \"anastrozole\"\n        }]\n      }\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:fe2769fd-22c9-4307-9122-ee0466e5aebb\",\n    \"resource\" : {\n      \"resourceType\" : \"AllergyIntolerance\",\n      \"id\" : \"fe2769fd-22c9-4307-9122-ee0466e5aebb\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: AllergyIntolerance</b><a name=\\\"fe2769fd-22c9-4307-9122-ee0466e5aebb\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource AllergyIntolerance &quot;fe2769fd-22c9-4307-9122-ee0466e5aebb&quot; </p></div><p><b>identifier</b>: id:\\u00a08d9566a4-d26d-46be-a3e4-c9f3a0e5cd83</p><p><b>clinicalStatus</b>: Active <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-allergyintolerance-clinical.html\\\">AllergyIntolerance Clinical Status Codes</a>#active)</span></p><p><b>verificationStatus</b>: Confirmed <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-allergyintolerance-verification.html\\\">AllergyIntolerance Verification Status</a>#confirmed)</span></p><p><b>type</b>: allergy</p><p><b>category</b>: medication</p><p><b>criticality</b>: high</p><p><b>code</b>: Substance with penicillin structure and antibacterial mechanism of action (substance) <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://browser.ihtsdotools.org/\\\">SNOMED CT</a>#373270004)</span></p><p><b>patient</b>: <a href=\\\"#Patient_7685713c-e29e-4a75-8a90-45be7ba3be94\\\">See above (Patient/7685713c-e29e-4a75-8a90-45be7ba3be94)</a></p><p><b>onset</b>: 2010</p></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:1.2.3.999\",\n        \"value\" : \"8d9566a4-d26d-46be-a3e4-c9f3a0e5cd83\"\n      }],\n      \"clinicalStatus\" : {\n        \"coding\" : [{\n          \"system\" : \"http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical\",\n          \"code\" : \"active\"\n        }]\n      },\n      \"verificationStatus\" : {\n        \"coding\" : [{\n          \"system\" : \"http://terminology.hl7.org/CodeSystem/allergyintolerance-verification\",\n          \"code\" : \"confirmed\"\n        }]\n      },\n      \"type\" : \"allergy\",\n      \"category\" : [\"medication\"],\n      \"criticality\" : \"high\",\n      \"code\" : {\n        \"coding\" : [{\n          \"system\" : \"http://snomed.info/sct\",\n          \"code\" : \"373270004\",\n          \"display\" : \"Substance with penicillin structure and antibacterial mechanism of action (substance)\"\n        }]\n      },\n      \"patient\" : {\n        \"reference\" : \"Patient/7685713c-e29e-4a75-8a90-45be7ba3be94\"\n      },\n      \"onsetDateTime\" : \"2010\"\n    }\n  }]\n}",
+      "fileType": null
+    }
+  ]
+}
\ No newline at end of file
diff --git a/http-client-tests/resources/base-engine-requests/ips-nz.json b/http-client-tests/resources/base-engine-requests/ips-nz.json
new file mode 100644
index 00000000..12c4420e
--- /dev/null
+++ b/http-client-tests/resources/base-engine-requests/ips-nz.json
@@ -0,0 +1,29 @@
+{
+  "cliContext": {
+    "extensions": [
+      "any"
+    ],
+    "sv": "4.0.1",
+    "igs": [
+      "tewhatuora.fhir.nzps#current"
+    ],
+    "profiles": [
+      "https://standards.digital.health.nz/fhir/StructureDefinition/nzps-bundle"
+    ],
+    "checkIPSCodes": true,
+    "bundleValidationRules": [
+      {
+        "rule": "Composition:0",
+        "profile": "https://standards.digital.health.nz/fhir/StructureDefinition/nzps-composition"
+      }
+    ],
+    "locale": "en"
+  },
+  "filesToValidate": [
+    {
+      "fileName": "manually_entered_file.json",
+      "fileContent": "{\n    \"resourceType\": \"Bundle\",\n    \"id\": \"NZ-IPS-20231121031219\",\n    \"language\": \"en-NZ\",\n    \"identifier\": {\n        \"system\": \"urn:oid:2.16.724.4.8.10.200.10\",\n        \"value\": \"3d5006e9-f003-4a78-a253-40ab405b7ef2\"\n    },\n    \"type\": \"document\",\n    \"timestamp\": \"2023-11-21T03:12:19.1242772+00:00\",\n    \"entry\": [\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Composition/9b9e4f64-c976-47e9-a8a5-4b9b0484a709\",\n            \"resource\": {\n                \"resourceType\": \"Composition\",\n                \"id\": \"9b9e4f64-c976-47e9-a8a5-4b9b0484a709\",\n                \"meta\": {\n                    \"versionId\": \"1\"\n                },\n                \"language\": \"en-NZ\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' lang='en-NZ' xml:lang='en-NZ'>International Patient Summary for Iosefa Test-Fuimaono</div>\"\n                },\n                \"identifier\": {\n                    \"system\": \"urn:oid:2.16.840.1.113883.2.18.7.2\",\n                    \"value\": \"3d5006e9-f003-4a78-a253-40ab405b7ef2\"\n                },\n                \"status\": \"final\",\n                \"type\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"60591-5\",\n                            \"display\": \"Patient summary Document\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"date\": \"2023-11-21\",\n                \"author\": [\n                    {\n                        \"reference\": \"Organization/9c9542df-e45f-4131-9d44-8f5974e56d5b\"\n                    }\n                ],\n                \"title\": \"International Patient Summary\",\n                \"confidentiality\": \"N\",\n                \"attester\": [\n                    {\n                        \"mode\": \"professional\",\n                        \"time\": \"2023-11-21\",\n                        \"party\": {\n                            \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                        }\n                    }\n                ],\n                \"custodian\": {\n                    \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                },\n                \"relatesTo\": [\n                    {\n                        \"code\": \"transforms\",\n                        \"targetIdentifier\": {\n                            \"system\": \"urn:oid:2.16.840.1.113883.2.18.7.2\",\n                            \"value\": \"3d5006e9-f003-4a78-a253-40ab405b7ef2\"\n                        }\n                    }\n                ],\n                \"event\": [\n                    {\n                        \"code\": [\n                            {\n                                \"coding\": [\n                                    {\n                                        \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActClass\",\n                                        \"code\": \"PCPR\"\n                                    }\n                                ]\n                            }\n                        ],\n                        \"period\": {\n                            \"end\": \"2023-11-21\"\n                        }\n                    }\n                ],\n                \"section\": [\n                    {\n                        \"title\": \"Allergies and Intolerances\",\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"48765-2\",\n                                    \"display\": \"Allergies and adverse reactions Document\"\n                                }\n                            ]\n                        },\n                        \"text\": {\n                            \"status\": \"generated\",\n                            \"div\": \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\\r\\n  <table>\\r\\n    <thead>\\r\\n      <tr>\\r\\n        <th>Code</th>\\r\\n        <th>Type</th>\\r\\n        <th>Recorded On</th>\\r\\n        <th>Asserted By</th>\\r\\n        <th>Clinical Status</th>\\r\\n        <th>Verification Status</th>\\r\\n      </tr>\\r\\n    </thead>\\r\\n    <tbody>\\r\\n      <tr>\\r\\n        <td>Flucloxacillin-containing product</td>\\r\\n        <td>Allergy</td>\\r\\n        <td />\\r\\n        <td>Patient/ZKT9319</td>\\r\\n        <td>active</td>\\r\\n        <td>confirmed</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>Diazepam-containing product</td>\\r\\n        <td>Allergy</td>\\r\\n        <td />\\r\\n        <td>Patient/ZKT9319</td>\\r\\n        <td>active</td>\\r\\n        <td>confirmed</td>\\r\\n      </tr>\\r\\n    </tbody>\\r\\n  </table>\\r\\n</div>\"\n                        },\n                        \"entry\": [\n                            {\n                                \"reference\": \"AllergyIntolerance/1dfacb6d-4260-4fd4-84e9-a1c13aafa72c\"\n                            },\n                            {\n                                \"reference\": \"AllergyIntolerance/e9b9aeaf-e5ac-4f72-b01d-df4c6107f746\"\n                            }\n                        ]\n                    },\n                    {\n                        \"title\": \"Problem List\",\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"11450-4\",\n                                    \"display\": \"Problem list - Reported\"\n                                }\n                            ]\n                        },\n                        \"text\": {\n                            \"status\": \"generated\",\n                            \"div\": \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\\r\\n  <table>\\r\\n    <thead>\\r\\n      <tr>\\r\\n        <th>Condition</th>\\r\\n        <th>Category</th>\\r\\n        <th>Recorded On</th>\\r\\n        <th>Clinical Status</th>\\r\\n        <th>Verification Status</th>\\r\\n      </tr>\\r\\n    </thead>\\r\\n    <tbody>\\r\\n      <tr>\\r\\n        <td>Postconcussion syndrome</td>\\r\\n        <td>Problem List Item</td>\\r\\n        <td />\\r\\n        <td>active</td>\\r\\n        <td>confirmed</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>Diabetes type 2 on insulin</td>\\r\\n        <td>Problem List Item</td>\\r\\n        <td />\\r\\n        <td>active</td>\\r\\n        <td>confirmed</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>Gout</td>\\r\\n        <td>Problem List Item</td>\\r\\n        <td />\\r\\n        <td>active</td>\\r\\n        <td>confirmed</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>Benign essential hypertension</td>\\r\\n        <td>Problem List Item</td>\\r\\n        <td />\\r\\n        <td>active</td>\\r\\n        <td>confirmed</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>Anxiety disorder due to a general medical condition</td>\\r\\n        <td>Problem List Item</td>\\r\\n        <td />\\r\\n        <td>inactive</td>\\r\\n        <td>confirmed</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>Fracture of neck of femur</td>\\r\\n        <td>Problem List Item</td>\\r\\n        <td />\\r\\n        <td>inactive</td>\\r\\n        <td>confirmed</td>\\r\\n      </tr>\\r\\n    </tbody>\\r\\n  </table>\\r\\n</div>\"\n                        },\n                        \"entry\": [\n                            {\n                                \"reference\": \"Condition/2eafb947-e816-4d9f-978b-c91d0dbe4acc\"\n                            },\n                            {\n                                \"reference\": \"Condition/1923f2ca-043b-432c-9eed-404c81474e60\"\n                            },\n                            {\n                                \"reference\": \"Condition/4f40d5e3-9a5f-4e3f-b799-c3378da8e7dd\"\n                            },\n                            {\n                                \"reference\": \"Condition/08992112-ac66-4c66-a803-89f80bb6d2aa\"\n                            },\n                            {\n                                \"reference\": \"Condition/9b54fc7a-8302-45cc-9ff6-e60c623c5bf9\"\n                            },\n                            {\n                                \"reference\": \"Condition/dd40111a-683f-4d72-bccc-3c6848bc0813\"\n                            }\n                        ]\n                    },\n                    {\n                        \"title\": \"Medication Summary\",\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"10160-0\",\n                                    \"display\": \"History of Medication use Narrative\"\n                                }\n                            ]\n                        },\n                        \"text\": {\n                            \"status\": \"generated\",\n                            \"div\": \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\\r\\n  <table>\\r\\n    <thead>\\r\\n      <tr>\\r\\n        <th>Drug</th>\\r\\n        <th>Status</th>\\r\\n        <th>Effective</th>\\r\\n        <th>Instructions</th>\\r\\n      </tr>\\r\\n    </thead>\\r\\n    <tbody>\\r\\n      <tr>\\r\\n        <td>insulin glargine 100 international units/mL injection, 10 mL vial</td>\\r\\n        <td>Active</td>\\r\\n        <td>2023-02-21</td>\\r\\n        <td>Inject 20 units per day into your upper arms, abdomen or thights.You should vary the site where you inject each dose of Lantus. This helps reduce your risk of certain side effects, such as pits or lumps in your skin.</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>dulaglutide 1.5 mg/0.5 mL injection, prefilled injection device</td>\\r\\n        <td>Active</td>\\r\\n        <td>2023-02-21</td>\\r\\n        <td>Inject once a week, on the same day each week, into the skin of your stomach, thigh or upper arm. You can use the same area of your body each time, but choose a different place within that area. You can inject it any time of the day, with or without meals.</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>metformin hydrochloride 1000 mg tablet</td>\\r\\n        <td>Active</td>\\r\\n        <td>2023-02-21</td>\\r\\n        <td>Take ONE tablet, two times a day, with meals.</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>amlodipine 5 mg tablet</td>\\r\\n        <td>Active</td>\\r\\n        <td>2023-02-21</td>\\r\\n        <td>Take ONE tablet at any time of day, but try to make sure it's around the same time every day.</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>losartan potassium 50 mg tablet</td>\\r\\n        <td>Active</td>\\r\\n        <td>2023-02-21</td>\\r\\n        <td>Take ONE tablet daily</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>aspirin 75 mg tablet: enteric-coated</td>\\r\\n        <td>Active</td>\\r\\n        <td>2023-02-21</td>\\r\\n        <td>Take ONE tablet daily</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>allopurinol 300 mg tablet</td>\\r\\n        <td>Active</td>\\r\\n        <td>2023-02-21</td>\\r\\n        <td>Take ONE tablet daily, after meals</td>\\r\\n      </tr>\\r\\n    </tbody>\\r\\n  </table>\\r\\n</div>\"\n                        },\n                        \"entry\": [\n                            {\n                                \"reference\": \"MedicationStatement/8ecbe74a-a3fa-4edf-8133-44ca8903a645\"\n                            },\n                            {\n                                \"reference\": \"MedicationStatement/06c4eda2-df30-4231-af09-0135e5f84548\"\n                            },\n                            {\n                                \"reference\": \"MedicationStatement/4b5f40b9-f59c-4090-81b1-4609ac6b7af8\"\n                            },\n                            {\n                                \"reference\": \"MedicationStatement/e19dc087-0055-4feb-a847-72e77cf55a0a\"\n                            },\n                            {\n                                \"reference\": \"MedicationStatement/f7a26186-dd57-420f-95be-c0deeee49367\"\n                            },\n                            {\n                                \"reference\": \"MedicationStatement/b6b49f33-a0e4-4b94-92f3-caa3267ad4f7\"\n                            },\n                            {\n                                \"reference\": \"MedicationStatement/ce2395b9-d7ef-4df0-b38f-fc9be0e44f94\"\n                            }\n                        ]\n                    },\n                    {\n                        \"title\": \"Immunizations\",\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"11369-6\",\n                                    \"display\": \"History of Immunization Narrative\"\n                                }\n                            ]\n                        },\n                        \"text\": {\n                            \"status\": \"generated\",\n                            \"div\": \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\\r\\n  <table>\\r\\n    <thead>\\r\\n      <tr>\\r\\n        <th>Vaccine</th>\\r\\n        <th>Status</th>\\r\\n        <th>Occurance</th>\\r\\n        <th>Route</th>\\r\\n        <th>Dose #</th>\\r\\n        <th>Series</th>\\r\\n      </tr>\\r\\n    </thead>\\r\\n    <tbody>\\r\\n      <tr>\\r\\n        <td>SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 30 mcg/0.3mL dose</td>\\r\\n        <td>Completed</td>\\r\\n        <td>2022-02-01</td>\\r\\n        <td>Injection, intramuscular</td>\\r\\n        <td>2</td>\\r\\n        <td>12 (At risk, no previous history)</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 30 mcg/0.3mL dose</td>\\r\\n        <td>Completed</td>\\r\\n        <td>2021-08-05</td>\\r\\n        <td>Injection, intramuscular</td>\\r\\n        <td>1</td>\\r\\n        <td>12 (At risk, no previous history)</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>Influenza, seasonal, injectable</td>\\r\\n        <td>Completed</td>\\r\\n        <td>2019-05-20</td>\\r\\n        <td>Injection, intramuscular</td>\\r\\n        <td>1</td>\\r\\n        <td>1 (Over 65 years (Influenza))</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>diphtheria, tetanus toxoids and acellular pertussis vaccine</td>\\r\\n        <td>Completed</td>\\r\\n        <td>2019-04-24</td>\\r\\n        <td>Injection, intramuscular</td>\\r\\n        <td>1</td>\\r\\n        <td>6 (Booster)</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>tetanus and diphtheria toxoids, not adsorbed, for adult use</td>\\r\\n        <td>Completed</td>\\r\\n        <td>2018-04-05</td>\\r\\n        <td>Injection, intramuscular</td>\\r\\n        <td>1</td>\\r\\n        <td>6 (Booster)</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>pneumococcal conjugate vaccine, 13 valent</td>\\r\\n        <td>Completed</td>\\r\\n        <td>2015-09-25</td>\\r\\n        <td>Injection, intramuscular</td>\\r\\n        <td>1</td>\\r\\n        <td>21 (PCV catch up)</td>\\r\\n      </tr>\\r\\n      <tr>\\r\\n        <td>Influenza, seasonal, injectable</td>\\r\\n        <td>Completed</td>\\r\\n        <td>2015-05-01</td>\\r\\n        <td>Injection, intramuscular</td>\\r\\n        <td>1</td>\\r\\n        <td>1 (Over 65 years (Influenza))</td>\\r\\n      </tr>\\r\\n    </tbody>\\r\\n  </table>\\r\\n</div>\"\n                        },\n                        \"entry\": [\n                            {\n                                \"reference\": \"Immunization/998e59d9-a7f4-4503-b08e-85ce9b206b0a\"\n                            },\n                            {\n                                \"reference\": \"Immunization/fc6b3454-527b-4deb-a266-7f52c63d0d3c\"\n                            },\n                            {\n                                \"reference\": \"Immunization/33c971d3-0992-4e93-b904-6325ed4602e3\"\n                            },\n                            {\n                                \"reference\": \"Immunization/12c253d4-20e8-4dd4-935c-fd1ec8a49279\"\n                            },\n                            {\n                                \"reference\": \"Immunization/70308bba-2bc4-4505-ba9b-520f9d3dc30b\"\n                            },\n                            {\n                                \"reference\": \"Immunization/acd3a963-0985-4679-a126-8eb9ed981d36\"\n                            },\n                            {\n                                \"reference\": \"Immunization/bae44614-43cc-4df4-94b3-c26d34b0ea37\"\n                            }\n                        ]\n                    },\n                    {\n                        \"title\": \"Procedures\",\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"47519-4\",\n                                    \"display\": \"History of Procedures Document\"\n                                }\n                            ]\n                        },\n                        \"text\": {\n                            \"status\": \"generated\",\n                            \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'><table xmlns=\\\"http://www.w3.org/1999/xhtml\\\">        <thead>          <tr>            <th>Date(s)</th>            <th>Procedure</th>            <th>Location</th>            <th>Performer</th>            <th>Comments</th>                                  </tr>        </thead>        <tbody>          <tr>            <td>01/09/2020 to 01/09/2020</td>            <td>Operative procedure on hip</td>            <td>Waikato Hospital</td>                                                          </tr>          <tr>            <td>31/03/2018 to 31/03/2018</td>            <td>Hand closure</td>            <td>Samoa</td>                                                          </tr>        </tbody>      </table>    </div>\"\n                        },\n                        \"entry\": [\n                            {\n                                \"reference\": \"Procedure/8414198c-a43b-4ef1-b06f-3b39fb4b39cc\"\n                            },\n                            {\n                                \"reference\": \"Procedure/1096ab80-e982-41b3-85c2-8e1d2466d147\"\n                            }\n                        ]\n                    },\n                    {\n                        \"title\": \"Results\",\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"30954-2\",\n                                    \"display\": \"Relevant diagnostic tests/laboratory data Narrative\"\n                                }\n                            ]\n                        },\n                        \"text\": {\n                            \"status\": \"generated\",\n                            \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'><table>        <tbody>          <tr>            <th>Result Group:</th>            <td>Lipids</td>            <th>Result Date:</th>            <td>05 Mar 2023 00:00</td>            <th>Result Status:</th>            <td>completed</td>          </tr>        </tbody>      </table>      <table xmlns=\\\"http://www.w3.org/1999/xhtml\\\">        <thead>          <tr>            <th>Result Name</th>            <th>Value</th>            <th>Reference Range</th>            <th>Abnormal Indicator</th>            <th>Comments</th>                                  </tr>        </thead>        <tbody>          <tr>            <td>Total cholesterol:HDL ratio</td>            <td>5.1 mmol/L</td>            <td>&lt;4 mmol/L (high risk)</td>            <td>H</td>                                              </tr>          <tr>            <td>HDL Cholesterol</td>            <td>1.5 mmol/L</td>            <td>&gt;1 mmol/L</td>            <td>N</td>                                              </tr>          <tr>            <td>LDL Cholesterol</td>            <td>3.4 mmol/L</td>            <td>&lt;1.8 mmol/L</td>            <td>H</td>                                              </tr>        </tbody>      </table>            <table>        <tbody>          <tr>            <th>Result Group:</th>            <td>HbA1C</td>            <th>Result Date:</th>            <td>05 Mar 2023 00:00</td>            <th>Result Status:</th>            <td>completed</td>          </tr>        </tbody>      </table>      <table xmlns=\\\"http://www.w3.org/1999/xhtml\\\">        <thead>          <tr>            <th>Result Name</th>            <th>Value</th>            <th>Reference Range</th>            <th>Abnormal Indicator</th>            <th>Comments</th>                                  </tr>        </thead>        <tbody>          <tr>            <td>HbA1c</td>            <td>60 mmol/mol</td>            <td>50 – 55 mmol/mol (diabetes)</td>            <td>H</td>                                              </tr>        </tbody>      </table>    </div>\"\n                        },\n                        \"entry\": [\n                            {\n                                \"reference\": \"Observation/2f3ad263-1b4e-443b-95ca-66d2abb6e927\"\n                            },\n                            {\n                                \"reference\": \"Observation/fe53810f-a341-4093-a959-4048ad62f85b\"\n                            },\n                            {\n                                \"reference\": \"Observation/6adb76b4-73f3-4552-87a6-09ac3dc1f558\"\n                            },\n                            {\n                                \"reference\": \"DiagnosticReport/9e0d995f-a78d-45f4-b3aa-23037972a3e6\"\n                            },\n                            {\n                                \"reference\": \"Observation/63ad8984-003c-4e44-bc56-31dd6abc0897\"\n                            },\n                            {\n                                \"reference\": \"DiagnosticReport/2da4116e-7158-4d59-b6c4-873b37f7d65f\"\n                            }\n                        ]\n                    },\n                    {\n                        \"title\": \"Vital Signs\",\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"8716-3\",\n                                    \"display\": \"Vital signs\"\n                                }\n                            ]\n                        },\n                        \"text\": {\n                            \"status\": \"generated\",\n                            \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'><table>        <tbody>          <tr>            <th>Result Group:</th>            <td>Vital signs, weight, height, head circumference, oxygen saturation and BMI panel</td>            <th>Result Date:</th>            <td>29 Sep 2023 00:00</td>            <th>Result Status:</th>            <td>completed</td>          </tr>        </tbody>      </table>      <table xmlns=\\\"http://www.w3.org/1999/xhtml\\\">        <thead>          <tr>            <th>Result Name</th>            <th>Value</th>                                  </tr>        </thead>        <tbody>          <tr>            <td>Body temperature</td>            <td>37.5 C</td>                                  </tr>          <tr>            <td>Heart rate</td>            <td>84 beats/minute</td>                                  </tr>          <tr>            <td>Respiratory rate</td>            <td>18 breaths/minute</td>                                  </tr>          <tr>            <td>Systolic blood pressure</td>            <td>136 mm[Hg]</td>                                  </tr>          <tr>            <td>Diastolic blood pressure</td>            <td>88 mm[Hg]</td>                                  </tr>          <tr>            <td>Body height</td>            <td>1.84 cm</td>                                  </tr>          <tr>            <td>Body weight</td>            <td>104 kg</td>                                  </tr>        </tbody>      </table>            <table>        <tbody>          <tr>            <th>Result Group:</th>            <td>Vital signs, weight, height, head circumference, oxygen saturation and BMI panel</td>            <th>Result Date:</th>            <td>05 Mar 2023 00:00</td>            <th>Result Status:</th>            <td>completed</td>          </tr>        </tbody>      </table>      <table xmlns=\\\"http://www.w3.org/1999/xhtml\\\">        <thead>          <tr>            <th>Result Name</th>            <th>Value</th>                                  </tr>        </thead>        <tbody>          <tr>            <td>Body temperature</td>            <td>37.2 C</td>                                  </tr>          <tr>            <td>Heart rate</td>            <td>86 beats/minute</td>                                  </tr>          <tr>            <td>Respiratory rate</td>            <td>14 breaths/minute</td>                                  </tr>          <tr>            <td>Systolic blood pressure</td>            <td>130 mm[Hg]</td>                                  </tr>          <tr>            <td>Diastolic blood pressure</td>            <td>82 mm[Hg]</td>                                  </tr>          <tr>            <td>Body weight</td>            <td>103 kg</td>                                  </tr>        </tbody>      </table>    </div>\"\n                        },\n                        \"entry\": [\n                            {\n                                \"reference\": \"Observation/6f64547c-89a3-459d-a993-b89e995c1f14\"\n                            },\n                            {\n                                \"reference\": \"Observation/da3bbb11-e485-4396-a25c-611354789c65\"\n                            },\n                            {\n                                \"reference\": \"Observation/5dead0bd-80c7-42f7-9720-3aaf047eb89b\"\n                            },\n                            {\n                                \"reference\": \"Observation/126f25f0-d921-4d9a-85a2-5b847cfb89fb\"\n                            },\n                            {\n                                \"reference\": \"Observation/cf628f81-f66b-42a7-a33a-c5d38a604861\"\n                            },\n                            {\n                                \"reference\": \"Observation/dd309bef-3b36-4422-a202-39d040113a5d\"\n                            },\n                            {\n                                \"reference\": \"Observation/4c5e0a16-2e2c-47cc-8e1d-a87afee4d6f1\"\n                            },\n                            {\n                                \"reference\": \"Observation/eda3092b-5228-420b-b0ce-f5eb77e73942\"\n                            },\n                            {\n                                \"reference\": \"Observation/2d420435-f380-46e1-ad93-b9fef57f4b71\"\n                            },\n                            {\n                                \"reference\": \"Observation/7a422837-80f5-4fa6-b3ac-8a0e44b99356\"\n                            },\n                            {\n                                \"reference\": \"Observation/af9ae822-ae5d-4bec-88bf-4dd250350783\"\n                            }\n                        ]\n                    },\n                    {\n                        \"title\": \"Social History\",\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"29762-2\",\n                                    \"display\": \"Social history Narrative\"\n                                }\n                            ]\n                        },\n                        \"text\": {\n                            \"status\": \"generated\",\n                            \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'><table xmlns=\\\"http://www.w3.org/1999/xhtml\\\">        <thead>          <tr>            <th>Type</th>            <th>Item</th>            <th>Date(s)</th>            <th>Comment</th>                                  </tr>        </thead>        <tbody>          <tr>            <td>other</td>            <td>Worked as a forestry worker.</td>                        <td>Worked as a forestry worker. Was always physically active until 2020 fall.Has had subsequent falls. Now depends on a walker or scooter.</td>                                  </tr>          <tr>            <td>smoking</td>            <td>Ex-smoker</td>            <td>30/06/2005</td>            <td>30 - pack - year smoking history, quit smoking ~2005.</td>                                  </tr>        </tbody>      </table>    </div>\"\n                        },\n                        \"entry\": [\n                            {\n                                \"reference\": \"Observation/33624327-7e1b-4912-bca1-2d0c8d36b952\"\n                            }\n                        ]\n                    },\n                    {\n                        \"title\": \"Functional Status\",\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"47420-5\",\n                                    \"display\": \"Functional status assessment note\"\n                                }\n                            ]\n                        },\n                        \"text\": {\n                            \"status\": \"generated\",\n                            \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'><table xmlns=\\\"http://www.w3.org/1999/xhtml\\\">        <thead>          <tr>            <th>Functional Condition</th>            <th>Effective Dates</th>            <th>Condition Status</th>          </tr>        </thead>        <tbody>          <tr>            <td>Often confused, struggles to communicate in English</td>                        <td>Active</td>          </tr>          <tr>            <td>Depends on a walking frame or electric scooter to get around.</td>                        <td>Active</td>          </tr>          <tr>            <td>Doesn’t leave the house much.</td>                        <td>Active</td>          </tr>          <tr>            <td>Relies on caregiver Cindy for assistance with many activities of daily living.</td>                        <td>Active</td>          </tr>          <tr>            <td>Family has made the decision to transfer Iosefa to residential care soon, arrangements currently being finalised.</td>                        <td>Active</td>          </tr>        </tbody>      </table>    </div>\"\n                        },\n                        \"entry\": [\n                            {\n                                \"reference\": \"Condition/4464bdfe-dc87-4179-a10d-2884c975a6eb\"\n                            },\n                            {\n                                \"reference\": \"Condition/f0982a2a-8eb2-4b1a-9e73-6a82d2102003\"\n                            },\n                            {\n                                \"reference\": \"Condition/94c0216a-183b-45e9-9e98-f244ac0b4d4f\"\n                            },\n                            {\n                                \"reference\": \"Condition/14863bd8-1d6d-4c85-9bcc-1b33699908c4\"\n                            },\n                            {\n                                \"reference\": \"Condition/b008f275-c141-4cd5-b1bb-46c399eaf42d\"\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Patient/ZKT9319\",\n            \"resource\": {\n                \"resourceType\": \"Patient\",\n                \"id\": \"ZKT9319\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Name: Iosefa Test-Fuimaono</div>\"\n                },\n                \"identifier\": [\n                    {\n                        \"system\": \"https://standards.digital.health.nz/ns/nhi-id\",\n                        \"value\": \"ZKT9319\"\n                    }\n                ],\n                \"name\": [\n                    {\n                        \"use\": \"usual\",\n                        \"family\": \"Test-Fuimaono\",\n                        \"given\": [\n                            \"Iosefa\"\n                        ]\n                    }\n                ],\n                \"gender\": \"male\",\n                \"birthDate\": \"1950-07-04\",\n                \"address\": [\n                    {\n                        \"use\": \"home\",\n                        \"type\": \"physical\",\n                        \"line\": [\n                            \"Flat 1\",\n                            \"1 Brooklyn Road\",\n                            \"Claudelands\"\n                        ],\n                        \"city\": \"Hamilton\",\n                        \"postalCode\": \"3214\",\n                        \"country\": \"NZ\"\n                    }\n                ],\n                \"maritalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/v3-MaritalStatus\",\n                            \"code\": \"W\",\n                            \"display\": \"Widowed\"\n                        }\n                    ]\n                },\n                \"contact\": [\n                    {\n                        \"relationship\": [\n                            {\n                                \"coding\": [\n                                    {\n                                        \"system\": \"http://terminology.hl7.org/CodeSystem/v2-0131\",\n                                        \"code\": \"N\",\n                                        \"display\": \"Next-of-Kin\"\n                                    }\n                                ]\n                            }\n                        ],\n                        \"name\": {\n                            \"use\": \"usual\",\n                            \"family\": \"Test-Fuimaono\",\n                            \"given\": [\n                                \"Cindy\",\n                                \"Test-Fuimaono\"\n                            ]\n                        },\n                        \"telecom\": [\n                            {\n                                \"system\": \"phone\",\n                                \"value\": \"021 111111\",\n                                \"use\": \"mobile\"\n                            }\n                        ],\n                        \"address\": {\n                            \"use\": \"home\",\n                            \"type\": \"physical\",\n                            \"line\": [\n                                \"Flat 1\",\n                                \"1 Brooklyn Road\",\n                                \"Claudelands\"\n                            ],\n                            \"city\": \"Hamilton\",\n                            \"postalCode\": \"3214\",\n                            \"country\": \"NZ\"\n                        }\n                    },\n                    {\n                        \"relationship\": [\n                            {\n                                \"coding\": [\n                                    {\n                                        \"system\": \"http://terminology.hl7.org/CodeSystem/v2-0131\",\n                                        \"code\": \"C\",\n                                        \"display\": \"Emergency Contact\"\n                                    }\n                                ]\n                            }\n                        ],\n                        \"name\": {\n                            \"use\": \"usual\",\n                            \"family\": \"Test-Fuimaono\",\n                            \"given\": [\n                                \"Cindy\",\n                                \"Test-Fuimaono\"\n                            ]\n                        },\n                        \"telecom\": [\n                            {\n                                \"system\": \"phone\",\n                                \"value\": \"021 111111\",\n                                \"use\": \"mobile\"\n                            }\n                        ],\n                        \"address\": {\n                            \"use\": \"home\",\n                            \"type\": \"physical\",\n                            \"line\": [\n                                \"Flat 1\",\n                                \"1 Brooklyn Road\",\n                                \"Claudelands\"\n                            ],\n                            \"city\": \"Hamilton\",\n                            \"postalCode\": \"3214\",\n                            \"country\": \"NZ\"\n                        }\n                    }\n                ],\n                \"communication\": [\n                    {\n                        \"language\": {\n                            \"text\": \"en-NZ\"\n                        }\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Organization/9c9542df-e45f-4131-9d44-8f5974e56d5b\",\n            \"resource\": {\n                \"resourceType\": \"Organization\",\n                \"id\": \"9c9542df-e45f-4131-9d44-8f5974e56d5b\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Name: Fairfield Medical Centre</div>\"\n                },\n                \"identifier\": [\n                    {\n                        \"system\": \"https://standards.digital.health.nz/ns/hpi-facility-id\",\n                        \"value\": \"F0U044-C\"\n                    }\n                ],\n                \"name\": \"Fairfield Medical Centre\"\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\",\n            \"resource\": {\n                \"resourceType\": \"PractitionerRole\",\n                \"id\": \"c9288aea-5e73-4182-8231-aacbe50d3244\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Role: Doctor</div>\"\n                },\n                \"practitioner\": {\n                    \"reference\": \"Practitioner/4d4b76bf-55b5-40b8-a130-99ea24a84c23\"\n                },\n                \"code\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://snomed.info/sct\",\n                                \"code\": \"158965000\",\n                                \"display\": \"Doctor\"\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Practitioner/4d4b76bf-55b5-40b8-a130-99ea24a84c23\",\n            \"resource\": {\n                \"resourceType\": \"Practitioner\",\n                \"id\": \"4d4b76bf-55b5-40b8-a130-99ea24a84c23\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Name: Dr James Test-Smith</div>\"\n                },\n                \"name\": [\n                    {\n                        \"use\": \"usual\",\n                        \"family\": \"Test-Smith\",\n                        \"given\": [\n                            \"Dr\",\n                            \"James\",\n                            \"Test-Smith\"\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\",\n            \"resource\": {\n                \"resourceType\": \"Organization\",\n                \"id\": \"644f2fb9-c264-4c32-898b-4048dddd6d1b\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Name: Fairfield Medical Centre</div>\"\n                },\n                \"identifier\": [\n                    {\n                        \"system\": \"https://standards.digital.health.nz/ns/hpi-facility-id\",\n                        \"value\": \"F0U044-C\"\n                    }\n                ],\n                \"name\": \"Fairfield Medical Centre\"\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Location/F05076-A\",\n            \"resource\": {\n                \"resourceType\": \"Location\",\n                \"id\": \"F05076-A\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\\r\\n  <h2>Waikato Hospital</h2>\\r\\n  <table>\\r\\n    <tr>\\r\\n      <td>Identifier</td>\\r\\n      <td>F05076-A</td>\\r\\n    </tr>\\r\\n    <tr>\\r\\n      <td>Identifier System</td>\\r\\n      <td>https://standards.digital.health.nz/ns/hpi-facility-id</td>\\r\\n    </tr>\\r\\n    <tr>\\r\\n      <td>Status</td>\\r\\n      <td>Active</td>\\r\\n    </tr>\\r\\n    <tr>\\r\\n      <td>Mode</td>\\r\\n      <td>Instance</td>\\r\\n    </tr>\\r\\n    <tr>\\r\\n      <td>Type</td>\\r\\n      <td>Location</td>\\r\\n    </tr>\\r\\n    <tr>\\r\\n      <td>Address</td>\\r\\n      <td>183 Pembroke Street, Waikato Hospital, Hamilton 3204</td>\\r\\n    </tr>\\r\\n  </table>\\r\\n</div>\"\n                },\n                \"identifier\": [\n                    {\n                        \"system\": \"https://standards.digital.health.nz/ns/hpi-facility-id\",\n                        \"value\": \"F05076-A\"\n                    }\n                ],\n                \"status\": \"active\",\n                \"name\": \"Waikato Hospital\"\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/AllergyIntolerance/1dfacb6d-4260-4fd4-84e9-a1c13aafa72c\",\n            \"resource\": {\n                \"resourceType\": \"AllergyIntolerance\",\n                \"id\": \"1dfacb6d-4260-4fd4-84e9-a1c13aafa72c\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Flucloxacillin-containing product (Penicillin adverse reaction)</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"verificationStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/allergyintolerance-verification\",\n                            \"code\": \"confirmed\"\n                        }\n                    ]\n                },\n                \"type\": \"allergy\",\n                \"category\": [\n                    \"medication\"\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"96067005\",\n                            \"display\": \"Flucloxacillin-containing product\"\n                        }\n                    ]\n                },\n                \"patient\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"asserter\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"reaction\": [\n                    {\n                        \"manifestation\": [\n                            {\n                                \"coding\": [\n                                    {\n                                        \"system\": \"http://snomed.info/sct\",\n                                        \"code\": \"292954005\",\n                                        \"display\": \"Penicillin adverse reaction\"\n                                    }\n                                ]\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/AllergyIntolerance/e9b9aeaf-e5ac-4f72-b01d-df4c6107f746\",\n            \"resource\": {\n                \"resourceType\": \"AllergyIntolerance\",\n                \"id\": \"e9b9aeaf-e5ac-4f72-b01d-df4c6107f746\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Diazepam-containing product (Diazepam adverse reaction)</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"verificationStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/allergyintolerance-verification\",\n                            \"code\": \"confirmed\"\n                        }\n                    ]\n                },\n                \"type\": \"allergy\",\n                \"category\": [\n                    \"medication\"\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"48546005\",\n                            \"display\": \"Diazepam-containing product\"\n                        }\n                    ]\n                },\n                \"patient\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"asserter\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"reaction\": [\n                    {\n                        \"manifestation\": [\n                            {\n                                \"coding\": [\n                                    {\n                                        \"system\": \"http://snomed.info/sct\",\n                                        \"code\": \"292360004\",\n                                        \"display\": \"Diazepam adverse reaction\"\n                                    }\n                                ]\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/2eafb947-e816-4d9f-978b-c91d0dbe4acc\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"2eafb947-e816-4d9f-978b-c91d0dbe4acc\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Postconcussion</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"verificationStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-ver-status\",\n                            \"code\": \"confirmed\"\n                        }\n                    ]\n                },\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/condition-category\",\n                                \"code\": \"problem-list-item\",\n                                \"display\": \"Problem List Item\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"40425004\",\n                            \"display\": \"Postconcussion syndrome\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/1923f2ca-043b-432c-9eed-404c81474e60\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"1923f2ca-043b-432c-9eed-404c81474e60\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Diabetes type 2 on insulin</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"verificationStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-ver-status\",\n                            \"code\": \"confirmed\"\n                        }\n                    ]\n                },\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/condition-category\",\n                                \"code\": \"problem-list-item\",\n                                \"display\": \"Problem List Item\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"237599002\",\n                            \"display\": \"Diabetes type 2 on insulin\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/4f40d5e3-9a5f-4e3f-b799-c3378da8e7dd\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"4f40d5e3-9a5f-4e3f-b799-c3378da8e7dd\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Gout</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"verificationStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-ver-status\",\n                            \"code\": \"confirmed\"\n                        }\n                    ]\n                },\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/condition-category\",\n                                \"code\": \"problem-list-item\",\n                                \"display\": \"Problem List Item\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"90560007\",\n                            \"display\": \"Gout\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/08992112-ac66-4c66-a803-89f80bb6d2aa\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"08992112-ac66-4c66-a803-89f80bb6d2aa\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Benign essential hypertension</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"verificationStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-ver-status\",\n                            \"code\": \"confirmed\"\n                        }\n                    ]\n                },\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/condition-category\",\n                                \"code\": \"problem-list-item\",\n                                \"display\": \"Problem List Item\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"1201005\",\n                            \"display\": \"Benign essential hypertension\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/9b54fc7a-8302-45cc-9ff6-e60c623c5bf9\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"9b54fc7a-8302-45cc-9ff6-e60c623c5bf9\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Anxiety disorder due to a general medical condition</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"inactive\"\n                        }\n                    ]\n                },\n                \"verificationStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-ver-status\",\n                            \"code\": \"confirmed\"\n                        }\n                    ]\n                },\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/condition-category\",\n                                \"code\": \"problem-list-item\",\n                                \"display\": \"Problem List Item\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"52910006\",\n                            \"display\": \"Anxiety disorder due to a general medical condition\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/dd40111a-683f-4d72-bccc-3c6848bc0813\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"dd40111a-683f-4d72-bccc-3c6848bc0813\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Fracture of neck of femur</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"inactive\"\n                        }\n                    ]\n                },\n                \"verificationStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-ver-status\",\n                            \"code\": \"confirmed\"\n                        }\n                    ]\n                },\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/condition-category\",\n                                \"code\": \"problem-list-item\",\n                                \"display\": \"Problem List Item\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"5913000\",\n                            \"display\": \"Fracture of neck of femur\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/4464bdfe-dc87-4179-a10d-2884c975a6eb\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"4464bdfe-dc87-4179-a10d-2884c975a6eb\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Often confused, struggles to communicate in English</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"code\": {\n                    \"text\": \"Often confused, struggles to communicate in English\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/f0982a2a-8eb2-4b1a-9e73-6a82d2102003\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"f0982a2a-8eb2-4b1a-9e73-6a82d2102003\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Depends on a walking frame or electric scooter to get around.</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"code\": {\n                    \"text\": \"Depends on a walking frame or electric scooter to get around.\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/94c0216a-183b-45e9-9e98-f244ac0b4d4f\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"94c0216a-183b-45e9-9e98-f244ac0b4d4f\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Doesn’t leave the house much.</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"code\": {\n                    \"text\": \"Doesn’t leave the house much.\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/14863bd8-1d6d-4c85-9bcc-1b33699908c4\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"14863bd8-1d6d-4c85-9bcc-1b33699908c4\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Relies on caregiver Cindy for assistance with many activities of daily living.</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"code\": {\n                    \"text\": \"Relies on caregiver Cindy for assistance with many activities of daily living.\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Condition/b008f275-c141-4cd5-b1bb-46c399eaf42d\",\n            \"resource\": {\n                \"resourceType\": \"Condition\",\n                \"id\": \"b008f275-c141-4cd5-b1bb-46c399eaf42d\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Family has made the decision to transfer Iosefa to residential care soon, arrangements currently being finalised.</div>\"\n                },\n                \"clinicalStatus\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n                            \"code\": \"active\"\n                        }\n                    ]\n                },\n                \"code\": {\n                    \"text\": \"Family has made the decision to transfer Iosefa to residential care soon, arrangements currently being finalised.\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/MedicationStatement/8ecbe74a-a3fa-4edf-8133-44ca8903a645\",\n            \"resource\": {\n                \"resourceType\": \"MedicationStatement\",\n                \"id\": \"8ecbe74a-a3fa-4edf-8133-44ca8903a645\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>10368421000116106 (insulin glargine 100 international units/mL injection, 10 mL vial)</div>\"\n                },\n                \"status\": \"active\",\n                \"medicationCodeableConcept\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"126212009\",\n                            \"display\": \"Product containing insulin glargine (medicinal product)\"\n                        }\n                    ],\n                    \"text\": \"insulin glargine 100 international units/mL injection, 10 mL vial\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-02-21\",\n                \"informationSource\": {\n                    \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                },\n                \"dosage\": [\n                    {\n                        \"text\": \"Inject 20 units per day into your upper arms, abdomen or thights.You should vary the site where you inject each dose of Lantus. This helps reduce your risk of certain side effects, such as pits or lumps in your skin.\",\n                        \"timing\": {\n                            \"repeat\": {\n                                \"frequency\": 1,\n                                \"period\": 1,\n                                \"periodUnit\": \"d\"\n                            }\n                        },\n                        \"route\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"34206005\",\n                                    \"display\": \"subcutaneous route\"\n                                }\n                            ]\n                        },\n                        \"doseAndRate\": [\n                            {\n                                \"type\": {\n                                    \"coding\": [\n                                        {\n                                            \"system\": \"http://terminology.hl7.org/CodeSystem/dose-rate-type\",\n                                            \"code\": \"ordered\",\n                                            \"display\": \"Ordered\"\n                                        }\n                                    ]\n                                },\n                                \"doseQuantity\": {\n                                    \"value\": 1,\n                                    \"unit\": \"unit\",\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"767525000\"\n                                }\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/MedicationStatement/06c4eda2-df30-4231-af09-0135e5f84548\",\n            \"resource\": {\n                \"resourceType\": \"MedicationStatement\",\n                \"id\": \"06c4eda2-df30-4231-af09-0135e5f84548\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>47230201000116108 (dulaglutide 1.5 mg/0.5 mL injection, prefilled injection device)</div>\"\n                },\n                \"status\": \"active\",\n                \"medicationCodeableConcept\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"714081009\",\n                            \"display\": \"Product containing dulaglutide (medicinal product)\"\n                        }\n                    ],\n                    \"text\": \"dulaglutide 1.5 mg/0.5 mL injection, prefilled injection device\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-02-21\",\n                \"informationSource\": {\n                    \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                },\n                \"dosage\": [\n                    {\n                        \"text\": \"Inject once a week, on the same day each week, into the skin of your stomach, thigh or upper arm. You can use the same area of your body each time, but choose a different place within that area. You can inject it any time of the day, with or without meals.\",\n                        \"route\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"34206005\",\n                                    \"display\": \"subcutaneous route\"\n                                }\n                            ]\n                        },\n                        \"doseAndRate\": [\n                            {\n                                \"type\": {\n                                    \"coding\": [\n                                        {\n                                            \"system\": \"http://terminology.hl7.org/CodeSystem/dose-rate-type\",\n                                            \"code\": \"ordered\",\n                                            \"display\": \"Ordered\"\n                                        }\n                                    ]\n                                }\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/MedicationStatement/4b5f40b9-f59c-4090-81b1-4609ac6b7af8\",\n            \"resource\": {\n                \"resourceType\": \"MedicationStatement\",\n                \"id\": \"4b5f40b9-f59c-4090-81b1-4609ac6b7af8\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>44221701000116102 (metformin hydrochloride 1000 mg tablet)</div>\"\n                },\n                \"status\": \"active\",\n                \"medicationCodeableConcept\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"109081006\",\n                            \"display\": \"Product containing metformin (medicinal product)\"\n                        }\n                    ],\n                    \"text\": \"metformin hydrochloride 1000 mg tablet\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-02-21\",\n                \"informationSource\": {\n                    \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                },\n                \"dosage\": [\n                    {\n                        \"text\": \"Take ONE tablet, two times a day, with meals.\",\n                        \"timing\": {\n                            \"repeat\": {\n                                \"frequency\": 2,\n                                \"period\": 1,\n                                \"periodUnit\": \"d\"\n                            }\n                        },\n                        \"route\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"26643006\",\n                                    \"display\": \"Oral route\"\n                                }\n                            ]\n                        },\n                        \"doseAndRate\": [\n                            {\n                                \"type\": {\n                                    \"coding\": [\n                                        {\n                                            \"system\": \"http://terminology.hl7.org/CodeSystem/dose-rate-type\",\n                                            \"code\": \"ordered\",\n                                            \"display\": \"Ordered\"\n                                        }\n                                    ]\n                                },\n                                \"doseQuantity\": {\n                                    \"value\": 1,\n                                    \"unit\": \"Tablet - unit of product usage\",\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"428673006\"\n                                }\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/MedicationStatement/e19dc087-0055-4feb-a847-72e77cf55a0a\",\n            \"resource\": {\n                \"resourceType\": \"MedicationStatement\",\n                \"id\": \"e19dc087-0055-4feb-a847-72e77cf55a0a\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>10109621000116108 (amlodipine 5 mg tablet)</div>\"\n                },\n                \"status\": \"active\",\n                \"medicationCodeableConcept\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"108537001\",\n                            \"display\": \"Product containing amlodipine (medicinal product)\"\n                        }\n                    ],\n                    \"text\": \"amlodipine 5 mg tablet\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-02-21\",\n                \"informationSource\": {\n                    \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                },\n                \"dosage\": [\n                    {\n                        \"text\": \"Take ONE tablet at any time of day, but try to make sure it's around the same time every day.\",\n                        \"timing\": {\n                            \"repeat\": {\n                                \"frequency\": 1,\n                                \"period\": 1,\n                                \"periodUnit\": \"d\"\n                            }\n                        },\n                        \"route\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"26643006\",\n                                    \"display\": \"Oral route\"\n                                }\n                            ]\n                        },\n                        \"doseAndRate\": [\n                            {\n                                \"type\": {\n                                    \"coding\": [\n                                        {\n                                            \"system\": \"http://terminology.hl7.org/CodeSystem/dose-rate-type\",\n                                            \"code\": \"ordered\",\n                                            \"display\": \"Ordered\"\n                                        }\n                                    ]\n                                },\n                                \"doseQuantity\": {\n                                    \"value\": 1,\n                                    \"unit\": \"Tablet - unit of product usage\",\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"428673006\"\n                                }\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/MedicationStatement/f7a26186-dd57-420f-95be-c0deeee49367\",\n            \"resource\": {\n                \"resourceType\": \"MedicationStatement\",\n                \"id\": \"f7a26186-dd57-420f-95be-c0deeee49367\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>10195211000116102 (losartan potassium 50 mg tablet)</div>\"\n                },\n                \"status\": \"active\",\n                \"medicationCodeableConcept\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"96309000\",\n                            \"display\": \"Product containing losartan (medicinal product)\"\n                        }\n                    ],\n                    \"text\": \"losartan potassium 50 mg tablet\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-02-21\",\n                \"informationSource\": {\n                    \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                },\n                \"dosage\": [\n                    {\n                        \"text\": \"Take ONE tablet daily\",\n                        \"timing\": {\n                            \"repeat\": {\n                                \"frequency\": 1,\n                                \"period\": 1,\n                                \"periodUnit\": \"d\"\n                            }\n                        },\n                        \"route\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"26643006\",\n                                    \"display\": \"Oral route\"\n                                }\n                            ]\n                        },\n                        \"doseAndRate\": [\n                            {\n                                \"type\": {\n                                    \"coding\": [\n                                        {\n                                            \"system\": \"http://terminology.hl7.org/CodeSystem/dose-rate-type\",\n                                            \"code\": \"ordered\",\n                                            \"display\": \"Ordered\"\n                                        }\n                                    ]\n                                },\n                                \"doseQuantity\": {\n                                    \"value\": 1,\n                                    \"unit\": \"Tablet - unit of product usage\",\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"428673006\"\n                                }\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/MedicationStatement/b6b49f33-a0e4-4b94-92f3-caa3267ad4f7\",\n            \"resource\": {\n                \"resourceType\": \"MedicationStatement\",\n                \"id\": \"b6b49f33-a0e4-4b94-92f3-caa3267ad4f7\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>10077081000116106 (aspirin 75 mg tablet: enteric-coated)</div>\"\n                },\n                \"status\": \"active\",\n                \"medicationCodeableConcept\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"7947003\",\n                            \"display\": \"Product containing aspirin (medicinal product)\"\n                        }\n                    ],\n                    \"text\": \"aspirin 75 mg tablet: enteric-coated\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-02-21\",\n                \"informationSource\": {\n                    \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                },\n                \"dosage\": [\n                    {\n                        \"text\": \"Take ONE tablet daily\",\n                        \"timing\": {\n                            \"repeat\": {\n                                \"frequency\": 1,\n                                \"period\": 1,\n                                \"periodUnit\": \"d\"\n                            }\n                        },\n                        \"route\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"26643006\",\n                                    \"display\": \"Oral route\"\n                                }\n                            ]\n                        },\n                        \"doseAndRate\": [\n                            {\n                                \"type\": {\n                                    \"coding\": [\n                                        {\n                                            \"system\": \"http://terminology.hl7.org/CodeSystem/dose-rate-type\",\n                                            \"code\": \"ordered\",\n                                            \"display\": \"Ordered\"\n                                        }\n                                    ]\n                                },\n                                \"doseQuantity\": {\n                                    \"value\": 1,\n                                    \"unit\": \"Tablet - unit of product usage\",\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"428673006\"\n                                }\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/MedicationStatement/ce2395b9-d7ef-4df0-b38f-fc9be0e44f94\",\n            \"resource\": {\n                \"resourceType\": \"MedicationStatement\",\n                \"id\": \"ce2395b9-d7ef-4df0-b38f-fc9be0e44f94\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>10030521000116104 (allopurinol 300 mg tablet)</div>\"\n                },\n                \"status\": \"active\",\n                \"medicationCodeableConcept\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"25246002\",\n                            \"display\": \"Product containing allopurinol (medicinal product)\"\n                        }\n                    ],\n                    \"text\": \"allopurinol 300 mg tablet\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-02-21\",\n                \"informationSource\": {\n                    \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                },\n                \"dosage\": [\n                    {\n                        \"text\": \"Take ONE tablet daily, after meals\",\n                        \"timing\": {\n                            \"repeat\": {\n                                \"frequency\": 1,\n                                \"period\": 1,\n                                \"periodUnit\": \"d\"\n                            }\n                        },\n                        \"route\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"26643006\",\n                                    \"display\": \"Oral route\"\n                                }\n                            ]\n                        },\n                        \"doseAndRate\": [\n                            {\n                                \"type\": {\n                                    \"coding\": [\n                                        {\n                                            \"system\": \"http://terminology.hl7.org/CodeSystem/dose-rate-type\",\n                                            \"code\": \"ordered\",\n                                            \"display\": \"Ordered\"\n                                        }\n                                    ]\n                                },\n                                \"doseQuantity\": {\n                                    \"value\": 1,\n                                    \"unit\": \"Tablet - unit of product usage\",\n                                    \"system\": \"http://snomed.info/sct\",\n                                    \"code\": \"428673006\"\n                                }\n                            }\n                        ]\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Immunization/998e59d9-a7f4-4503-b08e-85ce9b206b0a\",\n            \"resource\": {\n                \"resourceType\": \"Immunization\",\n                \"id\": \"998e59d9-a7f4-4503-b08e-85ce9b206b0a\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>208 (Pfizer/BioNtech)</div>\"\n                },\n                \"status\": \"completed\",\n                \"vaccineCode\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://hl7.org/fhir/sid/cvx\",\n                            \"code\": \"208\",\n                            \"display\": \"SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 30 mcg/0.3mL dose\"\n                        }\n                    ]\n                },\n                \"patient\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"occurrenceDateTime\": \"2022-02-01\",\n                \"site\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"16217701000119102\",\n                            \"display\": \"Structure of left deltoid muscle\"\n                        }\n                    ]\n                },\n                \"route\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration\",\n                            \"code\": \"IM\",\n                            \"display\": \"Injection, intramuscular\"\n                        }\n                    ]\n                },\n                \"performer\": [\n                    {\n                        \"actor\": {\n                            \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                        }\n                    }\n                ],\n                \"protocolApplied\": [\n                    {\n                        \"series\": \"12 (At risk, no previous history)\",\n                        \"doseNumberPositiveInt\": 2\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Immunization/fc6b3454-527b-4deb-a266-7f52c63d0d3c\",\n            \"resource\": {\n                \"resourceType\": \"Immunization\",\n                \"id\": \"fc6b3454-527b-4deb-a266-7f52c63d0d3c\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>208 (Pfizer/BioNtech)</div>\"\n                },\n                \"status\": \"completed\",\n                \"vaccineCode\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://hl7.org/fhir/sid/cvx\",\n                            \"code\": \"208\",\n                            \"display\": \"SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 30 mcg/0.3mL dose\"\n                        }\n                    ]\n                },\n                \"patient\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"occurrenceDateTime\": \"2021-08-05\",\n                \"site\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"16217701000119102\",\n                            \"display\": \"Structure of left deltoid muscle\"\n                        }\n                    ]\n                },\n                \"route\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration\",\n                            \"code\": \"IM\",\n                            \"display\": \"Injection, intramuscular\"\n                        }\n                    ]\n                },\n                \"performer\": [\n                    {\n                        \"actor\": {\n                            \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                        }\n                    }\n                ],\n                \"protocolApplied\": [\n                    {\n                        \"series\": \"12 (At risk, no previous history)\",\n                        \"doseNumberPositiveInt\": 1\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Immunization/33c971d3-0992-4e93-b904-6325ed4602e3\",\n            \"resource\": {\n                \"resourceType\": \"Immunization\",\n                \"id\": \"33c971d3-0992-4e93-b904-6325ed4602e3\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>99006 (Influenza)</div>\"\n                },\n                \"status\": \"completed\",\n                \"vaccineCode\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://hl7.org/fhir/sid/cvx\",\n                            \"code\": \"141\",\n                            \"display\": \"Influenza, seasonal, injectable\"\n                        }\n                    ]\n                },\n                \"patient\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"occurrenceDateTime\": \"2019-05-20\",\n                \"site\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"16217701000119102\",\n                            \"display\": \"Structure of left deltoid muscle\"\n                        }\n                    ]\n                },\n                \"route\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration\",\n                            \"code\": \"IM\",\n                            \"display\": \"Injection, intramuscular\"\n                        }\n                    ]\n                },\n                \"performer\": [\n                    {\n                        \"actor\": {\n                            \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                        }\n                    }\n                ],\n                \"protocolApplied\": [\n                    {\n                        \"series\": \"1 (Over 65 years (Influenza))\",\n                        \"doseNumberPositiveInt\": 1\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Immunization/12c253d4-20e8-4dd4-935c-fd1ec8a49279\",\n            \"resource\": {\n                \"resourceType\": \"Immunization\",\n                \"id\": \"12c253d4-20e8-4dd4-935c-fd1ec8a49279\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>20 (DTaP)</div>\"\n                },\n                \"status\": \"completed\",\n                \"vaccineCode\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://hl7.org/fhir/sid/cvx\",\n                            \"code\": \"20\",\n                            \"display\": \"diphtheria, tetanus toxoids and acellular pertussis vaccine\"\n                        }\n                    ]\n                },\n                \"patient\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"occurrenceDateTime\": \"2019-04-24\",\n                \"site\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"16217701000119102\",\n                            \"display\": \"Structure of left deltoid muscle\"\n                        }\n                    ]\n                },\n                \"route\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration\",\n                            \"code\": \"IM\",\n                            \"display\": \"Injection, intramuscular\"\n                        }\n                    ]\n                },\n                \"performer\": [\n                    {\n                        \"actor\": {\n                            \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                        }\n                    }\n                ],\n                \"protocolApplied\": [\n                    {\n                        \"series\": \"6 (Booster)\",\n                        \"doseNumberPositiveInt\": 1\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Immunization/70308bba-2bc4-4505-ba9b-520f9d3dc30b\",\n            \"resource\": {\n                \"resourceType\": \"Immunization\",\n                \"id\": \"70308bba-2bc4-4505-ba9b-520f9d3dc30b\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'> [Tetanus booster (given as DT)]</div>\"\n                },\n                \"status\": \"completed\",\n                \"vaccineCode\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://hl7.org/fhir/sid/cvx\",\n                            \"code\": \"138\",\n                            \"display\": \"tetanus and diphtheria toxoids, not adsorbed, for adult use\"\n                        }\n                    ]\n                },\n                \"patient\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"occurrenceDateTime\": \"2018-04-05\",\n                \"site\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"16217701000119102\",\n                            \"display\": \"Structure of left deltoid muscle\"\n                        }\n                    ]\n                },\n                \"route\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration\",\n                            \"code\": \"IM\",\n                            \"display\": \"Injection, intramuscular\"\n                        }\n                    ]\n                },\n                \"performer\": [\n                    {\n                        \"actor\": {\n                            \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                        }\n                    }\n                ],\n                \"protocolApplied\": [\n                    {\n                        \"series\": \"6 (Booster)\",\n                        \"doseNumberPositiveInt\": 1\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Immunization/acd3a963-0985-4679-a126-8eb9ed981d36\",\n            \"resource\": {\n                \"resourceType\": \"Immunization\",\n                \"id\": \"acd3a963-0985-4679-a126-8eb9ed981d36\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>133 (PCV13)</div>\"\n                },\n                \"status\": \"completed\",\n                \"vaccineCode\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://hl7.org/fhir/sid/cvx\",\n                            \"code\": \"133\",\n                            \"display\": \"pneumococcal conjugate vaccine, 13 valent\"\n                        }\n                    ]\n                },\n                \"patient\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"occurrenceDateTime\": \"2015-09-25\",\n                \"site\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"16217701000119102\",\n                            \"display\": \"Structure of left deltoid muscle\"\n                        }\n                    ]\n                },\n                \"route\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration\",\n                            \"code\": \"IM\",\n                            \"display\": \"Injection, intramuscular\"\n                        }\n                    ]\n                },\n                \"performer\": [\n                    {\n                        \"actor\": {\n                            \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                        }\n                    }\n                ],\n                \"protocolApplied\": [\n                    {\n                        \"series\": \"21 (PCV catch up)\",\n                        \"doseNumberPositiveInt\": 1\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Immunization/bae44614-43cc-4df4-94b3-c26d34b0ea37\",\n            \"resource\": {\n                \"resourceType\": \"Immunization\",\n                \"id\": \"bae44614-43cc-4df4-94b3-c26d34b0ea37\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>99006 (Influenza)</div>\"\n                },\n                \"status\": \"completed\",\n                \"vaccineCode\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://hl7.org/fhir/sid/cvx\",\n                            \"code\": \"141\",\n                            \"display\": \"Influenza, seasonal, injectable\"\n                        }\n                    ]\n                },\n                \"patient\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"occurrenceDateTime\": \"2015-05-01\",\n                \"site\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"16217701000119102\",\n                            \"display\": \"Structure of left deltoid muscle\"\n                        }\n                    ]\n                },\n                \"route\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration\",\n                            \"code\": \"IM\",\n                            \"display\": \"Injection, intramuscular\"\n                        }\n                    ]\n                },\n                \"performer\": [\n                    {\n                        \"actor\": {\n                            \"reference\": \"Organization/644f2fb9-c264-4c32-898b-4048dddd6d1b\"\n                        }\n                    }\n                ],\n                \"protocolApplied\": [\n                    {\n                        \"series\": \"1 (Over 65 years (Influenza))\",\n                        \"doseNumberPositiveInt\": 1\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Procedure/8414198c-a43b-4ef1-b06f-3b39fb4b39cc\",\n            \"resource\": {\n                \"resourceType\": \"Procedure\",\n                \"id\": \"8414198c-a43b-4ef1-b06f-3b39fb4b39cc\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Operative procedure on hip</div>\"\n                },\n                \"status\": \"unknown\",\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"265132005\",\n                            \"display\": \"Primary open reduction and internal fixation of proximal femoral fracture with screw/nail and plate device\"\n                        }\n                    ],\n                    \"text\": \"Operative procedure on hip\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"performedDateTime\": \"2020-09-01\",\n                \"location\": {\n                    \"reference\": \"Location/F05076-A\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Procedure/1096ab80-e982-41b3-85c2-8e1d2466d147\",\n            \"resource\": {\n                \"resourceType\": \"Procedure\",\n                \"id\": \"1096ab80-e982-41b3-85c2-8e1d2466d147\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Hand closure</div>\"\n                },\n                \"status\": \"unknown\",\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://snomed.info/sct\",\n                            \"code\": \"287903004\",\n                            \"display\": \"Suturing of hand\"\n                        }\n                    ],\n                    \"text\": \"Hand closure\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"performedDateTime\": \"2018-03-31\"\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/DiagnosticReport/9e0d995f-a78d-45f4-b3aa-23037972a3e6\",\n            \"resource\": {\n                \"resourceType\": \"DiagnosticReport\",\n                \"id\": \"9e0d995f-a78d-45f4-b3aa-23037972a3e6\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'> [Lipids]</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/v2-0074\",\n                                \"code\": \"LAB\",\n                                \"display\": \"Laboratory\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"text\": \"[Lipids]\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"result\": [\n                    {\n                        \"reference\": \"Observation/2f3ad263-1b4e-443b-95ca-66d2abb6e927\"\n                    },\n                    {\n                        \"reference\": \"Observation/fe53810f-a341-4093-a959-4048ad62f85b\"\n                    },\n                    {\n                        \"reference\": \"Observation/6adb76b4-73f3-4552-87a6-09ac3dc1f558\"\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/DiagnosticReport/2da4116e-7158-4d59-b6c4-873b37f7d65f\",\n            \"resource\": {\n                \"resourceType\": \"DiagnosticReport\",\n                \"id\": \"2da4116e-7158-4d59-b6c4-873b37f7d65f\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'> [HbA1C]</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/v2-0074\",\n                                \"code\": \"LAB\",\n                                \"display\": \"Laboratory\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"text\": \"[HbA1C]\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"result\": [\n                    {\n                        \"reference\": \"Observation/63ad8984-003c-4e44-bc56-31dd6abc0897\"\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/2f3ad263-1b4e-443b-95ca-66d2abb6e927\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"2f3ad263-1b4e-443b-95ca-66d2abb6e927\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'> [Total cholesterol:HDL ratio]</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"laboratory\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"text\": \"[Total cholesterol:HDL ratio]\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/8363e64e-f639-4f55-bd3c-6302bf87a6d3\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 5.1,\n                    \"unit\": \"mmol/L\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"mmol/L\"\n                },\n                \"interpretation\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n                                \"code\": \"H\",\n                                \"display\": \"High\"\n                            }\n                        ]\n                    }\n                ],\n                \"referenceRange\": [\n                    {\n                        \"text\": \"<4 mmol/L (high risk)\"\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/fe53810f-a341-4093-a959-4048ad62f85b\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"fe53810f-a341-4093-a959-4048ad62f85b\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'> [HDL Cholesterol]</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"laboratory\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"text\": \"[HDL Cholesterol]\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/8363e64e-f639-4f55-bd3c-6302bf87a6d3\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 1.5,\n                    \"unit\": \"mmol/L\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"mmol/L\"\n                },\n                \"interpretation\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n                                \"code\": \"N\",\n                                \"display\": \"Normal\"\n                            }\n                        ]\n                    }\n                ],\n                \"referenceRange\": [\n                    {\n                        \"text\": \">1 mmol/L\"\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/6adb76b4-73f3-4552-87a6-09ac3dc1f558\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"6adb76b4-73f3-4552-87a6-09ac3dc1f558\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'> [LDL Cholesterol]</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"laboratory\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"text\": \"[LDL Cholesterol]\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/8363e64e-f639-4f55-bd3c-6302bf87a6d3\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 3.4,\n                    \"unit\": \"mmol/L\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"mmol/L\"\n                },\n                \"interpretation\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n                                \"code\": \"H\",\n                                \"display\": \"High\"\n                            }\n                        ]\n                    }\n                ],\n                \"referenceRange\": [\n                    {\n                        \"text\": \"<1.8 mmol/L\"\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/63ad8984-003c-4e44-bc56-31dd6abc0897\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"63ad8984-003c-4e44-bc56-31dd6abc0897\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'> [HbA1c]</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"laboratory\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"text\": \"[HbA1c]\"\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/8363e64e-f639-4f55-bd3c-6302bf87a6d3\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 60,\n                    \"unit\": \"mmol/mol\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"mmol/mol\"\n                },\n                \"interpretation\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n                                \"code\": \"H\",\n                                \"display\": \"High\"\n                            }\n                        ]\n                    }\n                ],\n                \"referenceRange\": [\n                    {\n                        \"text\": \"50 – 55 mmol/mol (diabetes)\"\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/6f64547c-89a3-459d-a993-b89e995c1f14\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"6f64547c-89a3-459d-a993-b89e995c1f14\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Body temperature</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"8310-5\",\n                            \"display\": \"Body temperature\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-09-29T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 37.5,\n                    \"unit\": \"Cel\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"Cel\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/da3bbb11-e485-4396-a25c-611354789c65\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"da3bbb11-e485-4396-a25c-611354789c65\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Heart rate</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"8867-4\",\n                            \"display\": \"Heart rate\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-09-29T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 84,\n                    \"unit\": \"/min\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"/min\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/5dead0bd-80c7-42f7-9720-3aaf047eb89b\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"5dead0bd-80c7-42f7-9720-3aaf047eb89b\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Respiratory rate</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"9279-1\",\n                            \"display\": \"Respiratory rate\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-09-29T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 18,\n                    \"unit\": \"/min\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"/min\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/126f25f0-d921-4d9a-85a2-5b847cfb89fb\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"126f25f0-d921-4d9a-85a2-5b847cfb89fb\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Blood pressure panel with all children optional</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"85354-9\",\n                            \"display\": \"Blood pressure panel with all children optional\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-09-29T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"component\": [\n                    {\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"8480-6\",\n                                    \"display\": \"Systolic blood pressure\"\n                                }\n                            ]\n                        },\n                        \"valueQuantity\": {\n                            \"value\": 136,\n                            \"unit\": \"mmHg\",\n                            \"system\": \"http://unitsofmeasure.org\",\n                            \"code\": \"mm[Hg]\"\n                        }\n                    },\n                    {\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"8462-4\",\n                                    \"display\": \"Diastolic blood pressure\"\n                                }\n                            ]\n                        },\n                        \"valueQuantity\": {\n                            \"value\": 88,\n                            \"unit\": \"mmHg\",\n                            \"system\": \"http://unitsofmeasure.org\",\n                            \"code\": \"mm[Hg]\"\n                        }\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/cf628f81-f66b-42a7-a33a-c5d38a604861\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"cf628f81-f66b-42a7-a33a-c5d38a604861\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Body height</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"8302-2\",\n                            \"display\": \"Body height\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-09-29T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 1.84,\n                    \"unit\": \"cm\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"cm\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/dd309bef-3b36-4422-a202-39d040113a5d\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"dd309bef-3b36-4422-a202-39d040113a5d\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Body weight</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"29463-7\",\n                            \"display\": \"Body weight\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-09-29T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 104,\n                    \"unit\": \"kg\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"kg\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/4c5e0a16-2e2c-47cc-8e1d-a87afee4d6f1\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"4c5e0a16-2e2c-47cc-8e1d-a87afee4d6f1\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Body temperature</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"8310-5\",\n                            \"display\": \"Body temperature\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 37.2,\n                    \"unit\": \"Cel\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"Cel\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/eda3092b-5228-420b-b0ce-f5eb77e73942\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"eda3092b-5228-420b-b0ce-f5eb77e73942\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Heart rate</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"8867-4\",\n                            \"display\": \"Heart rate\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 86,\n                    \"unit\": \"/min\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"/min\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/2d420435-f380-46e1-ad93-b9fef57f4b71\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"2d420435-f380-46e1-ad93-b9fef57f4b71\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Respiratory rate</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"9279-1\",\n                            \"display\": \"Respiratory rate\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 14,\n                    \"unit\": \"/min\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"/min\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/7a422837-80f5-4fa6-b3ac-8a0e44b99356\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"7a422837-80f5-4fa6-b3ac-8a0e44b99356\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Blood pressure panel with all children optional</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"85354-9\",\n                            \"display\": \"Blood pressure panel with all children optional\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"component\": [\n                    {\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"8480-6\",\n                                    \"display\": \"Systolic blood pressure\"\n                                }\n                            ]\n                        },\n                        \"valueQuantity\": {\n                            \"value\": 130,\n                            \"unit\": \"mmHg\",\n                            \"system\": \"http://unitsofmeasure.org\",\n                            \"code\": \"mm[Hg]\"\n                        }\n                    },\n                    {\n                        \"code\": {\n                            \"coding\": [\n                                {\n                                    \"system\": \"http://loinc.org\",\n                                    \"code\": \"8462-4\",\n                                    \"display\": \"Diastolic blood pressure\"\n                                }\n                            ]\n                        },\n                        \"valueQuantity\": {\n                            \"value\": 82,\n                            \"unit\": \"mmHg\",\n                            \"system\": \"http://unitsofmeasure.org\",\n                            \"code\": \"mm[Hg]\"\n                        }\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/af9ae822-ae5d-4bec-88bf-4dd250350783\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"af9ae822-ae5d-4bec-88bf-4dd250350783\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Body weight</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"vital-signs\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"29463-7\",\n                            \"display\": \"Body weight\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2023-03-05T00:00:00+00:00\",\n                \"performer\": [\n                    {\n                        \"reference\": \"PractitionerRole/c9288aea-5e73-4182-8231-aacbe50d3244\"\n                    }\n                ],\n                \"valueQuantity\": {\n                    \"value\": 103,\n                    \"unit\": \"kg\",\n                    \"system\": \"http://unitsofmeasure.org\",\n                    \"code\": \"kg\"\n                }\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/Observation/33624327-7e1b-4912-bca1-2d0c8d36b952\",\n            \"resource\": {\n                \"resourceType\": \"Observation\",\n                \"id\": \"33624327-7e1b-4912-bca1-2d0c8d36b952\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Tobacco smoking status</div>\"\n                },\n                \"status\": \"final\",\n                \"category\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n                                \"code\": \"social-history\"\n                            }\n                        ]\n                    }\n                ],\n                \"code\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"72166-2\",\n                            \"display\": \"Tobacco smoking status\"\n                        }\n                    ]\n                },\n                \"subject\": {\n                    \"reference\": \"Patient/ZKT9319\"\n                },\n                \"effectiveDateTime\": \"2005-06-30\",\n                \"performer\": [\n                    {\n                        \"reference\": \"Patient/ZKT9319\"\n                    }\n                ],\n                \"valueCodeableConcept\": {\n                    \"coding\": [\n                        {\n                            \"system\": \"http://loinc.org\",\n                            \"code\": \"LA15920-4\",\n                            \"display\": \"Former smoker\"\n                        }\n                    ]\n                },\n                \"note\": [\n                    {\n                        \"text\": \"30 - pack - year smoking history, quit smoking ~2005.\"\n                    }\n                ]\n            }\n        },\n        {\n            \"fullUrl\": \"https://terminz.azurewebsites.net/fhir/PractitionerRole/8363e64e-f639-4f55-bd3c-6302bf87a6d3\",\n            \"resource\": {\n                \"resourceType\": \"PractitionerRole\",\n                \"id\": \"8363e64e-f639-4f55-bd3c-6302bf87a6d3\",\n                \"text\": {\n                    \"status\": \"generated\",\n                    \"div\": \"<div xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-NZ'>Role: Clinical pathologist</div>\"\n                },\n                \"code\": [\n                    {\n                        \"coding\": [\n                            {\n                                \"system\": \"http://snomed.info/sct\",\n                                \"code\": \"81464008\",\n                                \"display\": \"Clinical pathologist\"\n                            }\n                        ]\n                    }\n                ]\n            }\n        }\n    ]\n}",
+      "fileType": null
+    }
+  ]
+}
\ No newline at end of file
diff --git a/http-client-tests/resources/base-engine-requests/ips.json b/http-client-tests/resources/base-engine-requests/ips.json
new file mode 100644
index 00000000..ec046d68
--- /dev/null
+++ b/http-client-tests/resources/base-engine-requests/ips.json
@@ -0,0 +1,29 @@
+{
+  "cliContext": {
+    "extensions": [
+      "any"
+    ],
+    "sv": "4.0.1",
+    "igs": [
+      "hl7.fhir.uv.ips#1.1.0"
+    ],
+    "profiles": [
+      "http://hl7.org/fhir/uv/ips/StructureDefinition/Bundle-uv-ips"
+    ],
+    "checkIPSCodes": true,
+    "bundleValidationRules": [
+      {
+        "rule": "Composition:0",
+        "profile": "http://hl7.org/fhir/uv/ips/StructureDefinition/Composition-uv-ips"
+      }
+    ],
+    "locale": "en"
+  },
+  "filesToValidate": [
+    {
+      "fileName": "manually_entered_file.json",
+      "fileContent": "{\n  \"resourceType\" : \"Bundle\",\n  \"id\" : \"bundle-minimal\",\n  \"language\" : \"en-US\",\n  \"identifier\" : {\n    \"system\" : \"urn:oid:2.16.724.4.8.10.200.10\",\n    \"value\" : \"28b95815-76ce-457b-b7ae-a972e527db40\"\n  },\n  \"type\" : \"document\",\n  \"timestamp\" : \"2020-12-11T14:30:00+01:00\",\n  \"entry\" : [{\n    \"fullUrl\" : \"urn:uuid:6e1fb74a-742b-4c7b-8487-171dacb88766\",\n    \"resource\" : {\n      \"resourceType\" : \"Composition\",\n      \"id\" : \"6e1fb74a-742b-4c7b-8487-171dacb88766\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative</b></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource \\\"6e1fb74a-742b-4c7b-8487-171dacb88766\\\" </p></div><p><b>status</b>: final</p><p><b>type</b>: Patient summary Document <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://loinc.org/\\\">LOINC</a>#60591-5)</span></p><p><b>date</b>: 2020-12-11 02:30:00+0100</p><p><b>author</b>: Beetje van Hulp, MD </p><p><b>title</b>: Patient Summary as of December 11, 2020 14:30</p><p><b>confidentiality</b>: N</p><blockquote><p><b>attester</b></p><p><b>mode</b>: legal</p><p><b>time</b>: 2020-12-11 02:30:00+0100</p><p><b>party</b>: Beetje van Hulp, MD </p></blockquote><blockquote><p><b>attester</b></p><p><b>mode</b>: legal</p><p><b>time</b>: 2020-12-11 02:30:00+0100</p><p><b>party</b>: Anorg Aniza Tion BV </p></blockquote><p><b>custodian</b>: Anorg Aniza Tion BV</p><h3>RelatesTos</h3><table class=\\\"grid\\\"><tr><td>-</td><td><b>Code</b></td><td><b>Target[x]</b></td></tr><tr><td>*</td><td>appends</td><td>id: 20e12ce3-857f-49c0-b888-cb670597f191</td></tr></table><h3>Events</h3><table class=\\\"grid\\\"><tr><td>-</td><td><b>Code</b></td><td><b>Period</b></td></tr><tr><td>*</td><td>care provision <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/CodeSystem/v3-ActClass\\\">ActClass</a>#PCPR)</span></td><td>?? --&gt; 2020-12-11 02:30:00+0100</td></tr></table></div>\"\n      },\n      \"status\" : \"final\",\n      \"type\" : {\n        \"coding\" : [{\n          \"system\" : \"http://loinc.org\",\n          \"code\" : \"60591-5\",\n          \"display\" : \"Patient summary Document\"\n        }]\n      },\n      \"subject\" : {\n        \"reference\" : \"Patient/7685713c-e29e-4a75-8a90-45be7ba3be94\"\n      },\n      \"date\" : \"2020-12-11T14:30:00+01:00\",\n      \"author\" : [{\n        \"reference\" : \"Practitioner/98315ba9-ffea-41ef-b59b-a836c039858f\"\n      }],\n      \"title\" : \"Patient Summary as of December 11, 2020 14:30\",\n      \"confidentiality\" : \"N\",\n      \"attester\" : [{\n        \"mode\" : \"legal\",\n        \"time\" : \"2020-12-11T14:30:00+01:00\",\n        \"party\" : {\n          \"reference\" : \"Practitioner/98315ba9-ffea-41ef-b59b-a836c039858f\"\n        }\n      },\n      {\n        \"mode\" : \"legal\",\n        \"time\" : \"2020-12-11T14:30:00+01:00\",\n        \"party\" : {\n          \"reference\" : \"Organization/bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d\"\n        }\n      }],\n      \"custodian\" : {\n        \"reference\" : \"Organization/bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d\"\n      },\n      \"relatesTo\" : [{\n        \"code\" : \"appends\",\n        \"targetIdentifier\" : {\n          \"system\" : \"urn:oid:2.16.724.4.8.10.200.10\",\n          \"value\" : \"20e12ce3-857f-49c0-b888-cb670597f191\"\n        }\n      }],\n      \"event\" : [{\n        \"code\" : [{\n          \"coding\" : [{\n            \"system\" : \"http://terminology.hl7.org/CodeSystem/v3-ActClass\",\n            \"code\" : \"PCPR\"\n          }]\n        }],\n        \"period\" : {\n          \"end\" : \"2020-12-11T14:30:00+01:00\"\n        }\n      }],\n      \"section\" : [{\n        \"title\" : \"Active Problems\",\n        \"code\" : {\n          \"coding\" : [{\n            \"system\" : \"http://loinc.org\",\n            \"code\" : \"11450-4\",\n            \"display\" : \"Problem list Reported\"\n          }]\n        },\n        \"text\" : {\n          \"status\" : \"generated\",\n          \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><ul><li><div><b>Condition Name</b>: Menopausal Flushing</div><div><b>Code</b>: <span>198436008</span></div><div><b>Status</b>: <span>Active</span></div></li></ul></div>\"\n        },\n        \"entry\" : [{\n          \"reference\" : \"Condition/ad84b7a2-b4dd-474e-bef3-0779e6cb595f\"\n        }]\n      },\n      {\n        \"title\" : \"Medication\",\n        \"code\" : {\n          \"coding\" : [{\n            \"system\" : \"http://loinc.org\",\n            \"code\" : \"10160-0\",\n            \"display\" : \"History of Medication use Narrative\"\n          }]\n        },\n        \"text\" : {\n          \"status\" : \"generated\",\n          \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><ul><li><div><b>Medication Name</b>: Oral anastrozole 1mg tablet</div><div><b>Code</b>: <span></span></div><div><b>Status</b>: <span>Active, started March 2015</span></div><div>Instructions: Take 1 time per day</div></li></ul></div>\"\n        },\n        \"entry\" : [{\n          \"reference\" : \"MedicationStatement/6e883e5e-7648-485a-86de-3640a61601fe\"\n        }]\n      },\n      {\n        \"title\" : \"Allergies and Intolerances\",\n        \"code\" : {\n          \"coding\" : [{\n            \"system\" : \"http://loinc.org\",\n            \"code\" : \"48765-2\",\n            \"display\" : \"Allergies and adverse reactions Document\"\n          }]\n        },\n        \"text\" : {\n          \"status\" : \"generated\",\n          \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><ul><li><div><b>Allergy Name</b>: Pencillins</div><div><b>Verification Status</b>: Confirmed</div><div><b>Reaction</b>: <span>no information</span></div></li></ul></div>\"\n        },\n        \"entry\" : [{\n          \"reference\" : \"AllergyIntolerance/fe2769fd-22c9-4307-9122-ee0466e5aebb\"\n        }]\n      }]\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:7685713c-e29e-4a75-8a90-45be7ba3be94\",\n    \"resource\" : {\n      \"resourceType\" : \"Patient\",\n      \"id\" : \"7685713c-e29e-4a75-8a90-45be7ba3be94\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: Patient</b><a name=\\\"7685713c-e29e-4a75-8a90-45be7ba3be94\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource Patient &quot;7685713c-e29e-4a75-8a90-45be7ba3be94&quot; </p></div><p><b>identifier</b>: id:\\u00a0574687583</p><p><b>active</b>: true</p><p><b>name</b>: Martha DeLarosa </p><p><b>telecom</b>: <a href=\\\"tel:+31788700800\\\">+31788700800</a></p><p><b>gender</b>: female</p><p><b>birthDate</b>: 1972-05-01</p><p><b>address</b>: Laan Van Europa 1600 Dordrecht 3317 DB NL </p><h3>Contacts</h3><table class=\\\"grid\\\"><tr><td style=\\\"display: none\\\">-</td><td><b>Relationship</b></td><td><b>Name</b></td><td><b>Telecom</b></td><td><b>Address</b></td></tr><tr><td style=\\\"display: none\\\">*</td><td>mother <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-v3-RoleCode.html\\\">RoleCode</a>#MTH)</span></td><td>Martha Mum </td><td><a href=\\\"tel:+33-555-20036\\\">+33-555-20036</a></td><td>Promenade des Anglais 111 Lyon 69001 FR </td></tr></table></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:2.16.840.1.113883.2.4.6.3\",\n        \"value\" : \"574687583\"\n      }],\n      \"active\" : true,\n      \"name\" : [{\n        \"family\" : \"DeLarosa\",\n        \"given\" : [\"Martha\"]\n      }],\n      \"telecom\" : [{\n        \"system\" : \"phone\",\n        \"value\" : \"+31788700800\",\n        \"use\" : \"home\"\n      }],\n      \"gender\" : \"female\",\n      \"birthDate\" : \"1972-05-01\",\n      \"address\" : [{\n        \"line\" : [\"Laan Van Europa 1600\"],\n        \"city\" : \"Dordrecht\",\n        \"postalCode\" : \"3317 DB\",\n        \"country\" : \"NL\"\n      }],\n      \"contact\" : [{\n        \"relationship\" : [{\n          \"coding\" : [{\n            \"system\" : \"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n            \"code\" : \"MTH\"\n          }]\n        }],\n        \"name\" : {\n          \"family\" : \"Mum\",\n          \"given\" : [\"Martha\"]\n        },\n        \"telecom\" : [{\n          \"system\" : \"phone\",\n          \"value\" : \"+33-555-20036\",\n          \"use\" : \"home\"\n        }],\n        \"address\" : {\n          \"line\" : [\"Promenade des Anglais 111\"],\n          \"city\" : \"Lyon\",\n          \"postalCode\" : \"69001\",\n          \"country\" : \"FR\"\n        }\n      }]\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:98315ba9-ffea-41ef-b59b-a836c039858f\",\n    \"resource\" : {\n      \"resourceType\" : \"Practitioner\",\n      \"id\" : \"98315ba9-ffea-41ef-b59b-a836c039858f\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: Practitioner</b><a name=\\\"98315ba9-ffea-41ef-b59b-a836c039858f\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource Practitioner &quot;98315ba9-ffea-41ef-b59b-a836c039858f&quot; </p></div><p><b>identifier</b>: id:\\u00a0129854633</p><p><b>active</b>: true</p><p><b>name</b>: Beetje van Hulp </p><h3>Qualifications</h3><table class=\\\"grid\\\"><tr><td style=\\\"display: none\\\">-</td><td><b>Code</b></td></tr><tr><td style=\\\"display: none\\\">*</td><td>Doctor of Medicine <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (degreeLicenseCertificate[2.7]#MD)</span></td></tr></table></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:2.16.528.1.1007.3.1\",\n        \"value\" : \"129854633\",\n        \"assigner\" : {\n          \"display\" : \"CIBG\"\n        }\n      }],\n      \"active\" : true,\n      \"name\" : [{\n        \"family\" : \"van Hulp\",\n        \"given\" : [\"Beetje\"]\n      }],\n      \"qualification\" : [{\n        \"code\" : {\n          \"coding\" : [{\n            \"system\" : \"http://terminology.hl7.org/CodeSystem/v2-0360\",\n            \"version\" : \"2.7\",\n            \"code\" : \"MD\",\n            \"display\" : \"Doctor of Medicine\"\n          }]\n        }\n      }]\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d\",\n    \"resource\" : {\n      \"resourceType\" : \"Organization\",\n      \"id\" : \"bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: Organization</b><a name=\\\"bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource Organization &quot;bb6bdf4f-7fcb-4d44-96a5-b858ad031d1d&quot; </p></div><p><b>identifier</b>: id:\\u00a0564738757</p><p><b>active</b>: true</p><p><b>name</b>: Anorg Aniza Tion BV / The best custodian ever</p><p><b>telecom</b>: <a href=\\\"tel:+31-51-34343400\\\">+31-51-34343400</a></p><p><b>address</b>: Houttuinen 27 Dordrecht 3311 CE NL (WORK)</p></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:2.16.528.1.1007.3.3\",\n        \"value\" : \"564738757\"\n      }],\n      \"active\" : true,\n      \"name\" : \"Anorg Aniza Tion BV / The best custodian ever\",\n      \"telecom\" : [{\n        \"system\" : \"phone\",\n        \"value\" : \"+31-51-34343400\",\n        \"use\" : \"work\"\n      }],\n      \"address\" : [{\n        \"use\" : \"work\",\n        \"line\" : [\"Houttuinen 27\"],\n        \"city\" : \"Dordrecht\",\n        \"postalCode\" : \"3311 CE\",\n        \"country\" : \"NL\"\n      }]\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:ad84b7a2-b4dd-474e-bef3-0779e6cb595f\",\n    \"resource\" : {\n      \"resourceType\" : \"Condition\",\n      \"id\" : \"ad84b7a2-b4dd-474e-bef3-0779e6cb595f\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: Condition</b><a name=\\\"ad84b7a2-b4dd-474e-bef3-0779e6cb595f\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource Condition &quot;ad84b7a2-b4dd-474e-bef3-0779e6cb595f&quot; </p></div><p><b>identifier</b>: id:\\u00a0cacceb57-395f-48e1-9c88-e9c9704dc2d2</p><p><b>clinicalStatus</b>: Active <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-condition-clinical.html\\\">Condition Clinical Status Codes</a>#active)</span></p><p><b>verificationStatus</b>: Confirmed <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-condition-ver-status.html\\\">ConditionVerificationStatus</a>#confirmed)</span></p><p><b>category</b>: Problem <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://loinc.org/\\\">LOINC</a>#75326-9)</span></p><p><b>severity</b>: Moderate <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://loinc.org/\\\">LOINC</a>#LA6751-7)</span></p><p><b>code</b>: Menopausal flushing (finding) <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://browser.ihtsdotools.org/\\\">SNOMED CT</a>#198436008; <a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-icd10.html\\\">ICD-10</a>#N95.1 &quot;Menopausal and female climacteric states&quot;)</span></p><p><b>subject</b>: <a href=\\\"#Patient_7685713c-e29e-4a75-8a90-45be7ba3be94\\\">See above (Patient/7685713c-e29e-4a75-8a90-45be7ba3be94)</a></p><p><b>onset</b>: 2015</p><p><b>recordedDate</b>: 2016-10</p></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:1.2.3.999\",\n        \"value\" : \"cacceb57-395f-48e1-9c88-e9c9704dc2d2\"\n      }],\n      \"clinicalStatus\" : {\n        \"coding\" : [{\n          \"system\" : \"http://terminology.hl7.org/CodeSystem/condition-clinical\",\n          \"code\" : \"active\"\n        }]\n      },\n      \"verificationStatus\" : {\n        \"coding\" : [{\n          \"system\" : \"http://terminology.hl7.org/CodeSystem/condition-ver-status\",\n          \"code\" : \"confirmed\"\n        }]\n      },\n      \"category\" : [{\n        \"coding\" : [{\n          \"system\" : \"http://loinc.org\",\n          \"code\" : \"75326-9\",\n          \"display\" : \"Problem\"\n        }]\n      }],\n      \"severity\" : {\n        \"coding\" : [{\n          \"system\" : \"http://loinc.org\",\n          \"code\" : \"LA6751-7\",\n          \"display\" : \"Moderate\"\n        }]\n      },\n      \"code\" : {\n        \"coding\" : [{\n          \"system\" : \"http://snomed.info/sct\",\n          \"code\" : \"198436008\",\n          \"display\" : \"Menopausal flushing (finding)\",\n          \"_display\" : {\n            \"extension\" : [{\n              \"extension\" : [{\n                \"url\" : \"lang\",\n                \"valueCode\" : \"nl-NL\"\n              },\n              {\n                \"url\" : \"content\",\n                \"valueString\" : \"opvliegers\"\n              }],\n              \"url\" : \"http://hl7.org/fhir/StructureDefinition/translation\"\n            }]\n          }\n        },\n        {\n          \"system\" : \"http://hl7.org/fhir/sid/icd-10\",\n          \"code\" : \"N95.1\",\n          \"display\" : \"Menopausal and female climacteric states\"\n        }]\n      },\n      \"subject\" : {\n        \"reference\" : \"Patient/7685713c-e29e-4a75-8a90-45be7ba3be94\"\n      },\n      \"onsetDateTime\" : \"2015\",\n      \"recordedDate\" : \"2016-10\"\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:6e883e5e-7648-485a-86de-3640a61601fe\",\n    \"resource\" : {\n      \"resourceType\" : \"MedicationStatement\",\n      \"id\" : \"6e883e5e-7648-485a-86de-3640a61601fe\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: MedicationStatement</b><a name=\\\"6e883e5e-7648-485a-86de-3640a61601fe\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource MedicationStatement &quot;6e883e5e-7648-485a-86de-3640a61601fe&quot; </p></div><p><b>identifier</b>: id:\\u00a08faf0319-89d3-427c-b9d1-e8c8fd390dca</p><p><b>status</b>: active</p><p><b>medication</b>: <a href=\\\"#Medication_6369a973-afc7-4617-8877-3e9811e05a5b\\\">See above (Medication/6369a973-afc7-4617-8877-3e9811e05a5b)</a></p><p><b>subject</b>: <a href=\\\"#Patient_7685713c-e29e-4a75-8a90-45be7ba3be94\\\">See above (Patient/7685713c-e29e-4a75-8a90-45be7ba3be94)</a></p><p><b>effective</b>: 2015-03 --&gt; (ongoing)</p><blockquote><p><b>dosage</b></p><p><b>timing</b>: Count 1 times, Once</p><p><b>route</b>: Oral use <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (standardterms.edqm.eu#20053000)</span></p><blockquote><p><b>doseAndRate</b></p></blockquote></blockquote></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:1.2.3.999\",\n        \"value\" : \"8faf0319-89d3-427c-b9d1-e8c8fd390dca\"\n      }],\n      \"status\" : \"active\",\n      \"medicationReference\" : {\n        \"reference\" : \"Medication/6369a973-afc7-4617-8877-3e9811e05a5b\"\n      },\n      \"subject\" : {\n        \"reference\" : \"Patient/7685713c-e29e-4a75-8a90-45be7ba3be94\"\n      },\n      \"effectivePeriod\" : {\n        \"start\" : \"2015-03\"\n      },\n      \"dosage\" : [{\n        \"timing\" : {\n          \"repeat\" : {\n            \"count\" : 1,\n            \"periodUnit\" : \"d\"\n          }\n        },\n        \"route\" : {\n          \"coding\" : [{\n            \"system\" : \"http://standardterms.edqm.eu\",\n            \"code\" : \"20053000\",\n            \"display\" : \"Oral use\"\n          }]\n        },\n        \"doseAndRate\" : [{\n          \"type\" : {\n            \"coding\" : [{\n              \"system\" : \"http://terminology.hl7.org/CodeSystem/dose-rate-type\",\n              \"code\" : \"ordered\",\n              \"display\" : \"Ordered\"\n            }]\n          },\n          \"doseQuantity\" : {\n            \"value\" : 1,\n            \"unit\" : \"tablet\",\n            \"system\" : \"http://unitsofmeasure.org\",\n            \"code\" : \"1\"\n          }\n        }]\n      }]\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:6369a973-afc7-4617-8877-3e9811e05a5b\",\n    \"resource\" : {\n      \"resourceType\" : \"Medication\",\n      \"id\" : \"6369a973-afc7-4617-8877-3e9811e05a5b\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: Medication</b><a name=\\\"6369a973-afc7-4617-8877-3e9811e05a5b\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource Medication &quot;6369a973-afc7-4617-8877-3e9811e05a5b&quot; </p></div><p><b>code</b>: Product containing anastrozole (medicinal product) <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://browser.ihtsdotools.org/\\\">SNOMED CT</a>#108774000; unknown#99872 &quot;ANASTROZOL 1MG TABLET&quot;; unknown#2076667 &quot;ANASTROZOL CF TABLET FILMOMHULD 1MG&quot;; <a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-v3-WC.html\\\">WHO ATC</a>#L02BG03 &quot;anastrozole&quot;)</span></p></div>\"\n      },\n      \"code\" : {\n        \"coding\" : [{\n          \"system\" : \"http://snomed.info/sct\",\n          \"code\" : \"108774000\",\n          \"display\" : \"Product containing anastrozole (medicinal product)\"\n        },\n        {\n          \"system\" : \"urn:oid:2.16.840.1.113883.2.4.4.1\",\n          \"code\" : \"99872\",\n          \"display\" : \"ANASTROZOL 1MG TABLET\"\n        },\n        {\n          \"system\" : \"urn:oid:2.16.840.1.113883.2.4.4.7\",\n          \"code\" : \"2076667\",\n          \"display\" : \"ANASTROZOL CF TABLET FILMOMHULD 1MG\"\n        },\n        {\n          \"system\" : \"http://www.whocc.no/atc\",\n          \"code\" : \"L02BG03\",\n          \"display\" : \"anastrozole\"\n        }]\n      }\n    }\n  },\n  {\n    \"fullUrl\" : \"urn:uuid:fe2769fd-22c9-4307-9122-ee0466e5aebb\",\n    \"resource\" : {\n      \"resourceType\" : \"AllergyIntolerance\",\n      \"id\" : \"fe2769fd-22c9-4307-9122-ee0466e5aebb\",\n      \"text\" : {\n        \"status\" : \"generated\",\n        \"div\" : \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative: AllergyIntolerance</b><a name=\\\"fe2769fd-22c9-4307-9122-ee0466e5aebb\\\"> </a></p><div style=\\\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\\\"><p style=\\\"margin-bottom: 0px\\\">Resource AllergyIntolerance &quot;fe2769fd-22c9-4307-9122-ee0466e5aebb&quot; </p></div><p><b>identifier</b>: id:\\u00a08d9566a4-d26d-46be-a3e4-c9f3a0e5cd83</p><p><b>clinicalStatus</b>: Active <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-allergyintolerance-clinical.html\\\">AllergyIntolerance Clinical Status Codes</a>#active)</span></p><p><b>verificationStatus</b>: Confirmed <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"http://terminology.hl7.org/5.3.0/CodeSystem-allergyintolerance-verification.html\\\">AllergyIntolerance Verification Status</a>#confirmed)</span></p><p><b>type</b>: allergy</p><p><b>category</b>: medication</p><p><b>criticality</b>: high</p><p><b>code</b>: Substance with penicillin structure and antibacterial mechanism of action (substance) <span style=\\\"background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki\\\"> (<a href=\\\"https://browser.ihtsdotools.org/\\\">SNOMED CT</a>#373270004)</span></p><p><b>patient</b>: <a href=\\\"#Patient_7685713c-e29e-4a75-8a90-45be7ba3be94\\\">See above (Patient/7685713c-e29e-4a75-8a90-45be7ba3be94)</a></p><p><b>onset</b>: 2010</p></div>\"\n      },\n      \"identifier\" : [{\n        \"system\" : \"urn:oid:1.2.3.999\",\n        \"value\" : \"8d9566a4-d26d-46be-a3e4-c9f3a0e5cd83\"\n      }],\n      \"clinicalStatus\" : {\n        \"coding\" : [{\n          \"system\" : \"http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical\",\n          \"code\" : \"active\"\n        }]\n      },\n      \"verificationStatus\" : {\n        \"coding\" : [{\n          \"system\" : \"http://terminology.hl7.org/CodeSystem/allergyintolerance-verification\",\n          \"code\" : \"confirmed\"\n        }]\n      },\n      \"type\" : \"allergy\",\n      \"category\" : [\"medication\"],\n      \"criticality\" : \"high\",\n      \"code\" : {\n        \"coding\" : [{\n          \"system\" : \"http://snomed.info/sct\",\n          \"code\" : \"373270004\",\n          \"display\" : \"Substance with penicillin structure and antibacterial mechanism of action (substance)\"\n        }]\n      },\n      \"patient\" : {\n        \"reference\" : \"Patient/7685713c-e29e-4a75-8a90-45be7ba3be94\"\n      },\n      \"onsetDateTime\" : \"2010\"\n    }\n  }]\n}",
+      "fileType": null
+    }
+  ]
+}
\ No newline at end of file
diff --git a/http-client-tests/resources/base-engine-requests/sql-on-fhir.json b/http-client-tests/resources/base-engine-requests/sql-on-fhir.json
new file mode 100644
index 00000000..b4a2db2b
--- /dev/null
+++ b/http-client-tests/resources/base-engine-requests/sql-on-fhir.json
@@ -0,0 +1,16 @@
+{
+  "cliContext": {
+    "sv": "5.0.0",
+    "igs": [
+      "hl7.fhir.uv.sql-on-fhir#current"
+    ],
+    "locale": "en"
+  },
+  "filesToValidate": [
+    {
+      "fileName": "manually_entered_file.json",
+      "fileContent": "{\n    \"resourceType\": \"http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition\",\n    \"select\": [\n      {\n        \"column\": [\n          {\n            \"path\": \"getResourceKey()\",\n            \"name\": \"patient_id\"\n          }\n        ]\n      },\n      {\n        \"column\": [\n          {\n            \"path\": \"line.join('\\n')\",\n            \"name\": \"street\",\n            \"description\": \"The full street address, including newlines if present.\"\n          },\n          {\n            \"path\": \"use\",\n            \"name\": \"use\"\n          },\n          {\n            \"path\": \"city\",\n            \"name\": \"city\"\n          },\n          {\n            \"path\": \"postalCode\",\n            \"name\": \"zip\"\n          }\n        ],\n        \"forEach\": \"address\"\n      }\n    ],\n    \"name\": \"patient_addresses\",\n    \"status\": \"draft\",\n    \"resource\": \"Patient\"\n  }",
+      "fileType": null
+    }
+  ]
+}
\ No newline at end of file
diff --git a/http-client-tests/resources/base-engine-requests/us-ccda.json b/http-client-tests/resources/base-engine-requests/us-ccda.json
new file mode 100644
index 00000000..e5d0832f
--- /dev/null
+++ b/http-client-tests/resources/base-engine-requests/us-ccda.json
@@ -0,0 +1,16 @@
+{
+  "cliContext": {
+    "sv": "5.0.0",
+    "igs": [
+      "hl7.cda.us.ccda#3.0.0-ballot"
+    ],
+    "locale": "en"
+  },
+  "filesToValidate": [
+    {
+      "fileName": "manually_entered_file.xml",
+      "fileContent": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<?xml-stylesheet type=\"text/xsl\" href=\"CDA.xsl\"?>\n<!--\n Title:        Care Plan\n Filename:     C-CDA_R2_Care_Plan.xml\n Created by:   Lantana Consulting Group, LLC\n \n $LastChangedDate: 2014-11-12 23:25:09 -0500 (Wed, 12 Nov 2014) $\n  \n ********************************************************\n Disclaimer: This sample file contains representative data elements to represent a Care Plan. \n The file depicts a fictional character's health data. Any resemblance to a real person is coincidental. \n To illustrate as many data elements as possible, the clinical scenario may not be plausible. \n The data in this sample file is not intended to represent real patients, people or clinical events. \n This sample is designed to be used in conjunction with the C-CDA Clinical Notes Implementation Guide.\n ********************************************************\n  -->\n<ClinicalDocument xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:hl7-org:v3\" xmlns:voc=\"urn:hl7-org:v3/voc\" xmlns:sdtc=\"urn:hl7-org:sdtc\">\n\t<!-- ** CDA Header ** -->\n\t<realmCode code=\"US\"/>\n\t<typeId root=\"2.16.840.1.113883.1.3\" extension=\"POCD_HD000040\"/>\n  <!-- US Realm Header -->\n  <templateId root=\"2.16.840.1.113883.10.20.22.1.1\" extension=\"2023-05-01\"/>\n  <!-- Care Plan -->\n\t<templateId root=\"2.16.840.1.113883.10.20.22.1.15\" extension=\"2015-08-01\"/>\n\t<id root=\"db734647-fc99-424c-a864-7e3cda82e703\"/>\n\t<code code=\"52521-2\" codeSystem=\"2.16.840.1.113883.6.1\" codeSystemName=\"LOINC\" displayName=\"Overall Plan of Care/Advance Care Directives\"/>\n\t<title>Good Health Hospital Care Plan</title>\n\t<effectiveTime value=\"201308201120-0800\"/>\n\t<confidentialityCode code=\"N\" codeSystem=\"2.16.840.1.113883.5.25\"/>\n\t<languageCode code=\"en-US\"/>\n\t<!-- This document is the second document in the set (see setId for id for the set -->\n\t<setId root=\"004bb033-b948-4f4c-b5bf-a8dbd7d8dd40\"/>\n\t<!-- See relatedDocument for the previous version in the set -->\n\t<versionNumber value=\"2\"/>\n\t<!-- Patient (recordTarget) -->\n\t<recordTarget>\n\t\t<patientRole>\n\t\t\t<id extension=\"444222222\" root=\"2.16.840.1.113883.4.1\"/>\n\t\t\t<!-- Example Social Security Number using the actual SSN OID. -->\n\t\t\t<addr use=\"HP\">\n\t\t\t\t<!-- HP is \"primary home\" from codeSystem 2.16.840.1.113883.5.1119 -->\n\t\t\t\t<streetAddressLine>2222 Home Street</streetAddressLine>\n\t\t\t\t<city>Beaverton</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>97867</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t\t<!-- US is \"United States\" from ISO 3166-1 Country Codes: 1.0.3166.1 -->\n\t\t\t</addr>\n\t\t\t<telecom value=\"tel:+1(555)555-2003\" use=\"HP\"/>\n\t\t\t<!-- HP is \"primary home\" from HL7 AddressUse 2.16.840.1.113883.5.1119 -->\n\t\t\t<patient>\n\t\t\t\t<!-- The first name element represents what the patient is known as -->\n\t\t\t\t<name use=\"L\">\n\t\t\t\t\t<given>Eve</given>\n\t\t\t\t\t<!-- The \"SP\" is \"Spouse\" from HL7 Code System EntityNamePartQualifier 2.16.840.1.113883.5.43 -->\n\t\t\t\t\t<family qualifier=\"SP\">Betterhalf</family>\n\t\t\t\t</name>\n\t\t\t\t<!-- The second name element represents another name associated with the patient -->\n\t\t\t\t<name use=\"SRCH\">\n\t\t\t\t\t<given>Eve</given>\n\t\t\t\t\t<!-- The \"BR\" is \"Birth\" from HL7 Code System EntityNamePartQualifier 2.16.840.1.113883.5.43 -->\n\t\t\t\t\t<family qualifier=\"BR\">Everywoman</family>\n\t\t\t\t</name>\n\t\t\t\t<administrativeGenderCode code=\"F\" displayName=\"Female\" codeSystem=\"2.16.840.1.113883.5.1\" codeSystemName=\"AdministrativeGender\"/>\n\t\t\t\t<!-- Date of birth need only be precise to the day -->\n\t\t\t\t<birthTime value=\"19750501\"/>\n\t\t\t\t<maritalStatusCode code=\"M\" displayName=\"Married\" codeSystem=\"2.16.840.1.113883.5.2\" codeSystemName=\"MaritalStatusCode\"/>\n\t\t\t\t<religiousAffiliationCode code=\"1013\" displayName=\"Christian (non-Catholic, non-specific)\" codeSystem=\"2.16.840.1.113883.5.1076\" codeSystemName=\"HL7 Religious Affiliation\"/>\n\t\t\t\t<!-- CDC Race and Ethnicity code set contains the five minimum race and ethnicity categories defined by OMB Standards -->\n\t\t\t\t<raceCode code=\"2106-3\" displayName=\"White\" codeSystem=\"2.16.840.1.113883.6.238\" codeSystemName=\"Race &amp; Ethnicity - CDC\"/>\n\t\t\t\t<!-- The raceCode extension is only used if raceCode is valued -->\n\t\t\t\t<sdtc:raceCode code=\"2076-8\" displayName=\"Hawaiian or Other Pacific Islander\" codeSystem=\"2.16.840.1.113883.6.238\" codeSystemName=\"Race &amp; Ethnicity - CDC\"/>\n\t\t\t\t<ethnicGroupCode code=\"2186-5\" displayName=\"Not Hispanic or Latino\" codeSystem=\"2.16.840.1.113883.6.238\" codeSystemName=\"Race &amp; Ethnicity - CDC\"/>\n\t\t\t\t<guardian>\n\t\t\t\t\t<code code=\"POWATT\" displayName=\"Power of Attorney\" codeSystem=\"2.16.840.1.113883.1.11.19830\" codeSystemName=\"ResponsibleParty\"/>\n\t\t\t\t\t<addr use=\"HP\">\n\t\t\t\t\t\t<streetAddressLine>2222 Home Street</streetAddressLine>\n\t\t\t\t\t\t<city>Beaverton</city>\n\t\t\t\t\t\t<state>OR</state>\n\t\t\t\t\t\t<postalCode>97867</postalCode>\n\t\t\t\t\t\t<country>US</country>\n\t\t\t\t\t</addr>\n\t\t\t\t\t<telecom value=\"tel:+1(555)555-2008\" use=\"MC\"/>\n\t\t\t\t\t<guardianPerson>\n\t\t\t\t\t\t<name>\n\t\t\t\t\t\t\t<given>Boris</given>\n\t\t\t\t\t\t\t<given qualifier=\"CL\">Bo</given>\n\t\t\t\t\t\t\t<family>Betterhalf</family>\n\t\t\t\t\t\t</name>\n\t\t\t\t\t</guardianPerson>\n\t\t\t\t</guardian>\n\t\t\t\t<birthplace>\n\t\t\t\t\t<place>\n\t\t\t\t\t\t<addr>\n\t\t\t\t\t\t\t<streetAddressLine>4444 Home Street</streetAddressLine>\n\t\t\t\t\t\t\t<city>Beaverton</city>\n\t\t\t\t\t\t\t<state>OR</state>\n\t\t\t\t\t\t\t<postalCode>97867</postalCode>\n\t\t\t\t\t\t\t<country>US</country>\n\t\t\t\t\t\t</addr>\n\t\t\t\t\t</place>\n\t\t\t\t</birthplace>\n\t\t\t\t<languageCommunication>\n\t\t\t\t\t<languageCode code=\"en\"/>\n\t\t\t\t\t<modeCode code=\"ESP\" displayName=\"Expressed spoken\" codeSystem=\"2.16.840.1.113883.5.60\" codeSystemName=\"LanguageAbilityMode\"/>\n\t\t\t\t\t<proficiencyLevelCode code=\"G\" displayName=\"Good\" codeSystem=\"2.16.840.1.113883.5.61\" codeSystemName=\"LanguageAbilityProficiency\"/>\n\t\t\t\t\t<!-- Patient's preferred language -->\n\t\t\t\t\t<preferenceInd value=\"true\"/>\n\t\t\t\t</languageCommunication>\n\t\t\t</patient>\n\t\t\t<providerOrganization>\n\t\t\t\t<id extension=\"219BX\" root=\"2.16.840.1.113883.4.6\"/>\n\t\t\t\t<name>The DoctorsTogether Physician Group</name>\n\t\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)555-5000\"/>\n\t\t\t\t<addr>\n\t\t\t\t\t<streetAddressLine>1007 Health Drive</streetAddressLine>\n\t\t\t\t\t<city>Portland</city>\n\t\t\t\t\t<state>OR</state>\n\t\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t\t<country>US</country>\n\t\t\t\t</addr>\n\t\t\t</providerOrganization>\n\t\t</patientRole>\n\t</recordTarget>\n\t<!-- Author -->\n\t<author>\n\t\t<time value=\"20130730\"/>\n\t\t<assignedAuthor>\n\t\t\t<id root=\"20cf14fb-b65c-4c8c-a54d-b0cca834c18c\"/>\n\t\t\t<code code=\"163W00000X\" codeSystem=\"2.16.840.1.113883.6.101\" codeSystemName=\"Healthcare Provider Taxonomy (HIPAA)\" displayName=\"Registered nurse\"/>\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>1004 Healthcare Drive </streetAddressLine>\n\t\t\t\t<city>Portland</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)555-1004\"/>\n\t\t\t<assignedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<given>Nurse</given>\n\t\t\t\t\t<family>Nightingale</family>\n\t\t\t\t\t<suffix>RN</suffix>\n\t\t\t\t</name>\n\t\t\t</assignedPerson>\n\t\t\t<representedOrganization>\n\t\t\t\t<id root=\"2.16.840.1.113883.19.5\"/>\n\t\t\t\t<name>Good Health Hospital</name>\n\t\t\t</representedOrganization>\n\t\t</assignedAuthor>\n\t</author>\n\t<!-- Data Enterer -->\n\t<dataEnterer>\n\t\t<assignedEntity>\n\t\t\t<id extension=\"333777777\" root=\"2.16.840.1.113883.4.6\"/>\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>1007 Healthcare Drive</streetAddressLine>\n\t\t\t\t<city>Portland</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)-1050\"/>\n\t\t\t<assignedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<given>Ellen</given>\n\t\t\t\t\t<family>Enter</family>\n\t\t\t\t</name>\n\t\t\t</assignedPerson>\n\t\t</assignedEntity>\n\t</dataEnterer>\n\t<!-- Informant -->\n\t<informant>\n\t\t<assignedEntity>\n\t\t\t<id extension=\"888888888\" root=\"2.16.840.1.113883.19.5\"/>\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>1007 Healthcare Drive</streetAddressLine>\n\t\t\t\t<city>Portland</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)-1003\"/>\n\t\t\t<assignedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<given>Harold</given>\n\t\t\t\t\t<family>Hippocrates</family>\n\t\t\t\t\t<suffix qualifier=\"AC\">D.O.</suffix>\n\t\t\t\t</name>\n\t\t\t</assignedPerson>\n\t\t</assignedEntity>\n\t</informant>\n\t<!-- Custodian -->\n\t<custodian>\n\t\t<assignedCustodian>\n\t\t\t<representedCustodianOrganization>\n\t\t\t\t<id extension=\"321CX\" root=\"2.16.840.1.113883.4.6\"/>\n\t\t\t\t<name>Good Health HIE</name>\n\t\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)555-1009\"/>\n\t\t\t\t<addr use=\"WP\">\n\t\t\t\t\t<streetAddressLine>1009 Healthcare Drive </streetAddressLine>\n\t\t\t\t\t<city>Portland</city>\n\t\t\t\t\t<state>OR</state>\n\t\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t\t<country>US</country>\n\t\t\t\t</addr>\n\t\t\t</representedCustodianOrganization>\n\t\t</assignedCustodian>\n\t</custodian>\n\t<informationRecipient>\n\t\t<intendedRecipient>\n\t\t\t<!-- Receiving Person Provider Id -->\n\t\t\t<id root=\"a1cd2b74-c6de-44ee-b552-3adacb7983cc\"/>\n\t\t\t<!-- Receiving Medicare/Medicaid Provider Id-->\n\t\t\t<id root=\"c72f64c2-b1db-444b-bbff-4d2e1d6bd659\"/>\n\t\t\t<!-- Receiving Person ID-->\n\t\t\t<id root=\"fa883fee-b255-4465-8fb5-1d8135e39896\"/>\n\t\t\t<!-- Receiving Person Address-->\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>100 Better Health Rd.</streetAddressLine>\n\t\t\t\t<city>Ann Arbor</city>\n\t\t\t\t<state>MI</state>\n\t\t\t\t<postalCode>97857</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<informationRecipient>\n\t\t\t\t<!-- Receiving Person Name-->\n\t\t\t\t<name>\n\t\t\t\t\t<given>Nurse</given>\n\t\t\t\t\t<family>Caresalot</family>\n\t\t\t\t\t<suffix>RN</suffix>\n\t\t\t\t</name>\n\t\t\t</informationRecipient>\n\t\t\t<receivedOrganization>\n\t\t\t\t<!-- Receiving Organization Id-->\n\t\t\t\t<id root=\"c4c416a7-aeeb-4dcc-9662-ab836ff4d265\"/>\n\t\t\t\t<!-- Receiving Organization Provider ID (NPI) -->\n\t\t\t\t<id root=\"ab47f3c4-1267-4b9e-9a29-e966b5a861c8\"/>\n\t\t\t\t<!-- Receiving Organization Name -->\n\t\t\t\t<name>Better Health Hospital</name>\n\t\t\t\t<!-- Receiving Organization Address -->\n\t\t\t\t<addr>\n\t\t\t\t\t<streetAddressLine>100 Better Health Rd.</streetAddressLine>\n\t\t\t\t\t<city>Ann Arbor</city>\n\t\t\t\t\t<state>MI</state>\n\t\t\t\t\t<postalCode>97857</postalCode>\n\t\t\t\t\t<country>US</country>\n\t\t\t\t</addr>\n\t\t\t\t<!-- Receiving Care Setting Type Description: displayName.  Receiving Care Setting Type Code: code -->\n\t\t\t\t<standardIndustryClassCode displayName=\"Long Term Care Hospital\" code=\"282E00000X\" codeSystem=\"2.16.840.1.114222.4.11.1066\" codeSystemName=\"Healthcare Provider Taxonomy (HIPAA)\"/>\n\t\t\t</receivedOrganization>\n\t\t</intendedRecipient>\n\t</informationRecipient>\n\t<!-- Legal Authenticator -->\n\t<legalAuthenticator>\n\t\t<time value=\"20130730\"/>\n\t\t<signatureCode code=\"S\"/>\n\t\t<sdtc:signatureText mediaType=\"text/xml\" representation=\"B64\">U2lnbmVkIGJ5IE51cnNlIE5pZ2h0aW5nYWxl</sdtc:signatureText>\n\t\t<assignedEntity>\n\t\t\t<id root=\"20cf14fb-b65c-4c8c-a54d-b0cca834c18c\"/>\n\t\t\t<code code=\"163W00000X\" codeSystem=\"2.16.840.1.113883.6.101\" displayName=\"Registered nurse\"/>\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>1004 Healthcare Drive </streetAddressLine>\n\t\t\t\t<city>Portland</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)555-1004\"/>\n\t\t\t<assignedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<given>Nurse</given>\n\t\t\t\t\t<family>Nightingale</family>\n\t\t\t\t\t<suffix>RN</suffix>\n\t\t\t\t</name>\n\t\t\t</assignedPerson>\n\t\t\t<representedOrganization>\n\t\t\t\t<id root=\"2.16.840.1.113883.19.5\"/>\n\t\t\t\t<name>Good Health Hospital</name>\n\t\t\t\t<!-- the orgnaization id and name -->\n\t\t\t</representedOrganization>\n\t\t</assignedEntity>\n\t</legalAuthenticator>\n\t<!-- This authenticator represents patient agreement or sign-off of the Care Plan-->\n\t<authenticator>\n\t\t<time value=\"20130802\"/>\n\t\t<signatureCode code=\"S\"/>\n\t\t<sdtc:signatureText mediaType=\"text/xml\" representation=\"B64\">U2lnbmVkIGJ5IEV2ZSBFdmVyeXdvbWFu</sdtc:signatureText>\n\t\t<assignedEntity>\n\t\t\t<id extension=\"444222222\" root=\"2.16.840.1.113883.4.1\"/>\n\t\t\t<code code=\"ONESELF\" displayName=\"Self\" codeSystem=\"2.16.840.1.113883.5.111\" codeSystemName=\"RoleCode\"/>\n\t\t\t<addr use=\"HP\">\n\t\t\t\t<!-- HP is \"primary home\" from codeSystem 2.16.840.1.113883.5.1119 -->\n\t\t\t\t<streetAddressLine>2222 Home Street</streetAddressLine>\n\t\t\t\t<city>Beaverton</city>\n\t\t\t\t<state>OR</state>\n\t\t\t\t<postalCode>97867</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t\t<!-- US is \"United States\" from ISO 3166-1 Country Codes: 1.0.3166.1 -->\n\t\t\t</addr>\n\t\t\t<telecom value=\"tel:+1(555)555-2003\" use=\"HP\"/>\n\t\t\t<assignedPerson>\n\t\t\t\t<name use=\"L\">\n\t\t\t\t\t<given>Eve</given>\n\t\t\t\t\t<family qualifier=\"SP\">Everywoman</family>\n\t\t\t\t</name>\n\t\t\t</assignedPerson>\n\t\t</assignedEntity>\n\t</authenticator>\n\t<!-- This participant represents the person who reviewed the Care Plan. If the date in the time element is in the past, then this review has already taken place. \n         If the date in the time element is in the future, then this is the date of the next scheduled review. -->\n\t<!-- This example shows a Care Plan Review that has already taken place -->\n\t<participant typeCode=\"VRF\">\n\t\t<functionCode code=\"425268008\" codeSystem=\"2.16.840.1.113883.6.96\" codeSystemName=\"SNOMED CT\" displayName=\"Review of Care Plan\"/>\n\t\t<time value=\"20130801\"/>\n\t\t<associatedEntity classCode=\"ASSIGNED\">\n\t\t\t<id root=\"20cf14fb-b65c-4c8c-a54d-b0cca834c18c\"/>\n      <associatedPerson nullFlavor=\"NA\" />\n\t\t</associatedEntity>\n\t</participant>\n\t<!-- This participant represents the person who reviewed the Care Plan.   If the date in the time element is in the past, then this review has already taken place. \n  If the date in the time element is in the future,  then this is the date of the next scheduled review. -->\n\t<!-- This example shows a Scheduled Care Plan Review that is in the future -->\n\t<participant typeCode=\"VRF\">\n\t\t<functionCode code=\"425268008\" codeSystem=\"2.16.840.1.113883.6.96\" codeSystemName=\"SNOMED CT\" displayName=\"Review of Care Plan\"/>\n\t\t<time value=\"20131001\"/>\n\t\t<associatedEntity classCode=\"ASSIGNED\">\n\t\t\t<id root=\"20cf14fb-b65c-4c8c-a54d-b0cca834c18c\"/>\n\t\t\t<code code=\"SELF\" displayName=\"self\" codeSystem=\"2.16.840.1.113883.5.111\"/>\n      <associatedPerson nullFlavor=\"NA\" />\n\t\t</associatedEntity>\n\t</participant>\n\t<!-- This participant identifies individuals who support the patient such as a relative or caregiver -->\n\t<participant typeCode=\"IND\">\n\t\t<!-- Emergency Contact  -->\n\t\t<associatedEntity classCode=\"ECON\">\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>17 Daws Rd.</streetAddressLine>\n\t\t\t\t<city>Ann Arbor</city>\n\t\t\t\t<state>MI</state>\n\t\t\t\t<postalCode>97857</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom value=\"tel:(999)555-1212\" use=\"WP\"/>\n\t\t\t<associatedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<prefix>Mrs.</prefix>\n\t\t\t\t\t<given>Martha</given>\n\t\t\t\t\t<family>Jones</family>\n\t\t\t\t</name>\n\t\t\t</associatedPerson>\n\t\t</associatedEntity>\n\t</participant>\n\t<!-- This participant identifies individuals who support the patient such as a relative or caregiver -->\n\t<participant typeCode=\"IND\">\n\t\t<!-- Caregiver -->\n\t\t<associatedEntity classCode=\"CAREGIVER\">\n\t\t\t<addr>\n\t\t\t\t<streetAddressLine>17 Daws Rd.</streetAddressLine>\n\t\t\t\t<city>Ann Arbor</city>\n\t\t\t\t<state>MI</state>\n\t\t\t\t<postalCode>97857</postalCode>\n\t\t\t\t<country>US</country>\n\t\t\t</addr>\n\t\t\t<telecom value=\"tel:(999)555-1212\" use=\"WP\"/>\n\t\t\t<associatedPerson>\n\t\t\t\t<name>\n\t\t\t\t\t<prefix>Mrs.</prefix>\n\t\t\t\t\t<given>Martha</given>\n\t\t\t\t\t<family>Jones</family>\n\t\t\t\t</name>\n\t\t\t</associatedPerson>\n\t\t</associatedEntity>\n\t</participant>\n\t<documentationOf>\n\t\t<serviceEvent classCode=\"PCPR\">\n\t\t\t<effectiveTime>\n\t\t\t\t<low value=\"20130720\"/>\n\t\t\t\t<high value=\"20130815\"/>\n\t\t\t</effectiveTime>\n\t\t\t<!-- The performer(s) represents the healthcare providers involved in the current or historical care of the patient.\n                The patient’s key healthcare providers would be listed here which would include the primary physician and any \n                active consulting physicians, therapists, counselors, and care team members.  -->\n\t\t\t<performer typeCode=\"PRF\">\n\t\t\t\t<time value=\"20130715223615-0800\"/>\n\t\t\t\t<assignedEntity>\n\t\t\t\t\t<id extension=\"5555555555\" root=\"2.16.840.1.113883.4.6\"/>\n\t\t\t\t\t<code code=\"207QA0505X\" displayName=\"Adult Medicine\" codeSystem=\"2.16.840.1.113883.6.101\" codeSystemName=\"Healthcare Provider Taxonomy (HIPAA)\"/>\n\t\t\t\t\t<addr>\n\t\t\t\t\t\t<streetAddressLine>1004 Healthcare Drive </streetAddressLine>\n\t\t\t\t\t\t<city>Portland</city>\n\t\t\t\t\t\t<state>OR</state>\n\t\t\t\t\t\t<postalCode>99123</postalCode>\n\t\t\t\t\t\t<country>US</country>\n\t\t\t\t\t</addr>\n\t\t\t\t\t<telecom use=\"WP\" value=\"tel:+1(555)-1004\"/>\n\t\t\t\t\t<assignedPerson>\n\t\t\t\t\t\t<name>\n\t\t\t\t\t\t\t<given>Patricia</given>\n\t\t\t\t\t\t\t<given qualifier=\"CL\">Patty</given>\n\t\t\t\t\t\t\t<family>Primary</family>\n\t\t\t\t\t\t\t<suffix qualifier=\"AC\">M.D.</suffix>\n\t\t\t\t\t\t</name>\n\t\t\t\t\t</assignedPerson>\n\t\t\t\t</assignedEntity>\n\t\t\t</performer>\n\t\t</serviceEvent>\n\t</documentationOf>\n\t<!-- The Care Plan is continually evolving and dynamic. The Care Plan CDA instance \n     is NOT dynamic. Each time a Care Plan CDA is generated it represents a snapshot \n     in time of the Care Plan at that moment. Whenever a care provider or patient \n     generates a Care Plan, it should be noted through relatedDocument \n     whether the current Care Plan replaces or appends another Care Plan. \n     The relatedDocumentTypeCode indicates whether the current document is \n     an addendum to the ParentDocument (APND (append)) or the current document \n     is a replacement of the ParentDocument (RPLC (replace)). -->\n\t<!-- This document is the second in a set - relatedDocument\n      describes the parent document-->\n\t<relatedDocument typeCode=\"RPLC\">\n\t\t<parentDocument>\n\t\t\t<id root=\"223769be-f6ee-4b04-a0ce-b56ae998c880\"/>\n\t\t\t<code code=\"CarePlan-x\" codeSystem=\"2.16.840.1.113883.6.1\" codeSystemName=\"LOINC\" displayName=\"Care Plan\"/>\n\t\t\t<setId root=\"004bb033-b948-4f4c-b5bf-a8dbd7d8dd40\"/>\n\t\t\t<versionNumber value=\"1\"/>\n\t\t</parentDocument>\n\t</relatedDocument>\n\t<componentOf>\n\t\t<encompassingEncounter>\n\t\t\t<id extension=\"9937012\" root=\"2.16.840.1.113883.19\"/>\n\t\t\t<code codeSystem=\"2.16.840.1.113883.5.4\" code=\"IMP\" displayName=\"Inpatient\"/>\n\t\t\t<!-- captures that this is an inpatient encounter -->\n\t\t\t<effectiveTime>\n\t\t\t\t<low value=\"20130615\"/>\n\t\t\t\t<!-- No high value - this patient is still in hospital -->\n\t\t\t</effectiveTime>\n\t\t</encompassingEncounter>\n\t</componentOf>\n\t<!-- \n********************************************************\nCDA Body\n********************************************************\n-->\n\t<component>\n    <structuredBody>\n\t\t<!-- ***************** PROBLEM LIST *********************** -->\n\t\t<component>\n\t\t\t<!-- nullFlavor of NI indicates No Information.-->\n\t\t\t<!-- Note this pattern may not validate with schematron but has been SDWG approved -->\n\t\t\t<section nullFlavor=\"NI\">\n\t\t\t\t<!-- conforms to Problems section with entries required -->\n\t\t\t\t<templateId root=\"2.16.840.1.113883.10.20.22.2.5.1\" extension=\"2014-06-09\"/>\n\t\t\t\t<code code=\"11450-4\" codeSystem=\"2.16.840.1.113883.6.1\" codeSystemName=\"LOINC\" displayName=\"PROBLEM LIST\"/>\n\t\t\t\t<title>PROBLEMS</title>\n\t\t\t\t<text>No Information</text>\n\t\t\t</section>\n\t\t</component>\n    </structuredBody>\n\t</component>\n</ClinicalDocument>",
+      "fileType": null
+    }
+  ]
+}
\ No newline at end of file

From 5c1eddcafedc1740e03a829f9d482af01189f313 Mon Sep 17 00:00:00 2001
From: dotasek <david.otasek@smilecdr.com>
Date: Wed, 29 May 2024 14:14:25 -0400
Subject: [PATCH 08/22] Engines + config enhancements

Load presets in separate thread.

Track presets via StatusApi and only show loaded engines.

Set language from current session when selecting preset

Refactor config for application wide access
---
 gradle.properties                             |  2 +-
 src/commonMain/kotlin/constants/Endpoints.kt  |  3 +-
 src/commonMain/kotlin/constants/Preset.kt     |  4 +-
 src/jsMain/kotlin/api/StatusApi.kt            |  5 ++
 .../reactredux/containers/FileUploadTab.kt    |  3 +
 .../reactredux/containers/ManualEntryTab.kt   |  3 +
 .../ui/components/options/PresetSelect.kt     | 32 ++++++++---
 .../tabs/entrytab/ManualEntryTab.kt           |  8 +--
 .../tabs/uploadtab/FileUploadTab.kt           |  3 +
 src/jvmMain/kotlin/Config.kt                  |  1 +
 src/jvmMain/kotlin/Module.kt                  |  4 +-
 src/jvmMain/kotlin/Server.kt                  | 24 +-------
 .../kotlin/ValidatorApplicationConfig.kt      | 35 ++++++++++++
 .../validation/ValidationController.kt        |  2 +
 .../validation/ValidationControllerImpl.kt    |  4 ++
 .../controller/validation/ValidationModule.kt |  5 ++
 .../ValidationServiceFactoryImpl.kt           | 57 ++++++++++---------
 src/jvmMain/resources/application.conf        |  2 +
 18 files changed, 129 insertions(+), 68 deletions(-)
 create mode 100644 src/jvmMain/kotlin/Config.kt
 create mode 100644 src/jvmMain/kotlin/ValidatorApplicationConfig.kt

diff --git a/gradle.properties b/gradle.properties
index 6e4f05d4..7dfcde79 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -2,7 +2,7 @@ kotlin.code.style=official
 kotlin.js.generate.executable.default=false
 
 # versions
-fhirCoreVersion=6.3.6
+fhirCoreVersion=6.3.11-SNAPSHOT
 
 junitVersion=5.7.1
 mockk_version=1.10.2
diff --git a/src/commonMain/kotlin/constants/Endpoints.kt b/src/commonMain/kotlin/constants/Endpoints.kt
index 709f0f8d..e32019b2 100644
--- a/src/commonMain/kotlin/constants/Endpoints.kt
+++ b/src/commonMain/kotlin/constants/Endpoints.kt
@@ -2,7 +2,8 @@ package constants
 
 const val VALIDATION_ENDPOINT = "validate"
 const val VALIDATOR_VERSION_ENDPOINT = "validator/version"
-const val CONTEXT_ENDPOINT = "context"
+const val VALIDATION_ENGINES_ENDPOINT = "validator/engines"
+
 const val IG_ENDPOINT = "ig"
 const val IG_VERSIONS_ENDPOINT = "igVersions"
 const val VERSIONS_ENDPOINT = "versions"
diff --git a/src/commonMain/kotlin/constants/Preset.kt b/src/commonMain/kotlin/constants/Preset.kt
index 78cf0989..42274cf0 100644
--- a/src/commonMain/kotlin/constants/Preset.kt
+++ b/src/commonMain/kotlin/constants/Preset.kt
@@ -142,6 +142,7 @@ enum class Preset(
         setOf(ANY_EXTENSION),
         setOf(IPS_BUNDLE_PROFILE)
     ),
+
     IPS_AU(
         "IPS_AU",
         "preset_ips_au",
@@ -181,8 +182,7 @@ enum class Preset(
         setOf(SQL_ON_FHIR_IG),
         setOf(),
         setOf()
-    )
-    ;
+    );
 
     companion object {
         fun getSelectedPreset(key: String?): Preset? {
diff --git a/src/jsMain/kotlin/api/StatusApi.kt b/src/jsMain/kotlin/api/StatusApi.kt
index 6e70c4b2..76b6c867 100644
--- a/src/jsMain/kotlin/api/StatusApi.kt
+++ b/src/jsMain/kotlin/api/StatusApi.kt
@@ -2,6 +2,7 @@ package api
 
 import constants.PACKAGES_SERVER_STATUS_ENDPOINT
 import constants.TX_SERVER_STATUS_ENDPOINT
+import constants.VALIDATION_ENGINES_ENDPOINT
 import io.ktor.client.call.*
 import io.ktor.client.request.*
 
@@ -9,6 +10,10 @@ suspend fun isTerminologyServerUp(): Boolean {
     return jsonClient.get(urlString = endpoint + TX_SERVER_STATUS_ENDPOINT).body()
 }
 
+suspend fun getValidationEngines(): Set<String> {
+    return jsonClient.get(urlString = endpoint + VALIDATION_ENGINES_ENDPOINT).body()
+}
+
 suspend fun isPackagesServerUp(): Boolean {
     return jsonClient.get(urlString = endpoint + PACKAGES_SERVER_STATUS_ENDPOINT).body()
 }
diff --git a/src/jsMain/kotlin/reactredux/containers/FileUploadTab.kt b/src/jsMain/kotlin/reactredux/containers/FileUploadTab.kt
index 807f2f68..0cf637b4 100644
--- a/src/jsMain/kotlin/reactredux/containers/FileUploadTab.kt
+++ b/src/jsMain/kotlin/reactredux/containers/FileUploadTab.kt
@@ -13,11 +13,13 @@ import reactredux.store.AppState
 import redux.RAction
 import redux.WrapperAction
 import ui.components.tabs.uploadtab.FileUploadTab
+import utils.Language
 
 private interface FileUploadTabProps : Props {
     var uploadedFiles: List<ValidationOutcome>
     var cliContext: CliContext
     var sessionId: String
+    var language: Language
     var polyglot: Polyglot
 }
 
@@ -41,6 +43,7 @@ val fileUploadTab: ComponentClass<Props> =
             uploadedFiles = state.uploadedResourceSlice.uploadedFiles
             cliContext = state.validationContextSlice.cliContext
             sessionId = state.validationSessionSlice.sessionId
+            language = state.localizationSlice.selectedLanguage
             polyglot = state.localizationSlice.polyglotInstance
         },
         { dispatch, _ ->
diff --git a/src/jsMain/kotlin/reactredux/containers/ManualEntryTab.kt b/src/jsMain/kotlin/reactredux/containers/ManualEntryTab.kt
index 0919f977..16cba831 100644
--- a/src/jsMain/kotlin/reactredux/containers/ManualEntryTab.kt
+++ b/src/jsMain/kotlin/reactredux/containers/ManualEntryTab.kt
@@ -17,12 +17,14 @@ import redux.RAction
 import redux.WrapperAction
 import ui.components.tabs.entrytab.ManualEntryTab
 import ui.components.tabs.entrytab.ManualEntryTabProps
+import utils.Language
 
 private interface ManualEntryTabStateProps : Props {
     var cliContext: CliContext
     var validationOutcome: ValidationOutcome?
     var currentManuallyEnteredText: String
     var validatingManualEntryInProgress: Boolean
+    var language: Language
     var polyglot: Polyglot
     var sessionId: String
 }
@@ -46,6 +48,7 @@ val manualEntryTab: ComponentClass<Props> =
             validationOutcome = state.manualEntrySlice.validationOutcome
             currentManuallyEnteredText = state.manualEntrySlice.currentManuallyEnteredText
             validatingManualEntryInProgress = state.manualEntrySlice.validatingManualEntryInProgress
+            language = state.localizationSlice.selectedLanguage
             polyglot = state.localizationSlice.polyglotInstance
             sessionId = state.validationSessionSlice.sessionId
         },
diff --git a/src/jsMain/kotlin/ui/components/options/PresetSelect.kt b/src/jsMain/kotlin/ui/components/options/PresetSelect.kt
index 7001d4f1..1f8494c5 100644
--- a/src/jsMain/kotlin/ui/components/options/PresetSelect.kt
+++ b/src/jsMain/kotlin/ui/components/options/PresetSelect.kt
@@ -1,6 +1,7 @@
 package ui.components.options
 
 import Polyglot
+import api.getValidationEngines
 import mui.material.*
 import react.*
 import csstype.px
@@ -18,6 +19,7 @@ import styled.css
 import styled.styledDiv
 
 import constants.Preset
+import utils.Language
 import utils.getJS
 
 
@@ -29,17 +31,25 @@ external interface PresetSelectProps : Props {
     var updateProfileSet: (Set<String>) -> Unit
     var updateBundleValidationRuleSet: (Set<BundleValidationRule>) -> Unit
     var setSessionId: (String) -> Unit
+    var language: Language
     var polyglot: Polyglot
 }
 
 class PresetSelectState : State {
     var snackbarOpen : String? = null
+    var validationEngines: Set<String> = emptySet()
 }
 
 class PresetSelect : RComponent<PresetSelectProps, PresetSelectState>() {
 
     init {
         state = PresetSelectState()
+        mainScope.launch {
+            val loadedValidationEngines = getValidationEngines()
+            setState {
+                validationEngines = loadedValidationEngines
+            }
+        }
     }
 
     fun handleSnackBarClose() {
@@ -86,7 +96,8 @@ class PresetSelect : RComponent<PresetSelectProps, PresetSelectState>() {
                                     val selectedPreset = Preset.getSelectedPreset(event.target.value)
                                     if (selectedPreset != null) {
                                         console.log("updating cli context for preset: " + event.target.value)
-                                        props.updateCliContext(selectedPreset.cliContext)
+                                        val cliContext = selectedPreset.cliContext.setLocale(props.language.getLanguageCode())
+                                        props.updateCliContext(cliContext)
                                         props.updateIgPackageInfoSet(selectedPreset.igPackageInfo)
                                         props.updateExtensionSet(selectedPreset.extensionSet)
                                         props.updateProfileSet(selectedPreset.profileSet)
@@ -105,14 +116,19 @@ class PresetSelect : RComponent<PresetSelectProps, PresetSelectState>() {
                             }
 
                             Preset.values().forEach {
-
-                                MenuItem {
-                                    attrs {
-                                        value = it.key
-                                        selected = it.key.equals(props.cliContext.getBaseEngine())
+                                if (state.validationEngines.contains(it.key)) {
+                                    MenuItem {
+                                        attrs {
+                                            value = it.key
+                                            selected = it.key.equals(props.cliContext.getBaseEngine())
+                                        }
+                                        +props.polyglot.t(it.polyglotKey)
+                                        console.log(
+                                            it.key + " " + props.cliContext.getBaseEngine() + ":" + it.key.equals(
+                                                props.cliContext.getBaseEngine()
+                                            )
+                                        )
                                     }
-                                    +props.polyglot.t(it.polyglotKey)
-                                    console.log(it.key + " " + props.cliContext.getBaseEngine() + ":" + it.key.equals(props.cliContext.getBaseEngine() ))
                                 }
                             }
                         }
diff --git a/src/jsMain/kotlin/ui/components/tabs/entrytab/ManualEntryTab.kt b/src/jsMain/kotlin/ui/components/tabs/entrytab/ManualEntryTab.kt
index dbbe929a..76a51a87 100644
--- a/src/jsMain/kotlin/ui/components/tabs/entrytab/ManualEntryTab.kt
+++ b/src/jsMain/kotlin/ui/components/tabs/entrytab/ManualEntryTab.kt
@@ -23,10 +23,7 @@ import ui.components.options.presetSelect
 import ui.components.tabs.heading
 
 import ui.components.validation.validationOutcomeContainer
-import utils.assembleRequest
-import utils.getJS
-import utils.isJson
-import utils.isXml
+import utils.*
 
 //TODO make this an intelligent value
 private const val VALIDATION_TIME_LIMIT =  120000L
@@ -36,9 +33,9 @@ external interface ManualEntryTabProps : Props {
     var validationOutcome: ValidationOutcome?
     var currentManuallyEnteredText: String
     var validatingManualEntryInProgress: Boolean
+    var language: Language
     var polyglot: Polyglot
     var sessionId: String
-
     var setValidationOutcome: (ValidationOutcome) -> Unit
     var toggleValidationInProgress: (Boolean) -> Unit
     var updateCurrentlyEnteredText: (String) -> Unit
@@ -124,6 +121,7 @@ class ManualEntryTab : RComponent<ManualEntryTabProps, ManualEntryTabState>() {
                     updateProfileSet = props.updateProfileSet
                     updateBundleValidationRuleSet = props.updateBundleValidationRuleSet
                     setSessionId = props.setSessionId
+                    language = props.language
                     polyglot = props.polyglot
                 }
             }
diff --git a/src/jsMain/kotlin/ui/components/tabs/uploadtab/FileUploadTab.kt b/src/jsMain/kotlin/ui/components/tabs/uploadtab/FileUploadTab.kt
index 38d979dd..f2ad26dd 100644
--- a/src/jsMain/kotlin/ui/components/tabs/uploadtab/FileUploadTab.kt
+++ b/src/jsMain/kotlin/ui/components/tabs/uploadtab/FileUploadTab.kt
@@ -18,12 +18,14 @@ import ui.components.options.presetSelect
 import ui.components.tabs.heading
 import ui.components.tabs.uploadtab.filelist.fileEntryList
 import ui.components.validation.validationOutcomePopup
+import utils.Language
 import utils.assembleRequest
 
 external interface FileUploadTabProps : Props {
     var uploadedFiles: List<ValidationOutcome>
     var cliContext: CliContext
     var sessionId: String
+    var language: Language
     var polyglot: Polyglot
 
     var deleteFile: (FileInfo) -> Unit
@@ -110,6 +112,7 @@ class FileUploadTab : RComponent<FileUploadTabProps, FileUploadTabState>() {
                     updateProfileSet = props.updateProfileSet
                     updateBundleValidationRuleSet = props.updateBundleValidationRuleSet
                     setSessionId = props.setSessionId
+                    language = props.language
                     polyglot = props.polyglot
                 }
             }
diff --git a/src/jvmMain/kotlin/Config.kt b/src/jvmMain/kotlin/Config.kt
new file mode 100644
index 00000000..0de8b955
--- /dev/null
+++ b/src/jvmMain/kotlin/Config.kt
@@ -0,0 +1 @@
+data class Config(val host: String, val port: Int, val engineReloadThreshold : Int)
diff --git a/src/jvmMain/kotlin/Module.kt b/src/jvmMain/kotlin/Module.kt
index f4ce4e2b..3549add6 100644
--- a/src/jvmMain/kotlin/Module.kt
+++ b/src/jvmMain/kotlin/Module.kt
@@ -9,12 +9,14 @@ import controller.version.versionModule
 import desktop.launchLocalApp
 import io.ktor.server.application.*
 import io.ktor.server.plugins.callloging.*
-import io.ktor.server.plugins.cors.*
+
 import io.ktor.server.plugins.compression.*
 import io.ktor.server.plugins.contentnegotiation.*
 import io.ktor.http.*
 import io.ktor.server.http.content.*
 import io.ktor.serialization.jackson.*
+
+import io.ktor.server.plugins.cors.routing.*
 import io.ktor.server.response.*
 import io.ktor.server.routing.*
 
diff --git a/src/jvmMain/kotlin/Server.kt b/src/jvmMain/kotlin/Server.kt
index 92e24cb7..f425da8c 100644
--- a/src/jvmMain/kotlin/Server.kt
+++ b/src/jvmMain/kotlin/Server.kt
@@ -1,11 +1,8 @@
 import api.ApiInjection
-import com.typesafe.config.ConfigFactory
 import controller.ControllersInjection
 import io.ktor.server.application.*
-import io.ktor.server.config.*
 import io.ktor.server.engine.*
 import io.ktor.server.jetty.*
-import io.ktor.util.*
 import org.hl7.fhir.validation.ValidatorCli
 import org.hl7.fhir.validation.cli.utils.Params
 import org.koin.dsl.module
@@ -13,7 +10,6 @@ import org.koin.ktor.plugin.Koin
 import utils.PackageCacheDownloaderRunnable
 import java.util.concurrent.TimeUnit
 
-private const val DEFAULT_ENVIRONMENT: String = "dev"
 private const val FULL_STACK_FLAG = "-startServer"
 private const val LOCAL_APP_FLAG = "-gui"
 
@@ -59,8 +55,8 @@ fun main(args: Array<String>) {
 }
 
 fun startServer(args: Array<String>) {
-    val environment = System.getenv()["ENVIRONMENT"] ?: handleDefaultEnvironment()
-    val config = extractConfig(environment, HoconApplicationConfig(ConfigFactory.load()))
+
+    val config = ValidatorApplicationConfig.config
 
     val preloadCache = System.getenv()["PRELOAD_CACHE"] ?: "false"
 
@@ -101,21 +97,5 @@ private fun runningAsDesktopApp(args: Array<String>): Boolean {
     return args.isNotEmpty() && Params.hasParam(args, LOCAL_APP_FLAG) && !Params.hasParam(args, FULL_STACK_FLAG)
 }
 
-data class Config(val host: String, val port: Int)
-
 
-fun extractConfig(environment: String, hoconConfig: HoconApplicationConfig): Config {
-    val hoconEnvironment = hoconConfig.config("ktor.deployment.$environment")
-    return Config(
-        hoconEnvironment.property("host").getString(),
-        Integer.parseInt(hoconEnvironment.property("port").getString()),
-    )
-}
 
-/**
- * Returns default environment.
- */
-fun handleDefaultEnvironment(): String {
-    println("Falling back to default environment 'dev'")
-    return DEFAULT_ENVIRONMENT
-}
\ No newline at end of file
diff --git a/src/jvmMain/kotlin/ValidatorApplicationConfig.kt b/src/jvmMain/kotlin/ValidatorApplicationConfig.kt
new file mode 100644
index 00000000..5bcba59b
--- /dev/null
+++ b/src/jvmMain/kotlin/ValidatorApplicationConfig.kt
@@ -0,0 +1,35 @@
+import com.typesafe.config.ConfigFactory
+import io.ktor.server.config.*
+
+private const val DEFAULT_ENVIRONMENT: String = "dev"
+
+class ValidatorApplicationConfig {
+
+    companion object {
+            val config = extractConfig(detectEnvironment(), HoconApplicationConfig(ConfigFactory.load()))
+
+            private fun detectEnvironment(): String {
+                return System.getenv()["ENVIRONMENT"] ?: handleDefaultEnvironment()
+            }
+
+            /**
+             * Returns default environment.
+             */
+            private fun handleDefaultEnvironment(): String {
+                println("Falling back to default environment 'dev'")
+                return DEFAULT_ENVIRONMENT
+            }
+
+        private fun extractConfig(environment: String, hoconConfig: HoconApplicationConfig): Config {
+            val hoconEnvironment = hoconConfig.config("ktor.deployment.$environment")
+            return Config(
+                hoconEnvironment.property("host").getString(),
+                Integer.parseInt(hoconEnvironment.property("port").getString()),
+                Integer.parseInt(hoconEnvironment.property("engineReloadThreshold").getString())
+                )
+        }
+        }
+
+
+
+}
\ No newline at end of file
diff --git a/src/jvmMain/kotlin/controller/validation/ValidationController.kt b/src/jvmMain/kotlin/controller/validation/ValidationController.kt
index 9179c253..1ff6acb3 100644
--- a/src/jvmMain/kotlin/controller/validation/ValidationController.kt
+++ b/src/jvmMain/kotlin/controller/validation/ValidationController.kt
@@ -6,5 +6,7 @@ import org.hl7.fhir.validation.cli.model.ValidationRequest
 interface ValidationController {
     suspend fun validateRequest(validationRequest: ValidationRequest): ValidationResponse
 
+    suspend fun getValidationEngines() : Set<String>
+
     suspend fun getValidatorVersion() : String
 }
\ No newline at end of file
diff --git a/src/jvmMain/kotlin/controller/validation/ValidationControllerImpl.kt b/src/jvmMain/kotlin/controller/validation/ValidationControllerImpl.kt
index a8edf241..7220ca35 100644
--- a/src/jvmMain/kotlin/controller/validation/ValidationControllerImpl.kt
+++ b/src/jvmMain/kotlin/controller/validation/ValidationControllerImpl.kt
@@ -21,4 +21,8 @@ class ValidationControllerImpl : ValidationController, KoinComponent {
     override suspend fun getValidatorVersion():String {
         return VersionUtil.getVersion()
     }
+
+    override suspend fun getValidationEngines(): Set<String> {
+        return validationServiceFactory.getValidationService().baseEngineKeys;
+    }
 }
\ No newline at end of file
diff --git a/src/jvmMain/kotlin/controller/validation/ValidationModule.kt b/src/jvmMain/kotlin/controller/validation/ValidationModule.kt
index 4f5c60c5..70a94245 100644
--- a/src/jvmMain/kotlin/controller/validation/ValidationModule.kt
+++ b/src/jvmMain/kotlin/controller/validation/ValidationModule.kt
@@ -2,6 +2,7 @@ package controller.validation
 
 import constants.VALIDATION_ENDPOINT
 import constants.VALIDATOR_VERSION_ENDPOINT
+import constants.VALIDATION_ENGINES_ENDPOINT
 
 import io.ktor.http.*
 import io.ktor.server.application.*
@@ -52,4 +53,8 @@ fun Route.validationModule() {
     get(VALIDATOR_VERSION_ENDPOINT) {
         call.respond(HttpStatusCode.OK, validationController.getValidatorVersion())
     }
+
+    get(VALIDATION_ENGINES_ENDPOINT) {
+        call.respond(HttpStatusCode.OK, validationController.getValidationEngines())
+    }
 }
diff --git a/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt b/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt
index a56e8a90..ca549786 100644
--- a/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt
+++ b/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt
@@ -1,26 +1,17 @@
 package controller.validation
 
-import constants.ANY_EXTENSION
+import com.typesafe.config.ConfigFactory
 import constants.Preset
+import io.ktor.server.config.*
 import model.PackageInfo
-import model.BundleValidationRule
-import java.util.concurrent.TimeUnit;
-
-import org.hl7.fhir.validation.cli.model.CliContext
-import org.hl7.fhir.validation.cli.services.ValidationService
-import org.hl7.fhir.validation.cli.services.SessionCache
 import org.hl7.fhir.validation.cli.services.PassiveExpiringSessionCache
+import org.hl7.fhir.validation.cli.services.SessionCache
+import org.hl7.fhir.validation.cli.services.ValidationService
+import java.util.concurrent.TimeUnit
+import kotlin.concurrent.thread
 
-private const val MIN_FREE_MEMORY = 25000000
-private const val SESSION_DEFAULT_DURATION: Long = 60
-
-val IPS_IG = PackageInfo(
-    "hl7.fhir.uv.ips",
-    "1.1.0",
-    "4.0.1",
-    "http://hl7.org/fhir/uv/ips/STU1.1"
-)
 
+private const val SESSION_DEFAULT_DURATION: Long = 60
 
 
 class ValidationServiceFactoryImpl : ValidationServiceFactory {
@@ -28,24 +19,34 @@ class ValidationServiceFactoryImpl : ValidationServiceFactory {
 
     init {
         validationService = createValidationServiceInstance();
+
     }
 
-     fun createValidationServiceInstance() : ValidationService {
-         val sessionCacheDuration = System.getenv("SESSION_CACHE_DURATION")?.toLong() ?: SESSION_DEFAULT_DURATION;
-        val sessionCache: SessionCache = PassiveExpiringSessionCache(sessionCacheDuration, TimeUnit.MINUTES).setResetExpirationAfterFetch(true);
+    fun createValidationServiceInstance(): ValidationService {
+        val sessionCacheDuration = System.getenv("SESSION_CACHE_DURATION")?.toLong() ?: SESSION_DEFAULT_DURATION;
+        val sessionCache: SessionCache =
+            PassiveExpiringSessionCache(sessionCacheDuration, TimeUnit.MINUTES).setResetExpirationAfterFetch(true);
         val validationService = ValidationService(sessionCache);
-         Preset.values().forEach {
-             if (it != Preset.CUSTOM) {
-                 println("Loading preset: " + it.key)
-                 validationService.putBaseEngine(it.key, it.cliContext)
-             }
-         }
-         return validationService
+        thread {
+        Preset.values().forEach {
+            if (it != Preset.CUSTOM) {
+                println("Loading preset: " + it.key)
+                try {
+                    validationService.putBaseEngine(it.key, it.cliContext)
+                } catch (e: Exception) {
+                    println("Error loading preset: " + it.key)
+                    e.printStackTrace()
+                }
+                println("Preset loaded: " + it.key);
+            }
+        }
+        }
+        return validationService
     }
    
     override fun getValidationService() : ValidationService {
-        if (java.lang.Runtime.getRuntime().freeMemory() < MIN_FREE_MEMORY) {
-            println("Free memory ${java.lang.Runtime.getRuntime().freeMemory()} is less than ${MIN_FREE_MEMORY}. Re-initializing validationService");
+        if (java.lang.Runtime.getRuntime().freeMemory() < ValidatorApplicationConfig.config.engineReloadThreshold) {
+            println("Free memory ${java.lang.Runtime.getRuntime().freeMemory()} is less than ${ValidatorApplicationConfig.config.engineReloadThreshold}. Re-initializing validationService");
             validationService = createValidationServiceInstance();
         }
         return validationService;
diff --git a/src/jvmMain/resources/application.conf b/src/jvmMain/resources/application.conf
index b5af434d..d9233db3 100644
--- a/src/jvmMain/resources/application.conf
+++ b/src/jvmMain/resources/application.conf
@@ -3,10 +3,12 @@ ktor {
         dev {
             host = "0.0.0.0"
             port = 8082
+            engineReloadThreshold = 0
         }
         prod {
             host = "0.0.0.0"
             port = 3500
+            engineReloadThreshold = 25000000
         }
     }
     application {

From 64217d04e05ab8db840f6b7996f95af01fbd179c Mon Sep 17 00:00:00 2001
From: dotasek <david.otasek@smilecdr.com>
Date: Thu, 30 May 2024 13:56:35 -0400
Subject: [PATCH 09/22] Wow. Don't overwrite the preset contents when selecting
 a preset.

---
 src/commonMain/kotlin/constants/Preset.kt     |  4 +--
 src/jsMain/kotlin/App.kt                      |  4 +--
 src/jsMain/kotlin/model/CliContext.kt         | 24 +++++++++++++
 .../kotlin/reactredux/containers/AppMain.kt   |  4 +--
 .../reactredux/containers/FileUploadTab.kt    |  6 ++--
 .../reactredux/containers/HeaderMenu.kt       |  4 +--
 .../reactredux/containers/ManualEntryTab.kt   | 12 +++----
 .../reactredux/containers/OptionsPage.kt      |  4 +--
 .../slices/ValidationContextSlice.kt          | 36 +++++++++++++------
 .../kotlin/ui/components/header/Header.kt     |  2 +-
 .../header/LanguageOption/LanguageSelect.kt   |  4 +--
 .../ui/components/options/PresetSelect.kt     |  9 ++---
 12 files changed, 73 insertions(+), 40 deletions(-)

diff --git a/src/commonMain/kotlin/constants/Preset.kt b/src/commonMain/kotlin/constants/Preset.kt
index 42274cf0..896435b8 100644
--- a/src/commonMain/kotlin/constants/Preset.kt
+++ b/src/commonMain/kotlin/constants/Preset.kt
@@ -101,7 +101,7 @@ val CDA_CONTEXT = CliContext()
     .addIg(PackageInfo.igLookupString(CDA_IG))
 
 val CCDA_CONTEXT = CliContext()
-    .setBaseEngine("CCDA")
+    .setBaseEngine("US_CCDA")
     .setSv("5.0.0")
     .addIg(PackageInfo.igLookupString(CCDA_IG))
 
@@ -168,7 +168,7 @@ enum class Preset(
         setOf()
     ),
     US_CCDA(
-        "US_CDA",
+        "US_CCDA",
         "preset_us_ccda",
         CCDA_CONTEXT,
         setOf(CCDA_IG),
diff --git a/src/jsMain/kotlin/App.kt b/src/jsMain/kotlin/App.kt
index bc7578e2..c5153ec8 100644
--- a/src/jsMain/kotlin/App.kt
+++ b/src/jsMain/kotlin/App.kt
@@ -24,7 +24,7 @@ external interface AppProps : Props {
     var setLanguage: (Language) -> Unit
 
     var cliContext: CliContext
-    var updateCliContext: (CliContext) -> Unit
+    var updateCliContext: (CliContext, Boolean) -> Unit
 }
 
 val mainScope = MainScope()
@@ -36,7 +36,7 @@ fun languageSetup(props: AppProps) {
         if (selectedLanguage != null) {
             props.setLanguage(selectedLanguage)
             props.fetchPolyglot(selectedLanguage.getLanguageCode());
-            props.updateCliContext(props.cliContext.setLocale(selectedLanguage.getLanguageCode()))
+            props.updateCliContext(props.cliContext.setLocale(selectedLanguage.getLanguageCode()), false)
             break
         }
     }
diff --git a/src/jsMain/kotlin/model/CliContext.kt b/src/jsMain/kotlin/model/CliContext.kt
index 0eea978b..1ab3ef39 100644
--- a/src/jsMain/kotlin/model/CliContext.kt
+++ b/src/jsMain/kotlin/model/CliContext.kt
@@ -36,6 +36,28 @@ actual class CliContext actual constructor() {
         locale = "en"
     }
 
+    constructor (cliContext : CliContext) : this() {
+        this.igs = cliContext.igs.toList()
+        this.baseEngine = cliContext.baseEngine
+        this.extensions = cliContext.extensions.toList()
+        this.doNative = cliContext.doNative
+        this.hintAboutNonMustSupport = cliContext.hintAboutNonMustSupport
+        this.assumeValidRestReferences = cliContext.assumeValidRestReferences
+        this.noExtensibleBindingMessages = cliContext.noExtensibleBindingMessages
+        this.showTimes = cliContext.showTimes
+        this.allowExampleUrls = cliContext.allowExampleUrls
+        this.txServer = cliContext.txServer
+        this.txLog = cliContext.txLog
+        this.txCache = cliContext.txCache
+        this.snomedCT = cliContext.snomedCT
+        this.targetVer = cliContext.targetVer
+        this.sv = cliContext.sv
+        this.profiles = cliContext.profiles.toList()
+        this.checkIPSCodes = cliContext.checkIPSCodes
+        this.bundleValidationRules = cliContext.bundleValidationRules.toList()
+        this.locale = cliContext.locale
+    }
+
     actual fun getBaseEngine() : String? {
         return baseEngine;
     }
@@ -247,4 +269,6 @@ actual class CliContext actual constructor() {
         this.bundleValidationRules = bundleValidationRules
         return this
     }
+
+
 }
\ No newline at end of file
diff --git a/src/jsMain/kotlin/reactredux/containers/AppMain.kt b/src/jsMain/kotlin/reactredux/containers/AppMain.kt
index 2269da93..58239fac 100644
--- a/src/jsMain/kotlin/reactredux/containers/AppMain.kt
+++ b/src/jsMain/kotlin/reactredux/containers/AppMain.kt
@@ -24,7 +24,7 @@ private interface AppStateProps : Props {
 private interface AppDispatchProps : Props {
     var fetchPolyglot: (String) -> Unit
     var setLanguage: (Language) -> Unit
-    var updateCliContext: (CliContext) -> Unit
+    var updateCliContext: (CliContext, Boolean) -> Unit
 }
 
 val app: ComponentClass<Props> =
@@ -37,6 +37,6 @@ val app: ComponentClass<Props> =
         { dispatch, _ ->
             fetchPolyglot = { dispatch(LocalizationSlice.fetchPolyglot(it)) }
             setLanguage = { dispatch(LocalizationSlice.SetLanguage(it)) }
-            updateCliContext = { dispatch(ValidationContextSlice.UpdateCliContext(it)) }
+            updateCliContext = { cliContext: CliContext, resetBaseEngine: Boolean -> dispatch(ValidationContextSlice.UpdateCliContext(cliContext, resetBaseEngine)) }
         }
     )(App::class.js.unsafeCast<ComponentClass<AppProps>>())
\ No newline at end of file
diff --git a/src/jsMain/kotlin/reactredux/containers/FileUploadTab.kt b/src/jsMain/kotlin/reactredux/containers/FileUploadTab.kt
index 0cf637b4..51271c9d 100644
--- a/src/jsMain/kotlin/reactredux/containers/FileUploadTab.kt
+++ b/src/jsMain/kotlin/reactredux/containers/FileUploadTab.kt
@@ -30,7 +30,7 @@ private interface FileUploadTabDispatchProps : Props {
     var toggleValidationInProgress: (Boolean, FileInfo) -> Unit
     var addValidationOutcome: (ValidationOutcome) -> Unit
 
-    var updateCliContext: (CliContext) -> Unit
+    var updateCliContext: (CliContext, Boolean) -> Unit
     var updateIgPackageInfoSet: (Set<PackageInfo>) -> Unit
     var updateExtensionSet: (Set<String>) -> Unit
     var updateProfileSet: (Set<String>)-> Unit
@@ -55,9 +55,7 @@ val fileUploadTab: ComponentClass<Props> =
                     fileInfo))
             }
             addValidationOutcome = { dispatch(UploadedResourceSlice.AddValidationOutcome(it)) }
-            updateCliContext = {
-                dispatch(ValidationContextSlice.UpdateCliContext(it))
-            }
+            updateCliContext = { cliContext: CliContext, resetBaseEngine: Boolean -> dispatch(ValidationContextSlice.UpdateCliContext(cliContext, resetBaseEngine)) }
             updateIgPackageInfoSet = {
                 dispatch(ValidationContextSlice.UpdateIgPackageInfoSet(it))
             }
diff --git a/src/jsMain/kotlin/reactredux/containers/HeaderMenu.kt b/src/jsMain/kotlin/reactredux/containers/HeaderMenu.kt
index bea8b582..7247eb4f 100644
--- a/src/jsMain/kotlin/reactredux/containers/HeaderMenu.kt
+++ b/src/jsMain/kotlin/reactredux/containers/HeaderMenu.kt
@@ -29,7 +29,7 @@ private interface HeaderDispatchProps : Props {
     var fetchPolyglot: (String) -> Unit
     var setPolyglot: (Polyglot) -> Unit
     var setLanguage: (Language) -> Unit
-    var updateCliContext: (CliContext) -> Unit
+    var updateCliContext: (CliContext, Boolean) -> Unit
 }
 
 val header: ComponentClass<Props> =
@@ -45,6 +45,6 @@ val header: ComponentClass<Props> =
             fetchPolyglot = { dispatch(LocalizationSlice.fetchPolyglot(it)) }
             setPolyglot = { dispatch(LocalizationSlice.SetPolyglot(it)) }
             setLanguage = { dispatch(LocalizationSlice.SetLanguage(it)) }
-            updateCliContext = { dispatch(ValidationContextSlice.UpdateCliContext(it)) }
+            updateCliContext = { cliContext: CliContext, resetBaseEngine: Boolean -> dispatch(ValidationContextSlice.UpdateCliContext(cliContext, resetBaseEngine)) }
         }
     )(Header::class.js.unsafeCast<ComponentClass<HeaderProps>>())
\ No newline at end of file
diff --git a/src/jsMain/kotlin/reactredux/containers/ManualEntryTab.kt b/src/jsMain/kotlin/reactredux/containers/ManualEntryTab.kt
index 16cba831..41947c6c 100644
--- a/src/jsMain/kotlin/reactredux/containers/ManualEntryTab.kt
+++ b/src/jsMain/kotlin/reactredux/containers/ManualEntryTab.kt
@@ -56,20 +56,18 @@ val manualEntryTab: ComponentClass<Props> =
             setValidationOutcome = { dispatch(ManualEntrySlice.AddManualEntryOutcome(it)) }
             toggleValidationInProgress = { dispatch(ManualEntrySlice.ToggleValidationInProgress(it)) }
             updateCurrentlyEnteredText = { dispatch(ManualEntrySlice.UpdateCurrentlyEnteredText(it)) }
-            updateCliContext = {
-                dispatch(ValidationContextSlice.UpdateCliContext(it))
-            }
+            updateCliContext = {  dispatch(ValidationContextSlice.UpdateCliContext(it, false)) }
             updateIgPackageInfoSet = {
-                dispatch(ValidationContextSlice.UpdateIgPackageInfoSet(it))
+                dispatch(ValidationContextSlice.UpdateIgPackageInfoSet(it, false))
             }
             updateExtensionSet = {
-                dispatch(ValidationContextSlice.UpdateExtensionSet(it))
+                dispatch(ValidationContextSlice.UpdateExtensionSet(it, false))
             }
             updateProfileSet = {
-                dispatch(ValidationContextSlice.UpdateProfileSet(it))
+                dispatch(ValidationContextSlice.UpdateProfileSet(it, false))
             }
             updateBundleValidationRuleSet = {
-                dispatch(ValidationContextSlice.UpdateBundleValidationRuleSet(it))
+                dispatch(ValidationContextSlice.UpdateBundleValidationRuleSet(it, false))
             }
             setSessionId = { id: String -> dispatch(ValidationSessionSlice.SetSessionId(id)) }
         }
diff --git a/src/jsMain/kotlin/reactredux/containers/OptionsPage.kt b/src/jsMain/kotlin/reactredux/containers/OptionsPage.kt
index 28ed9954..4b875d30 100644
--- a/src/jsMain/kotlin/reactredux/containers/OptionsPage.kt
+++ b/src/jsMain/kotlin/reactredux/containers/OptionsPage.kt
@@ -46,9 +46,7 @@ val optionsPage: ComponentClass<Props> =
             polyglot = state.localizationSlice.polyglotInstance
         },
         { dispatch, _ ->
-            updateCliContext = {
-                dispatch(ValidationContextSlice.UpdateCliContext(it))
-            }
+            updateCliContext = { dispatch(ValidationContextSlice.UpdateCliContext(it, true)) }
             updateIgPackageInfoSet = {
                 dispatch(ValidationContextSlice.UpdateIgPackageInfoSet(it))
             }
diff --git a/src/jsMain/kotlin/reactredux/slices/ValidationContextSlice.kt b/src/jsMain/kotlin/reactredux/slices/ValidationContextSlice.kt
index 100310d6..fcb9bab4 100644
--- a/src/jsMain/kotlin/reactredux/slices/ValidationContextSlice.kt
+++ b/src/jsMain/kotlin/reactredux/slices/ValidationContextSlice.kt
@@ -1,5 +1,6 @@
 package reactredux.slices
 
+import constants.Preset
 import model.BundleValidationRule
 import model.CliContext
 import model.PackageInfo
@@ -12,39 +13,52 @@ object ValidationContextSlice {
         val extensionSet: Set<String> = mutableSetOf(),
         val profileSet: Set<String> = mutableSetOf(),
         val bundleValidationRuleSet: Set<BundleValidationRule> = mutableSetOf(),
-        val cliContext: CliContext = CliContext()
+        val cliContext: CliContext = CliContext().setBaseEngine(Preset.DEFAULT.key)
     )
 
-    data class UpdateIgPackageInfoSet(val packageInfo: Set<PackageInfo>) : RAction
+    data class UpdateIgPackageInfoSet(val packageInfo: Set<PackageInfo>, val resetBaseEngine: Boolean = true) : RAction
 
-    data class UpdateCliContext(val cliContext: CliContext) : RAction
+    data class UpdateCliContext(val cliContext: CliContext, val resetBaseEngine : Boolean = true) : RAction
 
-    data class UpdateExtensionSet(val extensionSet: Set<String>) : RAction
+    data class UpdateExtensionSet(val extensionSet: Set<String>, val resetBaseEngine : Boolean = true) : RAction
 
-    data class UpdateProfileSet(val profileSet: Set<String>) : RAction
+    data class UpdateProfileSet(val profileSet: Set<String>, val resetBaseEngine : Boolean = true) : RAction
 
-    data class UpdateBundleValidationRuleSet(val bundleValidationRuleSet: Set<BundleValidationRule>) : RAction
+    data class UpdateBundleValidationRuleSet(val bundleValidationRuleSet: Set<BundleValidationRule>, val resetBaseEngine : Boolean = true) : RAction
+
+    private fun resetBaseEngine(cliContext: CliContext, resetBaseEngine: Boolean): CliContext {
+        return if (resetBaseEngine) cliContext.setBaseEngine(null) else cliContext
+    }
 
     fun reducer(state: State = State(), action: RAction): State {
         return when (action) {
             is UpdateIgPackageInfoSet -> state.copy(
                 igPackageInfoSet = action.packageInfo,
-                cliContext = state.cliContext.setIgs(action.packageInfo.map{PackageInfo.igLookupString(it)}.toList())
+                cliContext = resetBaseEngine(
+                    state.cliContext.setIgs(action.packageInfo.map{PackageInfo.igLookupString(it)}.toList()),
+                    action.resetBaseEngine)
+
             )
             is UpdateCliContext -> state.copy(
-                cliContext = action.cliContext
+                cliContext = resetBaseEngine(action.cliContext, action.resetBaseEngine)
             )
             is UpdateExtensionSet -> state.copy(
                 extensionSet = action.extensionSet,
-                cliContext = state.cliContext.setExtensions(action.extensionSet.toList())
+                cliContext =  resetBaseEngine(state.cliContext
+                    .setExtensions(action.extensionSet.toList())
+                    , action.resetBaseEngine)
             )
             is UpdateProfileSet -> state.copy(
                 profileSet = action.profileSet,
-                cliContext = state.cliContext.setProfiles(action.profileSet.toList())
+                cliContext =  resetBaseEngine(state.cliContext
+                    .setProfiles(action.profileSet.toList())
+                    , action.resetBaseEngine)
             )
             is UpdateBundleValidationRuleSet -> state.copy(
                 bundleValidationRuleSet = action.bundleValidationRuleSet,
-                cliContext = state.cliContext.setBundleValidationRules(action.bundleValidationRuleSet.toList())
+                cliContext =  resetBaseEngine(state.cliContext
+                    .setBundleValidationRules(action.bundleValidationRuleSet.toList())
+                    , action.resetBaseEngine)
             )
             else -> state
         }
diff --git a/src/jsMain/kotlin/ui/components/header/Header.kt b/src/jsMain/kotlin/ui/components/header/Header.kt
index ab02228f..4ff0ba56 100644
--- a/src/jsMain/kotlin/ui/components/header/Header.kt
+++ b/src/jsMain/kotlin/ui/components/header/Header.kt
@@ -37,7 +37,7 @@ external interface HeaderProps : Props {
     var setLanguage: (Language) -> Unit
 
     var cliContext: CliContext
-    var updateCliContext: (CliContext) -> Unit
+    var updateCliContext: (CliContext, Boolean) -> Unit
 }
 
 class HeaderState : State {
diff --git a/src/jsMain/kotlin/ui/components/header/LanguageOption/LanguageSelect.kt b/src/jsMain/kotlin/ui/components/header/LanguageOption/LanguageSelect.kt
index b50b73f2..6ffb24c2 100644
--- a/src/jsMain/kotlin/ui/components/header/LanguageOption/LanguageSelect.kt
+++ b/src/jsMain/kotlin/ui/components/header/LanguageOption/LanguageSelect.kt
@@ -17,7 +17,7 @@ external interface LanguageSelectProps : Props {
     var selectedLanguage : Language
     var setLanguage: (Language) -> Unit
     var cliContext: CliContext
-    var updateCliContext: (CliContext) -> Unit
+    var updateCliContext: (CliContext, Boolean) -> Unit
 
 }
 
@@ -49,7 +49,7 @@ class LanguageSelect(props : LanguageSelectProps) : RComponent<LanguageSelectPro
                             if (selectedLanguage != null) {
                                 props.setLanguage(selectedLanguage)
                                 props.fetchPolyglot(selectedLanguage.getLanguageCode());
-                                props.updateCliContext(props.cliContext.setLocale(selectedLanguage.getLanguageCode()))
+                                props.updateCliContext(props.cliContext.setLocale(selectedLanguage.getLanguageCode()), false)
                             }
                         }
                     }
diff --git a/src/jsMain/kotlin/ui/components/options/PresetSelect.kt b/src/jsMain/kotlin/ui/components/options/PresetSelect.kt
index 1f8494c5..7d68c568 100644
--- a/src/jsMain/kotlin/ui/components/options/PresetSelect.kt
+++ b/src/jsMain/kotlin/ui/components/options/PresetSelect.kt
@@ -65,7 +65,6 @@ class PresetSelect : RComponent<PresetSelectProps, PresetSelectState>() {
                 display = Display.inlineFlex
                 flexDirection = FlexDirection.column
                 alignSelf = Align.center
-
             }
             Tooltip {
                 attrs {
@@ -89,14 +88,17 @@ class PresetSelect : RComponent<PresetSelectProps, PresetSelectState>() {
                             +props.polyglot.t("preset_label")
                         }
                         Select {
+
                             attrs {
                                 label = ReactNode("Preset")
-
+                                value =  props.cliContext.getBaseEngine().unsafeCast<Nothing?>()
                                 onChange = { event, _ ->
                                     val selectedPreset = Preset.getSelectedPreset(event.target.value)
                                     if (selectedPreset != null) {
                                         console.log("updating cli context for preset: " + event.target.value)
-                                        val cliContext = selectedPreset.cliContext.setLocale(props.language.getLanguageCode())
+                                        console.log("updating cli context with base engine: " + selectedPreset.cliContext.getBaseEngine())
+
+                                        val cliContext = CliContext(selectedPreset.cliContext).setLocale(props.language.getLanguageCode())
                                         props.updateCliContext(cliContext)
                                         props.updateIgPackageInfoSet(selectedPreset.igPackageInfo)
                                         props.updateExtensionSet(selectedPreset.extensionSet)
@@ -120,7 +122,6 @@ class PresetSelect : RComponent<PresetSelectProps, PresetSelectState>() {
                                     MenuItem {
                                         attrs {
                                             value = it.key
-                                            selected = it.key.equals(props.cliContext.getBaseEngine())
                                         }
                                         +props.polyglot.t(it.polyglotKey)
                                         console.log(

From f22c262c603446f94890aa1e2b52e3e8b4cc8fb0 Mon Sep 17 00:00:00 2001
From: dotasek <david.otasek@smilecdr.com>
Date: Tue, 25 Jun 2024 18:15:42 -0400
Subject: [PATCH 10/22] WIP use guava to manage cache size

---
 .../validation/GuavaSessionCache.kt           | 59 +++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 src/jvmMain/kotlin/controller/validation/GuavaSessionCache.kt

diff --git a/src/jvmMain/kotlin/controller/validation/GuavaSessionCache.kt b/src/jvmMain/kotlin/controller/validation/GuavaSessionCache.kt
new file mode 100644
index 00000000..0a4f2209
--- /dev/null
+++ b/src/jvmMain/kotlin/controller/validation/GuavaSessionCache.kt
@@ -0,0 +1,59 @@
+package controller.validation;
+
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+import org.hl7.fhir.validation.ValidationEngine;
+import org.hl7.fhir.validation.cli.services.SessionCache;
+
+import java.util.Set;
+import java.util.UUID;
+
+public class GuavaSessionCache implements SessionCache {
+
+    Cache<String, ValidationEngine> cache = CacheBuilder.newBuilder().maximumSize(3).build();
+
+    @Override
+    public String cacheSession(ValidationEngine validationEngine) {
+        String generatedId = generateID();
+        cache.put(generatedId, validationEngine);
+        return generatedId;
+    }
+
+    @Override
+    public String cacheSession(String sessionId, ValidationEngine validationEngine) {
+        if(sessionId == null) {
+            sessionId = cacheSession(validationEngine);
+        } else {
+            cache.put(sessionId, validationEngine);
+        }
+        return sessionId;
+    }
+
+    @Override
+    public boolean sessionExists(String sessionKey) {
+        return cache.getIfPresent(sessionKey) != null;
+    }
+
+    @Override
+    public ValidationEngine removeSession(String s) {
+       return null;
+    }
+
+    @Override
+    public ValidationEngine fetchSessionValidatorEngine(String sessionKey) {
+        return cache.getIfPresent(sessionKey);
+    }
+
+    @Override
+    public Set<String> getSessionIds() {
+        return cache.asMap().keySet();
+    }
+
+    /**
+     * Session ids generated internally are UUID {@link String}.
+     * @return A new {@link String} session id.
+     */
+    private String generateID() {
+        return UUID.randomUUID().toString();
+    }
+}

From b80a12a4620b10b95228109e3f2ae1dae3d68b6d Mon Sep 17 00:00:00 2001
From: dotasek <david.otasek@smilecdr.com>
Date: Tue, 25 Jun 2024 18:16:00 -0400
Subject: [PATCH 11/22] WIP use guava to manage cache size 2

---
 build.gradle.kts                              |  2 +
 gradle.properties                             |  6 +-
 .../validation/GuavaSessionCache.kt           | 79 +++++++++----------
 .../ValidationServiceFactoryImpl.kt           |  4 +-
 4 files changed, 43 insertions(+), 48 deletions(-)

diff --git a/build.gradle.kts b/build.gradle.kts
index 13754276..653c746a 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -122,6 +122,8 @@ kotlin {
                 implementation("ch.qos.logback:logback-classic:${property("logbackVersion")}")
                 implementation("org.litote.kmongo:kmongo-coroutine-serialization:${property("kmongoVersion")}")
                 implementation("no.tornado:tornadofx:${property("tornadoFXVersion")}")
+
+              //  implementation("com.google.guava:guava:10.0.1")
             }
         }
         val jvmTest by getting {
diff --git a/gradle.properties b/gradle.properties
index 7dfcde79..b4d2dce6 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -2,7 +2,7 @@ kotlin.code.style=official
 kotlin.js.generate.executable.default=false
 
 # versions
-fhirCoreVersion=6.3.11-SNAPSHOT
+fhirCoreVersion=6.3.12-SNAPSHOT
 
 junitVersion=5.7.1
 mockk_version=1.10.2
@@ -39,6 +39,4 @@ koinVersion=3.2.1
 logbackVersion=1.5.3
 kmongoVersion=4.5.0
 
-
-
-
+org.gradle.jvmargs=-Xmx8G
diff --git a/src/jvmMain/kotlin/controller/validation/GuavaSessionCache.kt b/src/jvmMain/kotlin/controller/validation/GuavaSessionCache.kt
index 0a4f2209..02208386 100644
--- a/src/jvmMain/kotlin/controller/validation/GuavaSessionCache.kt
+++ b/src/jvmMain/kotlin/controller/validation/GuavaSessionCache.kt
@@ -1,59 +1,54 @@
-package controller.validation;
-
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
-import org.hl7.fhir.validation.ValidationEngine;
-import org.hl7.fhir.validation.cli.services.SessionCache;
-
-import java.util.Set;
-import java.util.UUID;
-
-public class GuavaSessionCache implements SessionCache {
-
-    Cache<String, ValidationEngine> cache = CacheBuilder.newBuilder().maximumSize(3).build();
-
-    @Override
-    public String cacheSession(ValidationEngine validationEngine) {
-        String generatedId = generateID();
-        cache.put(generatedId, validationEngine);
-        return generatedId;
+package controller.validation
+
+import com.google.common.cache.Cache
+import com.google.common.cache.CacheBuilder
+import org.hl7.fhir.validation.ValidationEngine
+import org.hl7.fhir.validation.cli.services.SessionCache
+import java.util.*
+
+class GuavaSessionCache : SessionCache {
+    private val cache: Cache<String, ValidationEngine> = CacheBuilder.newBuilder().maximumSize(1).build()
+
+    override fun cacheSession(validationEngine: ValidationEngine): String {
+        val generatedId = generateID()
+        cache.put(generatedId, validationEngine)
+        println("Cache size: " + cache.size())
+        return generatedId
     }
 
-    @Override
-    public String cacheSession(String sessionId, ValidationEngine validationEngine) {
-        if(sessionId == null) {
-            sessionId = cacheSession(validationEngine);
+    override fun cacheSession(sessionId: String?, validationEngine: ValidationEngine): String {
+        var sessionIdVar = sessionId
+        if (sessionIdVar == null) {
+            sessionIdVar = cacheSession(validationEngine)
         } else {
-            cache.put(sessionId, validationEngine);
+            cache.put(sessionIdVar, validationEngine)
+            println("Cache size: " + cache.size())
         }
-        return sessionId;
+        return sessionIdVar
     }
 
-    @Override
-    public boolean sessionExists(String sessionKey) {
-        return cache.getIfPresent(sessionKey) != null;
+    override fun sessionExists(sessionKey: String?): Boolean {
+       // if (sessionKey == null) {return false }
+        return cache.asMap().containsKey(sessionKey)
     }
 
-    @Override
-    public ValidationEngine removeSession(String s) {
-       return null;
+    override fun removeSession(s: String): ValidationEngine? {
+        return null
     }
 
-    @Override
-    public ValidationEngine fetchSessionValidatorEngine(String sessionKey) {
-        return cache.getIfPresent(sessionKey);
+    override fun fetchSessionValidatorEngine(sessionKey: String): ValidationEngine? {
+        return cache.getIfPresent(sessionKey)
     }
 
-    @Override
-    public Set<String> getSessionIds() {
-        return cache.asMap().keySet();
+    override fun getSessionIds(): Set<String> {
+        return cache.asMap().keys
     }
 
     /**
-     * Session ids generated internally are UUID {@link String}.
-     * @return A new {@link String} session id.
+     * Session ids generated internally are UUID [String].
+     * @return A new [String] session id.
      */
-    private String generateID() {
-        return UUID.randomUUID().toString();
+    private fun generateID(): String {
+        return UUID.randomUUID().toString()
     }
-}
+}
\ No newline at end of file
diff --git a/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt b/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt
index ca549786..77066d50 100644
--- a/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt
+++ b/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt
@@ -23,9 +23,9 @@ class ValidationServiceFactoryImpl : ValidationServiceFactory {
     }
 
     fun createValidationServiceInstance(): ValidationService {
-        val sessionCacheDuration = System.getenv("SESSION_CACHE_DURATION")?.toLong() ?: SESSION_DEFAULT_DURATION;
+      //  val sessionCacheDuration = System.getenv("SESSION_CACHE_DURATION")?.toLong() ?: SESSION_DEFAULT_DURATION;
         val sessionCache: SessionCache =
-            PassiveExpiringSessionCache(sessionCacheDuration, TimeUnit.MINUTES).setResetExpirationAfterFetch(true);
+            GuavaSessionCache()
         val validationService = ValidationService(sessionCache);
         thread {
         Preset.values().forEach {

From 86a223734eecc15b47b82065b4ae3f00ad73a2d5 Mon Sep 17 00:00:00 2001
From: dotasek <david.otasek@smilecdr.com>
Date: Fri, 28 Jun 2024 16:18:50 -0400
Subject: [PATCH 12/22] WIP Fix explicit query tests

---
 .../base-engine-requests/default.json         | 144 ++++++++++++++++++
 .../explicit-preset-requests/default.json     |  13 ++
 http-client-tests/tests/explicit-queries.http |  72 ++++++---
 3 files changed, 204 insertions(+), 25 deletions(-)
 create mode 100644 http-client-tests/resources/base-engine-requests/default.json
 create mode 100644 http-client-tests/resources/explicit-preset-requests/default.json

diff --git a/http-client-tests/resources/base-engine-requests/default.json b/http-client-tests/resources/base-engine-requests/default.json
new file mode 100644
index 00000000..4f761899
--- /dev/null
+++ b/http-client-tests/resources/base-engine-requests/default.json
@@ -0,0 +1,144 @@
+{
+  "resourceType": "Observation",
+  "id": "blood-pressure",
+  "meta": {
+    "profile": [
+      "http://hl7.org/fhir/StructureDefinition/vitalsigns"
+    ]
+  },
+  "text": {
+    "status": "generated",
+    "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: blood-pressure</p><p><b>meta</b>: </p><p><b>identifier</b>: urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281</p><p><b>basedOn</b>: </p><p><b>status</b>: final</p><p><b>category</b>: Vital Signs <span>(Details : {http://terminology.hl7.org/CodeSystem/observation-category code 'vital-signs' = 'Vital Signs', given as 'Vital Signs'})</span></p><p><b>code</b>: Blood pressure systolic &amp; diastolic <span>(Details : {LOINC code '85354-9' = 'Blood pressure panel with all children optional', given as 'Blood pressure panel with all children optional'})</span></p><p><b>subject</b>: <a>Patient/example</a></p><p><b>effective</b>: 17/09/2012</p><p><b>performer</b>: <a>Practitioner/example</a></p><p><b>interpretation</b>: Below low normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'L' = 'Low', given as 'low'})</span></p><p><b>bodySite</b>: Right arm <span>(Details : {SNOMED CT code '368209003' = 'Right upper arm', given as 'Right arm'})</span></p><blockquote><p><b>component</b></p><p><b>code</b>: Systolic blood pressure <span>(Details : {LOINC code '8480-6' = 'Systolic blood pressure', given as 'Systolic blood pressure'}; {SNOMED CT code '271649006' = 'Systolic blood pressure', given as 'Systolic blood pressure'}; {http://acme.org/devices/clinical-codes code 'bp-s' = 'bp-s', given as 'Systolic Blood pressure'})</span></p><p><b>value</b>: 107 mmHg<span> (Details: UCUM code mm[Hg] = 'mmHg')</span></p><p><b>interpretation</b>: Normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'N' = 'Normal', given as 'normal'})</span></p></blockquote><blockquote><p><b>component</b></p><p><b>code</b>: Diastolic blood pressure <span>(Details : {LOINC code '8462-4' = 'Diastolic blood pressure', given as 'Diastolic blood pressure'})</span></p><p><b>value</b>: 60 mmHg<span> (Details: UCUM code mm[Hg] = 'mmHg')</span></p><p><b>interpretation</b>: Below low normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'L' = 'Low', given as 'low'})</span></p></blockquote></div>"
+  },
+  "identifier": [
+    {
+      "system": "urn:ietf:rfc:3986",
+      "value": "urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281"
+    }
+  ],
+  "basedOn": [
+    {
+      "identifier": {
+        "system": "https://acme.org/identifiers",
+        "value": "1234"
+      }
+    }
+  ],
+  "status": "final",
+  "category": [
+    {
+      "coding": [
+        {
+          "system": "http://terminology.hl7.org/CodeSystem/observation-category",
+          "code": "vital-signs",
+          "display": "Vital Signs"
+        }
+      ]
+    }
+  ],
+  "code": {
+    "coding": [
+      {
+        "system": "http://loinc.org",
+        "code": "85354-9",
+        "display": "Blood pressure panel with all children optional"
+      }
+    ],
+    "text": "Blood pressure systolic & diastolic"
+  },
+  "subject": {
+    "reference": "Patient/example"
+  },
+  "effectiveDateTime": "2012-09-17",
+  "performer": [
+    {
+      "reference": "Practitioner/example"
+    }
+  ],
+  "interpretation": [
+    {
+      "coding": [
+        {
+          "system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
+          "code": "L",
+          "display": "low"
+        }
+      ],
+      "text": "Below low normal"
+    }
+  ],
+  "bodySite": {
+    "coding": [
+      {
+        "system": "http://snomed.info/sct",
+        "code": "368209003",
+        "display": "Right arm"
+      }
+    ]
+  },
+  "component": [
+    {
+      "code": {
+        "coding": [
+          {
+            "system": "http://loinc.org",
+            "code": "8480-6",
+            "display": "Systolic blood pressure"
+          },
+          {
+            "system": "http://snomed.info/sct",
+            "code": "271649006",
+            "display": "Systolic blood pressure"
+          }
+        ]
+      },
+      "valueQuantity": {
+        "value": 107,
+        "unit": "mmHg",
+        "system": "http://unitsofmeasure.org",
+        "code": "mm[Hg]"
+      },
+      "interpretation": [
+        {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
+              "code": "N",
+              "display": "normal"
+            }
+          ],
+          "text": "Normal"
+        }
+      ]
+    },
+    {
+      "code": {
+        "coding": [
+          {
+            "system": "http://loinc.org",
+            "code": "8462-4",
+            "display": "Diastolic blood pressure"
+          }
+        ]
+      },
+      "valueQuantity": {
+        "value": 60,
+        "unit": "mmHg",
+        "system": "http://unitsofmeasure.org",
+        "code": "mm[Hg]"
+      },
+      "interpretation": [
+        {
+          "coding": [
+            {
+              "system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
+              "code": "L",
+              "display": "low"
+            }
+          ],
+          "text": "Below low normal"
+        }
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/http-client-tests/resources/explicit-preset-requests/default.json b/http-client-tests/resources/explicit-preset-requests/default.json
new file mode 100644
index 00000000..60777a93
--- /dev/null
+++ b/http-client-tests/resources/explicit-preset-requests/default.json
@@ -0,0 +1,13 @@
+{
+"cliContext": {
+"sv": "4.0.1",
+"locale": "en"
+},
+"filesToValidate": [
+{
+"fileName": "manually_entered_file.json",
+"fileContent": "{\n  \"resourceType\": \"Observation\",\n  \"id\": \"blood-pressure\",\n  \"meta\": {\n    \"profile\": [\n      \"http://hl7.org/fhir/StructureDefinition/vitalsigns\"\n    ]\n  },\n  \"text\": {\n    \"status\": \"generated\",\n    \"div\": \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: blood-pressure</p><p><b>meta</b>: </p><p><b>identifier</b>: urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281</p><p><b>basedOn</b>: </p><p><b>status</b>: final</p><p><b>category</b>: Vital Signs <span>(Details : {http://terminology.hl7.org/CodeSystem/observation-category code 'vital-signs' = 'Vital Signs', given as 'Vital Signs'})</span></p><p><b>code</b>: Blood pressure systolic &amp; diastolic <span>(Details : {LOINC code '85354-9' = 'Blood pressure panel with all children optional', given as 'Blood pressure panel with all children optional'})</span></p><p><b>subject</b>: <a>Patient/example</a></p><p><b>effective</b>: 17/09/2012</p><p><b>performer</b>: <a>Practitioner/example</a></p><p><b>interpretation</b>: Below low normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'L' = 'Low', given as 'low'})</span></p><p><b>bodySite</b>: Right arm <span>(Details : {SNOMED CT code '368209003' = 'Right upper arm', given as 'Right arm'})</span></p><blockquote><p><b>component</b></p><p><b>code</b>: Systolic blood pressure <span>(Details : {LOINC code '8480-6' = 'Systolic blood pressure', given as 'Systolic blood pressure'}; {SNOMED CT code '271649006' = 'Systolic blood pressure', given as 'Systolic blood pressure'}; {http://acme.org/devices/clinical-codes code 'bp-s' = 'bp-s', given as 'Systolic Blood pressure'})</span></p><p><b>value</b>: 107 mmHg<span> (Details: UCUM code mm[Hg] = 'mmHg')</span></p><p><b>interpretation</b>: Normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'N' = 'Normal', given as 'normal'})</span></p></blockquote><blockquote><p><b>component</b></p><p><b>code</b>: Diastolic blood pressure <span>(Details : {LOINC code '8462-4' = 'Diastolic blood pressure', given as 'Diastolic blood pressure'})</span></p><p><b>value</b>: 60 mmHg<span> (Details: UCUM code mm[Hg] = 'mmHg')</span></p><p><b>interpretation</b>: Below low normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'L' = 'Low', given as 'low'})</span></p></blockquote></div>\"\n  },\n  \"identifier\": [\n    {\n      \"system\": \"urn:ietf:rfc:3986\",\n      \"value\": \"urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281\"\n    }\n  ],\n  \"basedOn\": [\n    {\n      \"identifier\": {\n        \"system\": \"https://acme.org/identifiers\",\n        \"value\": \"1234\"\n      }\n    }\n  ],\n  \"status\": \"final\",\n  \"category\": [\n    {\n      \"coding\": [\n        {\n          \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n          \"code\": \"vital-signs\",\n          \"display\": \"Vital Signs\"\n        }\n      ]\n    }\n  ],\n  \"code\": {\n    \"coding\": [\n      {\n        \"system\": \"http://loinc.org\",\n        \"code\": \"85354-9\",\n        \"display\": \"Blood pressure panel with all children optional\"\n      }\n    ],\n    \"text\": \"Blood pressure systolic & diastolic\"\n  },\n  \"subject\": {\n    \"reference\": \"Patient/example\"\n  },\n  \"effectiveDateTime\": \"2012-09-17\",\n  \"performer\": [\n    {\n      \"reference\": \"Practitioner/example\"\n    }\n  ],\n  \"interpretation\": [\n    {\n      \"coding\": [\n        {\n          \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n          \"code\": \"L\",\n          \"display\": \"low\"\n        }\n      ],\n      \"text\": \"Below low normal\"\n    }\n  ],\n  \"bodySite\": {\n    \"coding\": [\n      {\n        \"system\": \"http://snomed.info/sct\",\n        \"code\": \"368209003\",\n        \"display\": \"Right arm\"\n      }\n    ]\n  },\n  \"component\": [\n    {\n      \"code\": {\n        \"coding\": [\n          {\n            \"system\": \"http://loinc.org\",\n            \"code\": \"8480-6\",\n            \"display\": \"Systolic blood pressure\"\n          },\n          {\n            \"system\": \"http://snomed.info/sct\",\n            \"code\": \"271649006\",\n            \"display\": \"Systolic blood pressure\"\n          }\n        ]\n      },\n      \"valueQuantity\": {\n        \"value\": 107,\n        \"unit\": \"mmHg\",\n        \"system\": \"http://unitsofmeasure.org\",\n        \"code\": \"mm[Hg]\"\n      },\n      \"interpretation\": [\n        {\n          \"coding\": [\n            {\n              \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n              \"code\": \"N\",\n              \"display\": \"normal\"\n            }\n          ],\n          \"text\": \"Normal\"\n        }\n      ]\n    },\n    {\n      \"code\": {\n        \"coding\": [\n          {\n            \"system\": \"http://loinc.org\",\n            \"code\": \"8462-4\",\n            \"display\": \"Diastolic blood pressure\"\n          }\n        ]\n      },\n      \"valueQuantity\": {\n        \"value\": 60,\n        \"unit\": \"mmHg\",\n        \"system\": \"http://unitsofmeasure.org\",\n        \"code\": \"mm[Hg]\"\n      },\n      \"interpretation\": [\n        {\n          \"coding\": [\n            {\n              \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n              \"code\": \"L\",\n              \"display\": \"low\"\n            }\n          ],\n          \"text\": \"Below low normal\"\n        }\n      ]\n    }\n  ]\n}",
+"fileType": null
+}
+]
+}
\ No newline at end of file
diff --git a/http-client-tests/tests/explicit-queries.http b/http-client-tests/tests/explicit-queries.http
index 84dd5345..e01f7bb9 100644
--- a/http-client-tests/tests/explicit-queries.http
+++ b/http-client-tests/tests/explicit-queries.http
@@ -5,9 +5,28 @@
 # the baseEngine field of the CliContext to utilize the pre-built ValidationEngine
 # from the ValidationService
 
+### Default
+# @name Default
+POST {{host}}/validate
+Content-Type: application/json
 
+< ../resources/explicit-preset-requests/default.json
+
+> {%
+    client.test("Validated Successfully", function() {
+        client.assert(response.status === 200, "Response status is not 200");
+    });
+    import { containsIssue } from "../utilities/assertions";
+    client.test("Issues are Correct", function() {
+        let issues = response.body.outcomes[0].issues
+        client.log("issues:" + issues.length)
+        client.assert(issues.length === 2);
+        client.assert(containsIssue(issues, 88, 12, "This element does not match any known slice defined in the profile http://hl7.org/fhir/StructureDefinition/bp|4.0.1 (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL", "INFORMATION"));
+    });
+%}
 
 ### CDA
+# @name CDA
 # This example is compo
 POST {{host}}/validate
 Content-Type: application/json
@@ -16,22 +35,22 @@ Content-Type: application/json
 
 > {%
     client.test("Validated Successfully", function() {
-        client.assert(response.status === 200, "Response status is not 201");
+        client.assert(response.status === 200, "Response status is not 200");
     });
     import { containsIssue } from "../utilities/assertions";
-    client.test("Issues are Correct", function() {
-        let issues = response.body.outcomes[0].issues
-client.log("issues:" + issues.length)
-        client.assert(issues.length === 5);
-        client.assert(containsIssue(issues, 20, 24, "Binding has no source, so can''t be checked", "CODEINVALID", "INFORMATION"))
-
-        client.assert(containsIssue(issues, 251, 184, "The OID '2.16.840.1.114222.4.11.1066' is not known, so the code cant be validated", "CODEINVALID", "WARNING"))
 
+    client.test("Issues are Correct", function () {
+        let issues = response.body.outcomes[0].issues
+        client.log("issues:" + issues.length)
+        client.assert(issues.length === 10);
+        client.assert(containsIssue(issues, 20, 24, "Binding has no source, so can't be checked", "CODEINVALID", "INFORMATION"))
+        client.assert(containsIssue(issues, 251, 184, "The OID '2.16.840.1.114222.4.11.1066' is not known, so the code can't be validated", "CODEINVALID", "WARNING"))
     });
 %}
 
 
 ### US-CDA
+# @name US-CDA
 # Check that a request with explicit IG settings returns an expected response
 POST {{host}}/validate
 Content-Type: application/json
@@ -40,20 +59,20 @@ Content-Type: application/json
 
 > {%
     client.test("Validated Successfully", function() {
-        client.assert(response.status === 200, "Response status is not 201");
+        client.assert(response.status === 200, "Response status is not 200");
     });
     import { containsIssue } from "../utilities/assertions";
     client.test("Issues are Correct", function() {
         let issues = response.body.outcomes[0].issues
-
-        client.assert(issues.length === 4)
-        client.assert(containsIssue(issues, 20, 24, "Binding has no source, so can''t be checked", "CODEINVALID", "INFORMATION"))
-        client.assert(!containsIssue(issues, 251, 184, "The OID '2.16.840.1.114222.4.11.1066' is not known, so the code cant be validated", "CODEINVALID", "WARNING"))
+        client.log("issues:" + issues.length)
+        client.assert(issues.length === 10)
+        client.assert(containsIssue(issues, 20, 24, "Binding has no source, so can't be checked", "CODEINVALID", "INFORMATION"))
+        client.assert(!containsIssue(issues, 251, 184, "The OID '2.16.840.1.113883.1.11.19830' is not known, so the code can't be validated", "CODEINVALID", "WARNING"))
     })
 %}
 
 ### IPS
-#
+# @name IPS
 POST {{host}}/validate
 Content-Type: application/json
 
@@ -61,12 +80,13 @@ Content-Type: application/json
 
 > {%
     client.test("Validated Successfully", function() {
-        client.assert(response.status === 200, "Response status is not 201");
+        client.assert(response.status === 200, "Response status is not 200");
     });
     import { containsIssue } from "../utilities/assertions";
     client.test("Issues are Correct", function() {
         let issues = response.body.outcomes[0].issues
-        client.assert(issues.length === 32);
+        client.log("issues:" + issues.length)
+        client.assert(issues.length === 46);
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 373270004 (Substance with penicillin structure and antibacterial mechanism of action) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 108774000 (Product containing anastrozole (medicinal product)) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
 
@@ -77,7 +97,7 @@ Content-Type: application/json
 %}
 
 ### IPS-AU
-#
+# @name IPS-AU
 POST {{host}}/validate
 Content-Type: application/json
 
@@ -85,22 +105,22 @@ Content-Type: application/json
 
 > {%
     client.test("Validated Successfully", function() {
-        client.assert(response.status === 200, "Response status is not 201");
+        client.assert(response.status === 200, "Response status is not 200");
     });
     import { containsIssue } from "../utilities/assertions";
     client.test("Issues are Correct", function() {
         let issues = response.body.outcomes[0].issues
         client.log("issues:" + issues.length)
-        client.assert(issues.length === 45);
+        client.assert(issues.length === 53);
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 373270004 (Substance with penicillin structure and antibacterial mechanism of action) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 108774000 (Product containing anastrozole (medicinal product)) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
         client.assert(containsIssue(issues, 314, 4, "This element does not match any known slice defined in the profile http://hl7.org.au/fhir/ips/StructureDefinition/Bundle-au-ips|0.0.1 (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL", "INFORMATION"))
-        client.assert(containsIssue(issues, 134, 8, "This element does not match any known slice defined in the profile http://hl7.org.au/fhir/core/StructureDefinition/au-core-patient|0.3.0 (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL","INFORMATION"))
+        client.assert(containsIssue(issues, 134, 8, "This element does not match any known slice defined in the profile http://hl7.org.au/fhir/core/StructureDefinition/au-core-patient|0.5.0-ci-build (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL", "INFORMATION"))
     });
 %}
 
 ### IPS-NZ
-#
+# @name IPS-NZ
 POST {{host}}/validate
 Content-Type: application/json
 
@@ -108,18 +128,19 @@ Content-Type: application/json
 
 > {%
     client.test("Validated Successfully", function() {
-        client.assert(response.status === 200, "Response status is not 201");
+        client.assert(response.status === 200, "Response status is not 200");
     });
     import { containsIssue } from "../utilities/assertions";
     client.test("Issues are Correct", function() {
         let issues = response.body.outcomes[0].issues
         client.log("issues:" + issues.length)
-        client.assert(issues.length === 98);
-        client.assert(containsIssue(issues, 12,10,"This element does not match any known slice defined in the profile https://standards.digital.health.nz/fhir/StructureDefinition/nzps-bundle|0.1.0 (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL", "INFORMATION"))
+        client.assert(issues.length === 102);
+        client.assert(containsIssue(issues, 12,10,"This element does not match any known slice defined in the profile https://standards.digital.health.nz/fhir/StructureDefinition/nzps-bundle|0.3.0 (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL", "INFORMATION"))
     });
 %}
 
 ### SQL-ON-FHIR
+# @name SQL-ON-FHIR
 # Check that a request with explicit IG settings returns an expected response
 POST {{host}}/validate
 Content-Type: application/json
@@ -128,11 +149,12 @@ Content-Type: application/json
 
 > {%
     client.test("Validated Successfully", function() {
-        client.assert(response.status === 200, "Response status is not 201");
+        client.assert(response.status === 200, "Response status is not 200");
     });
     import { containsIssue } from "../utilities/assertions";
     client.test("Issues are Correct", function() {
         let issues = response.body.outcomes[0].issues
+        client.log("issues:" + issues.length)
         client.assert(issues.length === 3);
         client.assert(containsIssue(issues, 20, 21, "The column 'use' appears to be a collection based on it's path. Collections are not supported in all execution contexts", "BUSINESSRULE", "WARNING"))
         client.assert(containsIssue(issues, 24, 21, "The column 'city' appears to be a collection based on it's path. Collections are not supported in all execution contexts", "BUSINESSRULE", "WARNING"))

From 88eb322dfea1fed2cc6296de5f37938a8eeba002 Mon Sep 17 00:00:00 2001
From: dotasek <david.otasek@smilecdr.com>
Date: Tue, 2 Jul 2024 14:13:30 -0400
Subject: [PATCH 13/22] Configure Guava cache size at instantiation + tests

---
 build.gradle.kts                              |  1 +
 .../validation/GuavaSessionCache.kt           |  4 +-
 .../ValidationServiceFactoryImpl.kt           |  2 +-
 .../controller/validation/GuavaCacheTest.kt   | 47 +++++++++++++++++++
 4 files changed, 51 insertions(+), 3 deletions(-)
 create mode 100644 src/jvmTest/kotlin/controller/validation/GuavaCacheTest.kt

diff --git a/build.gradle.kts b/build.gradle.kts
index 653c746a..eae91a58 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -274,4 +274,5 @@ tasks.create("stage") {
 
 tasks.getByName<JavaExec>("run") {
     classpath(tasks.getByName<Jar>("jvmJar")) // so that the JS artifacts generated by `jvmJar` can be found and served
+    jvmArgs("-Xmx8G")
 }
\ No newline at end of file
diff --git a/src/jvmMain/kotlin/controller/validation/GuavaSessionCache.kt b/src/jvmMain/kotlin/controller/validation/GuavaSessionCache.kt
index 02208386..28215cf2 100644
--- a/src/jvmMain/kotlin/controller/validation/GuavaSessionCache.kt
+++ b/src/jvmMain/kotlin/controller/validation/GuavaSessionCache.kt
@@ -6,8 +6,8 @@ import org.hl7.fhir.validation.ValidationEngine
 import org.hl7.fhir.validation.cli.services.SessionCache
 import java.util.*
 
-class GuavaSessionCache : SessionCache {
-    private val cache: Cache<String, ValidationEngine> = CacheBuilder.newBuilder().maximumSize(1).build()
+class GuavaSessionCache(cacheSize : Long) : SessionCache {
+    private val cache: Cache<String, ValidationEngine> = CacheBuilder.newBuilder().maximumSize(cacheSize).build()
 
     override fun cacheSession(validationEngine: ValidationEngine): String {
         val generatedId = generateID()
diff --git a/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt b/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt
index 77066d50..b7b66916 100644
--- a/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt
+++ b/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt
@@ -25,7 +25,7 @@ class ValidationServiceFactoryImpl : ValidationServiceFactory {
     fun createValidationServiceInstance(): ValidationService {
       //  val sessionCacheDuration = System.getenv("SESSION_CACHE_DURATION")?.toLong() ?: SESSION_DEFAULT_DURATION;
         val sessionCache: SessionCache =
-            GuavaSessionCache()
+            GuavaSessionCache(4)
         val validationService = ValidationService(sessionCache);
         thread {
         Preset.values().forEach {
diff --git a/src/jvmTest/kotlin/controller/validation/GuavaCacheTest.kt b/src/jvmTest/kotlin/controller/validation/GuavaCacheTest.kt
new file mode 100644
index 00000000..2b39c1e9
--- /dev/null
+++ b/src/jvmTest/kotlin/controller/validation/GuavaCacheTest.kt
@@ -0,0 +1,47 @@
+package controller.validation
+
+import instrumentation.ValidationInstrumentation.compareValidationResponses
+import instrumentation.ValidationInstrumentation.givenAValidationRequest
+import instrumentation.ValidationInstrumentation.givenAValidationResult
+import io.mockk.coEvery
+import io.mockk.mockk
+import kotlinx.coroutines.runBlocking
+import org.hl7.fhir.validation.ValidationEngine
+import org.hl7.fhir.validation.cli.services.SessionCache
+import org.junit.jupiter.api.Test
+import org.junit.jupiter.api.TestInstance
+
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+class GuavaCacheTest {
+
+    @Test
+    fun `test happy path`() {
+        val sessionCache: GuavaSessionCache =
+            GuavaSessionCache(2)
+        val sessionIds : Set<String> = sessionCache.getSessionIds();
+        val engine1 : ValidationEngine = mockk()
+        val sessionId1 = sessionCache.cacheSession(engine1);
+
+        val engine2 : ValidationEngine = mockk()
+        val sessionId2 = sessionCache.cacheSession(engine2);
+
+        assert(sessionCache.sessionIds.size == 2)
+
+        val engine3 : ValidationEngine = mockk()
+        val sessionId3 = sessionCache.cacheSession(engine3);
+
+        assert(sessionCache.sessionIds.size == 2)
+        assert(sessionCache.sessionExists(sessionId2));
+        assert(sessionCache.sessionExists(sessionId3));
+
+        sessionCache.fetchSessionValidatorEngine(sessionId2);
+
+        val engine4 : ValidationEngine = mockk()
+        val sessionId4 = sessionCache.cacheSession(engine4);
+
+        assert(sessionCache.sessionIds.size == 2)
+        assert(sessionCache.sessionExists(sessionId2));
+        assert(sessionCache.sessionExists(sessionId4));
+
+    }
+}
\ No newline at end of file

From 47091c65f61e40555df6f98cd570a157e284f0fd Mon Sep 17 00:00:00 2001
From: dotasek <david.otasek@smilecdr.com>
Date: Tue, 2 Jul 2024 15:07:37 -0400
Subject: [PATCH 14/22] Restore old duration setting for cache + explicitly
 indicate adapter

---
 ...uavaSessionCache.kt => GuavaSessionCacheAdapter.kt} |  5 +++--
 .../validation/ValidationServiceFactoryImpl.kt         |  7 +++++--
 .../kotlin/controller/validation/GuavaCacheTest.kt     | 10 ++--------
 3 files changed, 10 insertions(+), 12 deletions(-)
 rename src/jvmMain/kotlin/controller/validation/{GuavaSessionCache.kt => GuavaSessionCacheAdapter.kt} (87%)

diff --git a/src/jvmMain/kotlin/controller/validation/GuavaSessionCache.kt b/src/jvmMain/kotlin/controller/validation/GuavaSessionCacheAdapter.kt
similarity index 87%
rename from src/jvmMain/kotlin/controller/validation/GuavaSessionCache.kt
rename to src/jvmMain/kotlin/controller/validation/GuavaSessionCacheAdapter.kt
index 28215cf2..6f39a117 100644
--- a/src/jvmMain/kotlin/controller/validation/GuavaSessionCache.kt
+++ b/src/jvmMain/kotlin/controller/validation/GuavaSessionCacheAdapter.kt
@@ -5,9 +5,10 @@ import com.google.common.cache.CacheBuilder
 import org.hl7.fhir.validation.ValidationEngine
 import org.hl7.fhir.validation.cli.services.SessionCache
 import java.util.*
+import java.util.concurrent.TimeUnit
 
-class GuavaSessionCache(cacheSize : Long) : SessionCache {
-    private val cache: Cache<String, ValidationEngine> = CacheBuilder.newBuilder().maximumSize(cacheSize).build()
+class GuavaSessionCacheAdapter(cacheSize : Long, cacheDuration: Long) : SessionCache {
+    private val cache: Cache<String, ValidationEngine> = CacheBuilder.newBuilder().expireAfterAccess(cacheDuration, TimeUnit.MINUTES).maximumSize(cacheSize).build()
 
     override fun cacheSession(validationEngine: ValidationEngine): String {
         val generatedId = generateID()
diff --git a/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt b/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt
index b7b66916..6c7dd0b3 100644
--- a/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt
+++ b/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt
@@ -12,6 +12,7 @@ import kotlin.concurrent.thread
 
 
 private const val SESSION_DEFAULT_DURATION: Long = 60
+private const val SESSION_DEFAULT_SIZE: Long = 4
 
 
 class ValidationServiceFactoryImpl : ValidationServiceFactory {
@@ -23,9 +24,11 @@ class ValidationServiceFactoryImpl : ValidationServiceFactory {
     }
 
     fun createValidationServiceInstance(): ValidationService {
-      //  val sessionCacheDuration = System.getenv("SESSION_CACHE_DURATION")?.toLong() ?: SESSION_DEFAULT_DURATION;
+        val sessionCacheDuration = System.getenv("SESSION_CACHE_DURATION")?.toLong() ?: SESSION_DEFAULT_DURATION;
+        val sessionCacheSize = System.getenv("SESSION_CACHE_SIZE")?.toLong() ?: SESSION_DEFAULT_SIZE
+
         val sessionCache: SessionCache =
-            GuavaSessionCache(4)
+            GuavaSessionCacheAdapter(sessionCacheSize, sessionCacheDuration)
         val validationService = ValidationService(sessionCache);
         thread {
         Preset.values().forEach {
diff --git a/src/jvmTest/kotlin/controller/validation/GuavaCacheTest.kt b/src/jvmTest/kotlin/controller/validation/GuavaCacheTest.kt
index 2b39c1e9..24fd20fe 100644
--- a/src/jvmTest/kotlin/controller/validation/GuavaCacheTest.kt
+++ b/src/jvmTest/kotlin/controller/validation/GuavaCacheTest.kt
@@ -1,13 +1,7 @@
 package controller.validation
 
-import instrumentation.ValidationInstrumentation.compareValidationResponses
-import instrumentation.ValidationInstrumentation.givenAValidationRequest
-import instrumentation.ValidationInstrumentation.givenAValidationResult
-import io.mockk.coEvery
 import io.mockk.mockk
-import kotlinx.coroutines.runBlocking
 import org.hl7.fhir.validation.ValidationEngine
-import org.hl7.fhir.validation.cli.services.SessionCache
 import org.junit.jupiter.api.Test
 import org.junit.jupiter.api.TestInstance
 
@@ -16,8 +10,8 @@ class GuavaCacheTest {
 
     @Test
     fun `test happy path`() {
-        val sessionCache: GuavaSessionCache =
-            GuavaSessionCache(2)
+        val sessionCache: GuavaSessionCacheAdapter =
+            GuavaSessionCacheAdapter(2)
         val sessionIds : Set<String> = sessionCache.getSessionIds();
         val engine1 : ValidationEngine = mockk()
         val sessionId1 = sessionCache.cacheSession(engine1);

From e05f7562066fa4cc16af426b3e1f07204f57fb24 Mon Sep 17 00:00:00 2001
From: dotasek <david.otasek@smilecdr.com>
Date: Tue, 2 Jul 2024 15:25:52 -0400
Subject: [PATCH 15/22] Fix test

---
 src/jvmTest/kotlin/controller/validation/GuavaCacheTest.kt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/jvmTest/kotlin/controller/validation/GuavaCacheTest.kt b/src/jvmTest/kotlin/controller/validation/GuavaCacheTest.kt
index 24fd20fe..08268a8d 100644
--- a/src/jvmTest/kotlin/controller/validation/GuavaCacheTest.kt
+++ b/src/jvmTest/kotlin/controller/validation/GuavaCacheTest.kt
@@ -11,7 +11,7 @@ class GuavaCacheTest {
     @Test
     fun `test happy path`() {
         val sessionCache: GuavaSessionCacheAdapter =
-            GuavaSessionCacheAdapter(2)
+            GuavaSessionCacheAdapter(2, 10)
         val sessionIds : Set<String> = sessionCache.getSessionIds();
         val engine1 : ValidationEngine = mockk()
         val sessionId1 = sessionCache.cacheSession(engine1);

From 49777b7a1660ba43cfe8469361aff768c3f93867 Mon Sep 17 00:00:00 2001
From: dotasek <david.otasek@smilecdr.com>
Date: Wed, 3 Jul 2024 11:29:34 -0400
Subject: [PATCH 16/22] Add test cases for presets + fix incorrect presets +
 fix preset profiles

---
 gradle.properties                             |   2 +-
 .../base-engine-requests/default.json         | 144 ----------------
 .../cda.json                                  |   4 +-
 .../resources/preset-requests/default.json    |  13 ++
 .../ips-au.json                               |  19 +-
 .../ips-nz.json                               |  19 +-
 .../ips.json                                  |  19 +-
 .../sql-on-fhir.json                          |   5 +-
 .../us-ccda.json                              |   5 +-
 http-client-tests/tests/preset-queries.http   | 163 ++++++++++++++++++
 src/commonMain/kotlin/constants/Preset.kt     |   5 +-
 src/jsMain/kotlin/utils/RequestUtils.kt       |   4 +
 12 files changed, 197 insertions(+), 205 deletions(-)
 delete mode 100644 http-client-tests/resources/base-engine-requests/default.json
 rename http-client-tests/resources/{base-engine-requests => preset-requests}/cda.json (99%)
 create mode 100644 http-client-tests/resources/preset-requests/default.json
 rename http-client-tests/resources/{base-engine-requests => preset-requests}/ips-au.json (98%)
 rename http-client-tests/resources/{base-engine-requests => preset-requests}/ips-nz.json (99%)
 rename http-client-tests/resources/{base-engine-requests => preset-requests}/ips.json (98%)
 rename http-client-tests/resources/{base-engine-requests => preset-requests}/sql-on-fhir.json (93%)
 rename http-client-tests/resources/{base-engine-requests => preset-requests}/us-ccda.json (99%)
 create mode 100644 http-client-tests/tests/preset-queries.http

diff --git a/gradle.properties b/gradle.properties
index b4d2dce6..3b71db8f 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -2,7 +2,7 @@ kotlin.code.style=official
 kotlin.js.generate.executable.default=false
 
 # versions
-fhirCoreVersion=6.3.12-SNAPSHOT
+fhirCoreVersion=6.3.14-SNAPSHOT
 
 junitVersion=5.7.1
 mockk_version=1.10.2
diff --git a/http-client-tests/resources/base-engine-requests/default.json b/http-client-tests/resources/base-engine-requests/default.json
deleted file mode 100644
index 4f761899..00000000
--- a/http-client-tests/resources/base-engine-requests/default.json
+++ /dev/null
@@ -1,144 +0,0 @@
-{
-  "resourceType": "Observation",
-  "id": "blood-pressure",
-  "meta": {
-    "profile": [
-      "http://hl7.org/fhir/StructureDefinition/vitalsigns"
-    ]
-  },
-  "text": {
-    "status": "generated",
-    "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: blood-pressure</p><p><b>meta</b>: </p><p><b>identifier</b>: urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281</p><p><b>basedOn</b>: </p><p><b>status</b>: final</p><p><b>category</b>: Vital Signs <span>(Details : {http://terminology.hl7.org/CodeSystem/observation-category code 'vital-signs' = 'Vital Signs', given as 'Vital Signs'})</span></p><p><b>code</b>: Blood pressure systolic &amp; diastolic <span>(Details : {LOINC code '85354-9' = 'Blood pressure panel with all children optional', given as 'Blood pressure panel with all children optional'})</span></p><p><b>subject</b>: <a>Patient/example</a></p><p><b>effective</b>: 17/09/2012</p><p><b>performer</b>: <a>Practitioner/example</a></p><p><b>interpretation</b>: Below low normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'L' = 'Low', given as 'low'})</span></p><p><b>bodySite</b>: Right arm <span>(Details : {SNOMED CT code '368209003' = 'Right upper arm', given as 'Right arm'})</span></p><blockquote><p><b>component</b></p><p><b>code</b>: Systolic blood pressure <span>(Details : {LOINC code '8480-6' = 'Systolic blood pressure', given as 'Systolic blood pressure'}; {SNOMED CT code '271649006' = 'Systolic blood pressure', given as 'Systolic blood pressure'}; {http://acme.org/devices/clinical-codes code 'bp-s' = 'bp-s', given as 'Systolic Blood pressure'})</span></p><p><b>value</b>: 107 mmHg<span> (Details: UCUM code mm[Hg] = 'mmHg')</span></p><p><b>interpretation</b>: Normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'N' = 'Normal', given as 'normal'})</span></p></blockquote><blockquote><p><b>component</b></p><p><b>code</b>: Diastolic blood pressure <span>(Details : {LOINC code '8462-4' = 'Diastolic blood pressure', given as 'Diastolic blood pressure'})</span></p><p><b>value</b>: 60 mmHg<span> (Details: UCUM code mm[Hg] = 'mmHg')</span></p><p><b>interpretation</b>: Below low normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'L' = 'Low', given as 'low'})</span></p></blockquote></div>"
-  },
-  "identifier": [
-    {
-      "system": "urn:ietf:rfc:3986",
-      "value": "urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281"
-    }
-  ],
-  "basedOn": [
-    {
-      "identifier": {
-        "system": "https://acme.org/identifiers",
-        "value": "1234"
-      }
-    }
-  ],
-  "status": "final",
-  "category": [
-    {
-      "coding": [
-        {
-          "system": "http://terminology.hl7.org/CodeSystem/observation-category",
-          "code": "vital-signs",
-          "display": "Vital Signs"
-        }
-      ]
-    }
-  ],
-  "code": {
-    "coding": [
-      {
-        "system": "http://loinc.org",
-        "code": "85354-9",
-        "display": "Blood pressure panel with all children optional"
-      }
-    ],
-    "text": "Blood pressure systolic & diastolic"
-  },
-  "subject": {
-    "reference": "Patient/example"
-  },
-  "effectiveDateTime": "2012-09-17",
-  "performer": [
-    {
-      "reference": "Practitioner/example"
-    }
-  ],
-  "interpretation": [
-    {
-      "coding": [
-        {
-          "system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
-          "code": "L",
-          "display": "low"
-        }
-      ],
-      "text": "Below low normal"
-    }
-  ],
-  "bodySite": {
-    "coding": [
-      {
-        "system": "http://snomed.info/sct",
-        "code": "368209003",
-        "display": "Right arm"
-      }
-    ]
-  },
-  "component": [
-    {
-      "code": {
-        "coding": [
-          {
-            "system": "http://loinc.org",
-            "code": "8480-6",
-            "display": "Systolic blood pressure"
-          },
-          {
-            "system": "http://snomed.info/sct",
-            "code": "271649006",
-            "display": "Systolic blood pressure"
-          }
-        ]
-      },
-      "valueQuantity": {
-        "value": 107,
-        "unit": "mmHg",
-        "system": "http://unitsofmeasure.org",
-        "code": "mm[Hg]"
-      },
-      "interpretation": [
-        {
-          "coding": [
-            {
-              "system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
-              "code": "N",
-              "display": "normal"
-            }
-          ],
-          "text": "Normal"
-        }
-      ]
-    },
-    {
-      "code": {
-        "coding": [
-          {
-            "system": "http://loinc.org",
-            "code": "8462-4",
-            "display": "Diastolic blood pressure"
-          }
-        ]
-      },
-      "valueQuantity": {
-        "value": 60,
-        "unit": "mmHg",
-        "system": "http://unitsofmeasure.org",
-        "code": "mm[Hg]"
-      },
-      "interpretation": [
-        {
-          "coding": [
-            {
-              "system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
-              "code": "L",
-              "display": "low"
-            }
-          ],
-          "text": "Below low normal"
-        }
-      ]
-    }
-  ]
-}
\ No newline at end of file
diff --git a/http-client-tests/resources/base-engine-requests/cda.json b/http-client-tests/resources/preset-requests/cda.json
similarity index 99%
rename from http-client-tests/resources/base-engine-requests/cda.json
rename to http-client-tests/resources/preset-requests/cda.json
index 1bd1e3f6..e6c91446 100644
--- a/http-client-tests/resources/base-engine-requests/cda.json
+++ b/http-client-tests/resources/preset-requests/cda.json
@@ -1,7 +1,7 @@
 {
   "cliContext": {
-
-    "locale": "en"
+      "baseEngine": "CDA",
+      "locale": "en"
   },
   "filesToValidate": [
     {
diff --git a/http-client-tests/resources/preset-requests/default.json b/http-client-tests/resources/preset-requests/default.json
new file mode 100644
index 00000000..1be4debb
--- /dev/null
+++ b/http-client-tests/resources/preset-requests/default.json
@@ -0,0 +1,13 @@
+{
+"cliContext": {
+  "baseEngine": "DEFAULT",
+  "locale": "en"
+},
+"filesToValidate": [
+{
+"fileName": "manually_entered_file.json",
+"fileContent": "{\n  \"resourceType\": \"Observation\",\n  \"id\": \"blood-pressure\",\n  \"meta\": {\n    \"profile\": [\n      \"http://hl7.org/fhir/StructureDefinition/vitalsigns\"\n    ]\n  },\n  \"text\": {\n    \"status\": \"generated\",\n    \"div\": \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: blood-pressure</p><p><b>meta</b>: </p><p><b>identifier</b>: urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281</p><p><b>basedOn</b>: </p><p><b>status</b>: final</p><p><b>category</b>: Vital Signs <span>(Details : {http://terminology.hl7.org/CodeSystem/observation-category code 'vital-signs' = 'Vital Signs', given as 'Vital Signs'})</span></p><p><b>code</b>: Blood pressure systolic &amp; diastolic <span>(Details : {LOINC code '85354-9' = 'Blood pressure panel with all children optional', given as 'Blood pressure panel with all children optional'})</span></p><p><b>subject</b>: <a>Patient/example</a></p><p><b>effective</b>: 17/09/2012</p><p><b>performer</b>: <a>Practitioner/example</a></p><p><b>interpretation</b>: Below low normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'L' = 'Low', given as 'low'})</span></p><p><b>bodySite</b>: Right arm <span>(Details : {SNOMED CT code '368209003' = 'Right upper arm', given as 'Right arm'})</span></p><blockquote><p><b>component</b></p><p><b>code</b>: Systolic blood pressure <span>(Details : {LOINC code '8480-6' = 'Systolic blood pressure', given as 'Systolic blood pressure'}; {SNOMED CT code '271649006' = 'Systolic blood pressure', given as 'Systolic blood pressure'}; {http://acme.org/devices/clinical-codes code 'bp-s' = 'bp-s', given as 'Systolic Blood pressure'})</span></p><p><b>value</b>: 107 mmHg<span> (Details: UCUM code mm[Hg] = 'mmHg')</span></p><p><b>interpretation</b>: Normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'N' = 'Normal', given as 'normal'})</span></p></blockquote><blockquote><p><b>component</b></p><p><b>code</b>: Diastolic blood pressure <span>(Details : {LOINC code '8462-4' = 'Diastolic blood pressure', given as 'Diastolic blood pressure'})</span></p><p><b>value</b>: 60 mmHg<span> (Details: UCUM code mm[Hg] = 'mmHg')</span></p><p><b>interpretation</b>: Below low normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'L' = 'Low', given as 'low'})</span></p></blockquote></div>\"\n  },\n  \"identifier\": [\n    {\n      \"system\": \"urn:ietf:rfc:3986\",\n      \"value\": \"urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281\"\n    }\n  ],\n  \"basedOn\": [\n    {\n      \"identifier\": {\n        \"system\": \"https://acme.org/identifiers\",\n        \"value\": \"1234\"\n      }\n    }\n  ],\n  \"status\": \"final\",\n  \"category\": [\n    {\n      \"coding\": [\n        {\n          \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n          \"code\": \"vital-signs\",\n          \"display\": \"Vital Signs\"\n        }\n      ]\n    }\n  ],\n  \"code\": {\n    \"coding\": [\n      {\n        \"system\": \"http://loinc.org\",\n        \"code\": \"85354-9\",\n        \"display\": \"Blood pressure panel with all children optional\"\n      }\n    ],\n    \"text\": \"Blood pressure systolic & diastolic\"\n  },\n  \"subject\": {\n    \"reference\": \"Patient/example\"\n  },\n  \"effectiveDateTime\": \"2012-09-17\",\n  \"performer\": [\n    {\n      \"reference\": \"Practitioner/example\"\n    }\n  ],\n  \"interpretation\": [\n    {\n      \"coding\": [\n        {\n          \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n          \"code\": \"L\",\n          \"display\": \"low\"\n        }\n      ],\n      \"text\": \"Below low normal\"\n    }\n  ],\n  \"bodySite\": {\n    \"coding\": [\n      {\n        \"system\": \"http://snomed.info/sct\",\n        \"code\": \"368209003\",\n        \"display\": \"Right arm\"\n      }\n    ]\n  },\n  \"component\": [\n    {\n      \"code\": {\n        \"coding\": [\n          {\n            \"system\": \"http://loinc.org\",\n            \"code\": \"8480-6\",\n            \"display\": \"Systolic blood pressure\"\n          },\n          {\n            \"system\": \"http://snomed.info/sct\",\n            \"code\": \"271649006\",\n            \"display\": \"Systolic blood pressure\"\n          }\n        ]\n      },\n      \"valueQuantity\": {\n        \"value\": 107,\n        \"unit\": \"mmHg\",\n        \"system\": \"http://unitsofmeasure.org\",\n        \"code\": \"mm[Hg]\"\n      },\n      \"interpretation\": [\n        {\n          \"coding\": [\n            {\n              \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n              \"code\": \"N\",\n              \"display\": \"normal\"\n            }\n          ],\n          \"text\": \"Normal\"\n        }\n      ]\n    },\n    {\n      \"code\": {\n        \"coding\": [\n          {\n            \"system\": \"http://loinc.org\",\n            \"code\": \"8462-4\",\n            \"display\": \"Diastolic blood pressure\"\n          }\n        ]\n      },\n      \"valueQuantity\": {\n        \"value\": 60,\n        \"unit\": \"mmHg\",\n        \"system\": \"http://unitsofmeasure.org\",\n        \"code\": \"mm[Hg]\"\n      },\n      \"interpretation\": [\n        {\n          \"coding\": [\n            {\n              \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n              \"code\": \"L\",\n              \"display\": \"low\"\n            }\n          ],\n          \"text\": \"Below low normal\"\n        }\n      ]\n    }\n  ]\n}",
+"fileType": null
+}
+]
+}
\ No newline at end of file
diff --git a/http-client-tests/resources/base-engine-requests/ips-au.json b/http-client-tests/resources/preset-requests/ips-au.json
similarity index 98%
rename from http-client-tests/resources/base-engine-requests/ips-au.json
rename to http-client-tests/resources/preset-requests/ips-au.json
index 31b0f152..7ff09de0 100644
--- a/http-client-tests/resources/base-engine-requests/ips-au.json
+++ b/http-client-tests/resources/preset-requests/ips-au.json
@@ -1,23 +1,10 @@
 {
   "cliContext": {
-    "extensions": [
-      "any"
-    ],
-    "sv": "4.0.1",
-    "igs": [
-      "hl7.fhir.au.ips#current"
-    ],
+    "baseEngine": "IPS_AU",
+    "locale": "en",
     "profiles": [
       "http://hl7.org.au/fhir/ips/StructureDefinition/Bundle-au-ips"
-    ],
-    "checkIPSCodes": true,
-    "bundleValidationRules": [
-      {
-        "rule": "Composition:0",
-        "profile": "http://hl7.org.au/fhir/ips/StructureDefinition/Composition-au-ips"
-      }
-    ],
-    "locale": "en"
+    ]
   },
   "filesToValidate": [
     {
diff --git a/http-client-tests/resources/base-engine-requests/ips-nz.json b/http-client-tests/resources/preset-requests/ips-nz.json
similarity index 99%
rename from http-client-tests/resources/base-engine-requests/ips-nz.json
rename to http-client-tests/resources/preset-requests/ips-nz.json
index 12c4420e..a6d12c6a 100644
--- a/http-client-tests/resources/base-engine-requests/ips-nz.json
+++ b/http-client-tests/resources/preset-requests/ips-nz.json
@@ -1,23 +1,10 @@
 {
   "cliContext": {
-    "extensions": [
-      "any"
-    ],
-    "sv": "4.0.1",
-    "igs": [
-      "tewhatuora.fhir.nzps#current"
-    ],
+    "baseEngine": "IPS_NZ",
+    "locale": "en",
     "profiles": [
       "https://standards.digital.health.nz/fhir/StructureDefinition/nzps-bundle"
-    ],
-    "checkIPSCodes": true,
-    "bundleValidationRules": [
-      {
-        "rule": "Composition:0",
-        "profile": "https://standards.digital.health.nz/fhir/StructureDefinition/nzps-composition"
-      }
-    ],
-    "locale": "en"
+    ]
   },
   "filesToValidate": [
     {
diff --git a/http-client-tests/resources/base-engine-requests/ips.json b/http-client-tests/resources/preset-requests/ips.json
similarity index 98%
rename from http-client-tests/resources/base-engine-requests/ips.json
rename to http-client-tests/resources/preset-requests/ips.json
index ec046d68..56ee6879 100644
--- a/http-client-tests/resources/base-engine-requests/ips.json
+++ b/http-client-tests/resources/preset-requests/ips.json
@@ -1,23 +1,10 @@
 {
   "cliContext": {
-    "extensions": [
-      "any"
-    ],
-    "sv": "4.0.1",
-    "igs": [
-      "hl7.fhir.uv.ips#1.1.0"
-    ],
+    "baseEngine": "IPS",
+    "locale": "en",
     "profiles": [
       "http://hl7.org/fhir/uv/ips/StructureDefinition/Bundle-uv-ips"
-    ],
-    "checkIPSCodes": true,
-    "bundleValidationRules": [
-      {
-        "rule": "Composition:0",
-        "profile": "http://hl7.org/fhir/uv/ips/StructureDefinition/Composition-uv-ips"
-      }
-    ],
-    "locale": "en"
+    ]
   },
   "filesToValidate": [
     {
diff --git a/http-client-tests/resources/base-engine-requests/sql-on-fhir.json b/http-client-tests/resources/preset-requests/sql-on-fhir.json
similarity index 93%
rename from http-client-tests/resources/base-engine-requests/sql-on-fhir.json
rename to http-client-tests/resources/preset-requests/sql-on-fhir.json
index b4a2db2b..1871766d 100644
--- a/http-client-tests/resources/base-engine-requests/sql-on-fhir.json
+++ b/http-client-tests/resources/preset-requests/sql-on-fhir.json
@@ -1,9 +1,6 @@
 {
   "cliContext": {
-    "sv": "5.0.0",
-    "igs": [
-      "hl7.fhir.uv.sql-on-fhir#current"
-    ],
+    "baseEngine": "SQL_VIEW",
     "locale": "en"
   },
   "filesToValidate": [
diff --git a/http-client-tests/resources/base-engine-requests/us-ccda.json b/http-client-tests/resources/preset-requests/us-ccda.json
similarity index 99%
rename from http-client-tests/resources/base-engine-requests/us-ccda.json
rename to http-client-tests/resources/preset-requests/us-ccda.json
index e5d0832f..533bf12f 100644
--- a/http-client-tests/resources/base-engine-requests/us-ccda.json
+++ b/http-client-tests/resources/preset-requests/us-ccda.json
@@ -1,9 +1,6 @@
 {
   "cliContext": {
-    "sv": "5.0.0",
-    "igs": [
-      "hl7.cda.us.ccda#3.0.0-ballot"
-    ],
+    "baseEngine": "US_CCDA",
     "locale": "en"
   },
   "filesToValidate": [
diff --git a/http-client-tests/tests/preset-queries.http b/http-client-tests/tests/preset-queries.http
new file mode 100644
index 00000000..61c60aae
--- /dev/null
+++ b/http-client-tests/tests/preset-queries.http
@@ -0,0 +1,163 @@
+# These tests do validations using CliContext instances that use the presents in
+# commonMain/kotlin/constants/Preset
+
+# Conversely, the preset-queries.http tests will perform the same tests, but using
+# the baseEngine field of the CliContext to utilize the pre-built ValidationEngine
+# from the ValidationService
+
+### Default
+# @name Default
+POST {{host}}/validate
+Content-Type: application/json
+
+< ../resources/preset-requests/default.json
+
+> {%
+    client.test("Validated Successfully", function() {
+        client.assert(response.status === 200, "Response status is not 200");
+    });
+    import { containsIssue } from "../utilities/assertions";
+    client.test("Issues are Correct", function() {
+        let issues = response.body.outcomes[0].issues
+        client.log("issues:" + issues.length)
+        client.assert(issues.length === 2);
+        client.assert(containsIssue(issues, 88, 12, "This element does not match any known slice defined in the profile http://hl7.org/fhir/StructureDefinition/bp|4.0.1 (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL", "INFORMATION"));
+    });
+%}
+
+### CDA
+# @name CDA
+# This example is compo
+POST {{host}}/validate
+Content-Type: application/json
+
+< ../resources/preset-requests/cda.json
+
+> {%
+    client.test("Validated Successfully", function() {
+        client.assert(response.status === 200, "Response status is not 200");
+    });
+    import { containsIssue } from "../utilities/assertions";
+
+    client.test("Issues are Correct", function () {
+        let issues = response.body.outcomes[0].issues
+        client.log("issues:" + issues.length)
+        client.assert(issues.length === 10);
+        client.assert(containsIssue(issues, 20, 24, "Binding has no source, so can't be checked", "CODEINVALID", "INFORMATION"))
+        client.assert(containsIssue(issues, 251, 184, "The OID '2.16.840.1.114222.4.11.1066' is not known, so the code can't be validated", "CODEINVALID", "WARNING"))
+    });
+%}
+
+
+### US-CDA
+# @name US-CDA
+# Check that a request with explicit IG settings returns an expected response
+POST {{host}}/validate
+Content-Type: application/json
+
+< ../resources/preset-requests/us-ccda.json
+
+> {%
+    client.test("Validated Successfully", function() {
+        client.assert(response.status === 200, "Response status is not 200");
+    });
+    import { containsIssue } from "../utilities/assertions";
+    client.test("Issues are Correct", function() {
+        let issues = response.body.outcomes[0].issues
+        client.log("issues:" + issues.length)
+        client.assert(issues.length === 10)
+        client.assert(containsIssue(issues, 20, 24, "Binding has no source, so can't be checked", "CODEINVALID", "INFORMATION"))
+        client.assert(!containsIssue(issues, 251, 184, "The OID '2.16.840.1.113883.1.11.19830' is not known, so the code can't be validated", "CODEINVALID", "WARNING"))
+    })
+%}
+
+### IPS
+# @name IPS
+POST {{host}}/validate
+Content-Type: application/json
+
+< ../resources/preset-requests/ips.json
+
+> {%
+    client.test("Validated Successfully", function() {
+        client.assert(response.status === 200, "Response status is not 200");
+    });
+    import { containsIssue } from "../utilities/assertions";
+    client.test("Issues are Correct", function() {
+        let issues = response.body.outcomes[0].issues
+        client.log("issues:" + issues.length)
+        client.assert(issues.length === 46);
+        client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 373270004 (Substance with penicillin structure and antibacterial mechanism of action) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
+        client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 108774000 (Product containing anastrozole (medicinal product)) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
+
+        client.assert(!containsIssue(issues, 314, 4, "This element does not match any known slice defined in the profile http://hl7.org.au/fhir/ips/StructureDefinition/Bundle-au-ips|0.0.1 (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL", "INFORMATION"))
+        client.assert(!containsIssue(issues, 134, 8, "This element does not match any known slice defined in the profile http://hl7.org.au/fhir/core/StructureDefinition/au-core-patient|0.3.0 (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL","INFORMATION"))
+
+    });
+%}
+
+### IPS-AU
+# @name IPS-AU
+POST {{host}}/validate
+Content-Type: application/json
+
+< ../resources/preset-requests/ips-au.json
+
+> {%
+    client.test("Validated Successfully", function() {
+        client.assert(response.status === 200, "Response status is not 200");
+    });
+    import { containsIssue } from "../utilities/assertions";
+    client.test("Issues are Correct", function() {
+        let issues = response.body.outcomes[0].issues
+        client.log("issues:" + issues.length)
+        client.assert(issues.length === 53);
+        client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 373270004 (Substance with penicillin structure and antibacterial mechanism of action) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
+        client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 108774000 (Product containing anastrozole (medicinal product)) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
+        client.assert(containsIssue(issues, 314, 4, "This element does not match any known slice defined in the profile http://hl7.org.au/fhir/ips/StructureDefinition/Bundle-au-ips|0.0.1 (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL", "INFORMATION"))
+        client.assert(containsIssue(issues, 134, 8, "This element does not match any known slice defined in the profile http://hl7.org.au/fhir/core/StructureDefinition/au-core-patient|0.5.0-ci-build (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL", "INFORMATION"))
+    });
+%}
+
+### IPS-NZ
+# @name IPS-NZ
+POST {{host}}/validate
+Content-Type: application/json
+
+< ../resources/preset-requests/ips-nz.json
+
+> {%
+    client.test("Validated Successfully", function() {
+        client.assert(response.status === 200, "Response status is not 200");
+    });
+    import { containsIssue } from "../utilities/assertions";
+    client.test("Issues are Correct", function() {
+        let issues = response.body.outcomes[0].issues
+        client.log("issues:" + issues.length)
+        client.assert(issues.length === 102);
+        client.assert(containsIssue(issues, 12,10,"This element does not match any known slice defined in the profile https://standards.digital.health.nz/fhir/StructureDefinition/nzps-bundle|0.3.0 (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL", "INFORMATION"))
+    });
+%}
+
+### SQL-ON-FHIR
+# @name SQL-ON-FHIR
+# Check that a request with explicit IG settings returns an expected response
+POST {{host}}/validate
+Content-Type: application/json
+
+< ../resources/preset-requests/sql-on-fhir.json
+
+> {%
+    client.test("Validated Successfully", function() {
+        client.assert(response.status === 200, "Response status is not 200");
+    });
+    import { containsIssue } from "../utilities/assertions";
+    client.test("Issues are Correct", function() {
+        let issues = response.body.outcomes[0].issues
+        client.log("issues:" + issues.length)
+        client.assert(issues.length === 3);
+        client.assert(containsIssue(issues, 20, 21, "The column 'use' appears to be a collection based on it's path. Collections are not supported in all execution contexts", "BUSINESSRULE", "WARNING"))
+        client.assert(containsIssue(issues, 24, 21, "The column 'city' appears to be a collection based on it's path. Collections are not supported in all execution contexts", "BUSINESSRULE", "WARNING"))
+        client.assert(containsIssue(issues, 28, 21, "The column 'zip' appears to be a collection based on it's path. Collections are not supported in all execution contexts", "BUSINESSRULE", "WARNING"))
+    });
+%}
\ No newline at end of file
diff --git a/src/commonMain/kotlin/constants/Preset.kt b/src/commonMain/kotlin/constants/Preset.kt
index 896435b8..20d6c26d 100644
--- a/src/commonMain/kotlin/constants/Preset.kt
+++ b/src/commonMain/kotlin/constants/Preset.kt
@@ -33,14 +33,14 @@ val IPS_NZ_IG = PackageInfo(
 
 val CDA_IG = PackageInfo(
     "hl7.cda.uv.core",
-    "2.0.0-sd-ballot",
+    "2.0.0-sd-snapshot1",
     "5.0.0",
     "http://hl7.org/cda/stds/core/ImplementationGuide/hl7.cda.uv.core"
 )
 
 val CCDA_IG = PackageInfo(
     "hl7.cda.us.ccda",
-    "current",
+    "3.0.0-ballot",
     "5.0.0",
     "http://hl7.org/fhir/us/ccda/ImplementationGuide/hl7.fhir.us.ccda"
 )
@@ -86,6 +86,7 @@ val IPS_NZ_CONTEXT = CliContext()
     .setBaseEngine("IPS_NZ")
     .setSv("4.0.1")
     .addIg(PackageInfo.igLookupString(IPS_NZ_IG))
+    .setProfiles(listOf(IPS_NZ_BUNDLE_PROFILE))
     .setExtensions(listOf(ANY_EXTENSION))
     .setCheckIPSCodes(true)
     .setBundleValidationRules(listOf(
diff --git a/src/jsMain/kotlin/utils/RequestUtils.kt b/src/jsMain/kotlin/utils/RequestUtils.kt
index 39268bb8..2edfc5ef 100644
--- a/src/jsMain/kotlin/utils/RequestUtils.kt
+++ b/src/jsMain/kotlin/utils/RequestUtils.kt
@@ -29,7 +29,11 @@ fun assembleCliContext(cliContext: CliContext): CliContext {
     }
     console.log("Building new CLI Context")
     val baseEngineContext = CliContext()
+
     baseEngineContext.setBaseEngine(cliContext.getBaseEngine())
+    for (profile in cliContext.getProfiles()) {
+        baseEngineContext.addProfile(profile)
+    }
     baseEngineContext.setLocale(cliContext.getLanguageCode())
     return baseEngineContext;
 }

From 735ca7d958610b32bcbe1d566d002b5432758110 Mon Sep 17 00:00:00 2001
From: dotasek <david.otasek@smilecdr.com>
Date: Wed, 3 Jul 2024 17:20:50 -0400
Subject: [PATCH 17/22] More tests for to verify session cache behaviour +
 cleanup unused code

---
 .../session_1_validation_1.json               |  14 +++
 .../session_1_validation_2.json               |  15 +++
 .../session_2_validation_1.json               |  14 +++
 .../session_2_validation_2.json               |  15 +++
 http-client-tests/tests/session-queries.http  | 103 ++++++++++++++++++
 .../validation/GuavaSessionCacheAdapter.kt    |   5 -
 6 files changed, 161 insertions(+), 5 deletions(-)
 create mode 100644 http-client-tests/resources/session-requests/session_1_validation_1.json
 create mode 100644 http-client-tests/resources/session-requests/session_1_validation_2.json
 create mode 100644 http-client-tests/resources/session-requests/session_2_validation_1.json
 create mode 100644 http-client-tests/resources/session-requests/session_2_validation_2.json
 create mode 100644 http-client-tests/tests/session-queries.http

diff --git a/http-client-tests/resources/session-requests/session_1_validation_1.json b/http-client-tests/resources/session-requests/session_1_validation_1.json
new file mode 100644
index 00000000..5e871526
--- /dev/null
+++ b/http-client-tests/resources/session-requests/session_1_validation_1.json
@@ -0,0 +1,14 @@
+{
+  "cliContext": {
+    "sv": "4.0.1",
+    "locale": "en",
+    "showTimes": true
+  },
+  "filesToValidate": [
+    {
+      "fileName": "manually_entered_file.json",
+      "fileContent": "{\n  \"resourceType\": \"Observation\",\n  \"id\": \"blood-pressure\",\n  \"meta\": {\n    \"profile\": [\n      \"http://hl7.org/fhir/StructureDefinition/vitalsigns\"\n    ]\n  },\n  \"text\": {\n    \"status\": \"generated\",\n    \"div\": \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: blood-pressure</p><p><b>meta</b>: </p><p><b>identifier</b>: urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281</p><p><b>basedOn</b>: </p><p><b>status</b>: final</p><p><b>category</b>: Vital Signs <span>(Details : {http://terminology.hl7.org/CodeSystem/observation-category code 'vital-signs' = 'Vital Signs', given as 'Vital Signs'})</span></p><p><b>code</b>: Blood pressure systolic &amp; diastolic <span>(Details : {LOINC code '85354-9' = 'Blood pressure panel with all children optional', given as 'Blood pressure panel with all children optional'})</span></p><p><b>subject</b>: <a>Patient/example</a></p><p><b>effective</b>: 17/09/2012</p><p><b>performer</b>: <a>Practitioner/example</a></p><p><b>interpretation</b>: Below low normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'L' = 'Low', given as 'low'})</span></p><p><b>bodySite</b>: Right arm <span>(Details : {SNOMED CT code '368209003' = 'Right upper arm', given as 'Right arm'})</span></p><blockquote><p><b>component</b></p><p><b>code</b>: Systolic blood pressure <span>(Details : {LOINC code '8480-6' = 'Systolic blood pressure', given as 'Systolic blood pressure'}; {SNOMED CT code '271649006' = 'Systolic blood pressure', given as 'Systolic blood pressure'}; {http://acme.org/devices/clinical-codes code 'bp-s' = 'bp-s', given as 'Systolic Blood pressure'})</span></p><p><b>value</b>: 107 mmHg<span> (Details: UCUM code mm[Hg] = 'mmHg')</span></p><p><b>interpretation</b>: Normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'N' = 'Normal', given as 'normal'})</span></p></blockquote><blockquote><p><b>component</b></p><p><b>code</b>: Diastolic blood pressure <span>(Details : {LOINC code '8462-4' = 'Diastolic blood pressure', given as 'Diastolic blood pressure'})</span></p><p><b>value</b>: 60 mmHg<span> (Details: UCUM code mm[Hg] = 'mmHg')</span></p><p><b>interpretation</b>: Below low normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'L' = 'Low', given as 'low'})</span></p></blockquote></div>\"\n  },\n  \"identifier\": [\n    {\n      \"system\": \"urn:ietf:rfc:3986\",\n      \"value\": \"urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281\"\n    }\n  ],\n  \"basedOn\": [\n    {\n      \"identifier\": {\n        \"system\": \"https://acme.org/identifiers\",\n        \"value\": \"1234\"\n      }\n    }\n  ],\n  \"status\": \"final\",\n  \"category\": [\n    {\n      \"coding\": [\n        {\n          \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n          \"code\": \"vital-signs\",\n          \"display\": \"Vital Signs\"\n        }\n      ]\n    }\n  ],\n  \"code\": {\n    \"coding\": [\n      {\n        \"system\": \"http://loinc.org\",\n        \"code\": \"85354-9\",\n        \"display\": \"Blood pressure panel with all children optional\"\n      }\n    ],\n    \"text\": \"Blood pressure systolic & diastolic\"\n  },\n  \"subject\": {\n    \"reference\": \"Patient/example\"\n  },\n  \"effectiveDateTime\": \"2012-09-17\",\n  \"performer\": [\n    {\n      \"reference\": \"Practitioner/example\"\n    }\n  ],\n  \"interpretation\": [\n    {\n      \"coding\": [\n        {\n          \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n          \"code\": \"L\",\n          \"display\": \"low\"\n        }\n      ],\n      \"text\": \"Below low normal\"\n    }\n  ],\n  \"bodySite\": {\n    \"coding\": [\n      {\n        \"system\": \"http://snomed.info/sct\",\n        \"code\": \"368209003\",\n        \"display\": \"Right arm\"\n      }\n    ]\n  },\n  \"component\": [\n    {\n      \"code\": {\n        \"coding\": [\n          {\n            \"system\": \"http://loinc.org\",\n            \"code\": \"8480-6\",\n            \"display\": \"Systolic blood pressure\"\n          },\n          {\n            \"system\": \"http://snomed.info/sct\",\n            \"code\": \"271649006\",\n            \"display\": \"Systolic blood pressure\"\n          }\n        ]\n      },\n      \"valueQuantity\": {\n        \"value\": 107,\n        \"unit\": \"mmHg\",\n        \"system\": \"http://unitsofmeasure.org\",\n        \"code\": \"mm[Hg]\"\n      },\n      \"interpretation\": [\n        {\n          \"coding\": [\n            {\n              \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n              \"code\": \"N\",\n              \"display\": \"normal\"\n            }\n          ],\n          \"text\": \"Normal\"\n        }\n      ]\n    },\n    {\n      \"code\": {\n        \"coding\": [\n          {\n            \"system\": \"http://loinc.org\",\n            \"code\": \"8462-4\",\n            \"display\": \"Diastolic blood pressure\"\n          }\n        ]\n      },\n      \"valueQuantity\": {\n        \"value\": 60,\n        \"unit\": \"mmHg\",\n        \"system\": \"http://unitsofmeasure.org\",\n        \"code\": \"mm[Hg]\"\n      },\n      \"interpretation\": [\n        {\n          \"coding\": [\n            {\n              \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n              \"code\": \"L\",\n              \"display\": \"low\"\n            }\n          ],\n          \"text\": \"Below low normal\"\n        }\n      ]\n    }\n  ]\n}",
+      "fileType": null
+    }
+  ]
+}
\ No newline at end of file
diff --git a/http-client-tests/resources/session-requests/session_1_validation_2.json b/http-client-tests/resources/session-requests/session_1_validation_2.json
new file mode 100644
index 00000000..60794f62
--- /dev/null
+++ b/http-client-tests/resources/session-requests/session_1_validation_2.json
@@ -0,0 +1,15 @@
+{
+  "cliContext": {
+    "sv": "4.0.1",
+    "locale": "en",
+    "showTimes": true
+  },
+  "filesToValidate": [
+    {
+      "fileName": "manually_entered_file.json",
+      "fileContent": "{\n  \"resourceType\": \"Observation\",\n  \"id\": \"blood-pressure\",\n  \"meta\": {\n    \"profile\": [\n      \"http://hl7.org/fhir/StructureDefinition/vitalsigns\"\n    ]\n  },\n  \"text\": {\n    \"status\": \"generated\",\n    \"div\": \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: blood-pressure</p><p><b>meta</b>: </p><p><b>identifier</b>: urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281</p><p><b>basedOn</b>: </p><p><b>status</b>: final</p><p><b>category</b>: Vital Signs <span>(Details : {http://terminology.hl7.org/CodeSystem/observation-category code 'vital-signs' = 'Vital Signs', given as 'Vital Signs'})</span></p><p><b>code</b>: Blood pressure systolic &amp; diastolic <span>(Details : {LOINC code '85354-9' = 'Blood pressure panel with all children optional', given as 'Blood pressure panel with all children optional'})</span></p><p><b>subject</b>: <a>Patient/example</a></p><p><b>effective</b>: 17/09/2012</p><p><b>performer</b>: <a>Practitioner/example</a></p><p><b>interpretation</b>: Below low normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'L' = 'Low', given as 'low'})</span></p><p><b>bodySite</b>: Right arm <span>(Details : {SNOMED CT code '368209003' = 'Right upper arm', given as 'Right arm'})</span></p><blockquote><p><b>component</b></p><p><b>code</b>: Systolic blood pressure <span>(Details : {LOINC code '8480-6' = 'Systolic blood pressure', given as 'Systolic blood pressure'}; {SNOMED CT code '271649006' = 'Systolic blood pressure', given as 'Systolic blood pressure'}; {http://acme.org/devices/clinical-codes code 'bp-s' = 'bp-s', given as 'Systolic Blood pressure'})</span></p><p><b>value</b>: 107 mmHg<span> (Details: UCUM code mm[Hg] = 'mmHg')</span></p><p><b>interpretation</b>: Normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'N' = 'Normal', given as 'normal'})</span></p></blockquote><blockquote><p><b>component</b></p><p><b>code</b>: Diastolic blood pressure <span>(Details : {LOINC code '8462-4' = 'Diastolic blood pressure', given as 'Diastolic blood pressure'})</span></p><p><b>value</b>: 60 mmHg<span> (Details: UCUM code mm[Hg] = 'mmHg')</span></p><p><b>interpretation</b>: Below low normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'L' = 'Low', given as 'low'})</span></p></blockquote></div>\"\n  },\n  \"identifier\": [\n    {\n      \"system\": \"urn:ietf:rfc:3986\",\n      \"value\": \"urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281\"\n    }\n  ],\n  \"basedOn\": [\n    {\n      \"identifier\": {\n        \"system\": \"https://acme.org/identifiers\",\n        \"value\": \"1234\"\n      }\n    }\n  ],\n  \"status\": \"final\",\n  \"category\": [\n    {\n      \"coding\": [\n        {\n          \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n          \"code\": \"vital-signs\",\n          \"display\": \"Vital Signs\"\n        }\n      ]\n    }\n  ],\n  \"code\": {\n    \"coding\": [\n      {\n        \"system\": \"http://loinc.org\",\n        \"code\": \"85354-9\",\n        \"display\": \"Blood pressure panel with all children optional\"\n      }\n    ],\n    \"text\": \"Blood pressure systolic & diastolic\"\n  },\n  \"subject\": {\n    \"reference\": \"Patient/example\"\n  },\n  \"effectiveDateTime\": \"2012-09-17\",\n  \"performer\": [\n    {\n      \"reference\": \"Practitioner/example\"\n    }\n  ],\n  \"interpretation\": [\n    {\n      \"coding\": [\n        {\n          \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n          \"code\": \"L\",\n          \"display\": \"low\"\n        }\n      ],\n      \"text\": \"Below low normal\"\n    }\n  ],\n  \"bodySite\": {\n    \"coding\": [\n      {\n        \"system\": \"http://snomed.info/sct\",\n        \"code\": \"368209003\",\n        \"display\": \"Right arm\"\n      }\n    ]\n  },\n  \"component\": [\n    {\n      \"code\": {\n        \"coding\": [\n          {\n            \"system\": \"http://loinc.org\",\n            \"code\": \"8480-6\",\n            \"display\": \"Systolic blood pressure\"\n          },\n          {\n            \"system\": \"http://snomed.info/sct\",\n            \"code\": \"271649006\",\n            \"display\": \"Systolic blood pressure\"\n          }\n        ]\n      },\n      \"valueQuantity\": {\n        \"value\": 107,\n        \"unit\": \"mmHg\",\n        \"system\": \"http://unitsofmeasure.org\",\n        \"code\": \"mm[Hg]\"\n      },\n      \"interpretation\": [\n        {\n          \"coding\": [\n            {\n              \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n              \"code\": \"N\",\n              \"display\": \"normal\"\n            }\n          ],\n          \"text\": \"Normal\"\n        }\n      ]\n    },\n    {\n      \"code\": {\n        \"coding\": [\n          {\n            \"system\": \"http://loinc.org\",\n            \"code\": \"8462-4\",\n            \"display\": \"Diastolic blood pressure\"\n          }\n        ]\n      },\n      \"valueQuantity\": {\n        \"value\": 60,\n        \"unit\": \"mmHg\",\n        \"system\": \"http://unitsofmeasure.org\",\n        \"code\": \"mm[Hg]\"\n      },\n      \"interpretation\": [\n        {\n          \"coding\": [\n            {\n              \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n              \"code\": \"L\",\n              \"display\": \"low\"\n            }\n          ],\n          \"text\": \"Below low normal\"\n        }\n      ]\n    }\n  ]\n}",
+      "fileType": null
+    }
+  ],
+  "sessionId": "{{SESSION_1_ID}}"
+}
\ No newline at end of file
diff --git a/http-client-tests/resources/session-requests/session_2_validation_1.json b/http-client-tests/resources/session-requests/session_2_validation_1.json
new file mode 100644
index 00000000..2975e94f
--- /dev/null
+++ b/http-client-tests/resources/session-requests/session_2_validation_1.json
@@ -0,0 +1,14 @@
+{
+  "cliContext": {
+    "sv": "3.0.2",
+    "locale": "en",
+    "showTimes": true
+  },
+  "filesToValidate": [
+    {
+      "fileName": "manually_entered_file.json",
+      "fileContent": "{\n  \"resourceType\": \"Observation\",\n  \"id\": \"blood-pressure\",\n  \"meta\": {\n    \"profile\": [\n      \"http://hl7.org/fhir/StructureDefinition/vitalsigns\"\n    ]\n  },\n  \"text\": {\n    \"status\": \"generated\",\n    \"div\": \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: blood-pressure</p><p><b>meta</b>: </p><p><b>identifier</b>: urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281</p><p><b>basedOn</b>: </p><p><b>status</b>: final</p><p><b>category</b>: Vital Signs <span>(Details : {http://terminology.hl7.org/CodeSystem/observation-category code 'vital-signs' = 'Vital Signs', given as 'Vital Signs'})</span></p><p><b>code</b>: Blood pressure systolic &amp; diastolic <span>(Details : {LOINC code '85354-9' = 'Blood pressure panel with all children optional', given as 'Blood pressure panel with all children optional'})</span></p><p><b>subject</b>: <a>Patient/example</a></p><p><b>effective</b>: 17/09/2012</p><p><b>performer</b>: <a>Practitioner/example</a></p><p><b>interpretation</b>: Below low normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'L' = 'Low', given as 'low'})</span></p><p><b>bodySite</b>: Right arm <span>(Details : {SNOMED CT code '368209003' = 'Right upper arm', given as 'Right arm'})</span></p><blockquote><p><b>component</b></p><p><b>code</b>: Systolic blood pressure <span>(Details : {LOINC code '8480-6' = 'Systolic blood pressure', given as 'Systolic blood pressure'}; {SNOMED CT code '271649006' = 'Systolic blood pressure', given as 'Systolic blood pressure'}; {http://acme.org/devices/clinical-codes code 'bp-s' = 'bp-s', given as 'Systolic Blood pressure'})</span></p><p><b>value</b>: 107 mmHg<span> (Details: UCUM code mm[Hg] = 'mmHg')</span></p><p><b>interpretation</b>: Normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'N' = 'Normal', given as 'normal'})</span></p></blockquote><blockquote><p><b>component</b></p><p><b>code</b>: Diastolic blood pressure <span>(Details : {LOINC code '8462-4' = 'Diastolic blood pressure', given as 'Diastolic blood pressure'})</span></p><p><b>value</b>: 60 mmHg<span> (Details: UCUM code mm[Hg] = 'mmHg')</span></p><p><b>interpretation</b>: Below low normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'L' = 'Low', given as 'low'})</span></p></blockquote></div>\"\n  },\n  \"identifier\": [\n    {\n      \"system\": \"urn:ietf:rfc:3986\",\n      \"value\": \"urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281\"\n    }\n  ],\n  \"basedOn\": [\n    {\n      \"identifier\": {\n        \"system\": \"https://acme.org/identifiers\",\n        \"value\": \"1234\"\n      }\n    }\n  ],\n  \"status\": \"final\",\n  \"category\": [\n    {\n      \"coding\": [\n        {\n          \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n          \"code\": \"vital-signs\",\n          \"display\": \"Vital Signs\"\n        }\n      ]\n    }\n  ],\n  \"code\": {\n    \"coding\": [\n      {\n        \"system\": \"http://loinc.org\",\n        \"code\": \"85354-9\",\n        \"display\": \"Blood pressure panel with all children optional\"\n      }\n    ],\n    \"text\": \"Blood pressure systolic & diastolic\"\n  },\n  \"subject\": {\n    \"reference\": \"Patient/example\"\n  },\n  \"effectiveDateTime\": \"2012-09-17\",\n  \"performer\": [\n    {\n      \"reference\": \"Practitioner/example\"\n    }\n  ],\n  \"interpretation\": [\n    {\n      \"coding\": [\n        {\n          \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n          \"code\": \"L\",\n          \"display\": \"low\"\n        }\n      ],\n      \"text\": \"Below low normal\"\n    }\n  ],\n  \"bodySite\": {\n    \"coding\": [\n      {\n        \"system\": \"http://snomed.info/sct\",\n        \"code\": \"368209003\",\n        \"display\": \"Right arm\"\n      }\n    ]\n  },\n  \"component\": [\n    {\n      \"code\": {\n        \"coding\": [\n          {\n            \"system\": \"http://loinc.org\",\n            \"code\": \"8480-6\",\n            \"display\": \"Systolic blood pressure\"\n          },\n          {\n            \"system\": \"http://snomed.info/sct\",\n            \"code\": \"271649006\",\n            \"display\": \"Systolic blood pressure\"\n          }\n        ]\n      },\n      \"valueQuantity\": {\n        \"value\": 107,\n        \"unit\": \"mmHg\",\n        \"system\": \"http://unitsofmeasure.org\",\n        \"code\": \"mm[Hg]\"\n      },\n      \"interpretation\": [\n        {\n          \"coding\": [\n            {\n              \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n              \"code\": \"N\",\n              \"display\": \"normal\"\n            }\n          ],\n          \"text\": \"Normal\"\n        }\n      ]\n    },\n    {\n      \"code\": {\n        \"coding\": [\n          {\n            \"system\": \"http://loinc.org\",\n            \"code\": \"8462-4\",\n            \"display\": \"Diastolic blood pressure\"\n          }\n        ]\n      },\n      \"valueQuantity\": {\n        \"value\": 60,\n        \"unit\": \"mmHg\",\n        \"system\": \"http://unitsofmeasure.org\",\n        \"code\": \"mm[Hg]\"\n      },\n      \"interpretation\": [\n        {\n          \"coding\": [\n            {\n              \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n              \"code\": \"L\",\n              \"display\": \"low\"\n            }\n          ],\n          \"text\": \"Below low normal\"\n        }\n      ]\n    }\n  ]\n}",
+      "fileType": null
+    }
+  ]
+}
\ No newline at end of file
diff --git a/http-client-tests/resources/session-requests/session_2_validation_2.json b/http-client-tests/resources/session-requests/session_2_validation_2.json
new file mode 100644
index 00000000..879877f4
--- /dev/null
+++ b/http-client-tests/resources/session-requests/session_2_validation_2.json
@@ -0,0 +1,15 @@
+{
+  "cliContext": {
+    "sv": "3.0.2",
+    "locale": "en",
+    "showTimes": true
+  },
+  "filesToValidate": [
+    {
+      "fileName": "manually_entered_file.json",
+      "fileContent": "{\n  \"resourceType\": \"Observation\",\n  \"id\": \"blood-pressure\",\n  \"meta\": {\n    \"profile\": [\n      \"http://hl7.org/fhir/StructureDefinition/vitalsigns\"\n    ]\n  },\n  \"text\": {\n    \"status\": \"generated\",\n    \"div\": \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: blood-pressure</p><p><b>meta</b>: </p><p><b>identifier</b>: urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281</p><p><b>basedOn</b>: </p><p><b>status</b>: final</p><p><b>category</b>: Vital Signs <span>(Details : {http://terminology.hl7.org/CodeSystem/observation-category code 'vital-signs' = 'Vital Signs', given as 'Vital Signs'})</span></p><p><b>code</b>: Blood pressure systolic &amp; diastolic <span>(Details : {LOINC code '85354-9' = 'Blood pressure panel with all children optional', given as 'Blood pressure panel with all children optional'})</span></p><p><b>subject</b>: <a>Patient/example</a></p><p><b>effective</b>: 17/09/2012</p><p><b>performer</b>: <a>Practitioner/example</a></p><p><b>interpretation</b>: Below low normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'L' = 'Low', given as 'low'})</span></p><p><b>bodySite</b>: Right arm <span>(Details : {SNOMED CT code '368209003' = 'Right upper arm', given as 'Right arm'})</span></p><blockquote><p><b>component</b></p><p><b>code</b>: Systolic blood pressure <span>(Details : {LOINC code '8480-6' = 'Systolic blood pressure', given as 'Systolic blood pressure'}; {SNOMED CT code '271649006' = 'Systolic blood pressure', given as 'Systolic blood pressure'}; {http://acme.org/devices/clinical-codes code 'bp-s' = 'bp-s', given as 'Systolic Blood pressure'})</span></p><p><b>value</b>: 107 mmHg<span> (Details: UCUM code mm[Hg] = 'mmHg')</span></p><p><b>interpretation</b>: Normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'N' = 'Normal', given as 'normal'})</span></p></blockquote><blockquote><p><b>component</b></p><p><b>code</b>: Diastolic blood pressure <span>(Details : {LOINC code '8462-4' = 'Diastolic blood pressure', given as 'Diastolic blood pressure'})</span></p><p><b>value</b>: 60 mmHg<span> (Details: UCUM code mm[Hg] = 'mmHg')</span></p><p><b>interpretation</b>: Below low normal <span>(Details : {http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation code 'L' = 'Low', given as 'low'})</span></p></blockquote></div>\"\n  },\n  \"identifier\": [\n    {\n      \"system\": \"urn:ietf:rfc:3986\",\n      \"value\": \"urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281\"\n    }\n  ],\n  \"basedOn\": [\n    {\n      \"identifier\": {\n        \"system\": \"https://acme.org/identifiers\",\n        \"value\": \"1234\"\n      }\n    }\n  ],\n  \"status\": \"final\",\n  \"category\": [\n    {\n      \"coding\": [\n        {\n          \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n          \"code\": \"vital-signs\",\n          \"display\": \"Vital Signs\"\n        }\n      ]\n    }\n  ],\n  \"code\": {\n    \"coding\": [\n      {\n        \"system\": \"http://loinc.org\",\n        \"code\": \"85354-9\",\n        \"display\": \"Blood pressure panel with all children optional\"\n      }\n    ],\n    \"text\": \"Blood pressure systolic & diastolic\"\n  },\n  \"subject\": {\n    \"reference\": \"Patient/example\"\n  },\n  \"effectiveDateTime\": \"2012-09-17\",\n  \"performer\": [\n    {\n      \"reference\": \"Practitioner/example\"\n    }\n  ],\n  \"interpretation\": [\n    {\n      \"coding\": [\n        {\n          \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n          \"code\": \"L\",\n          \"display\": \"low\"\n        }\n      ],\n      \"text\": \"Below low normal\"\n    }\n  ],\n  \"bodySite\": {\n    \"coding\": [\n      {\n        \"system\": \"http://snomed.info/sct\",\n        \"code\": \"368209003\",\n        \"display\": \"Right arm\"\n      }\n    ]\n  },\n  \"component\": [\n    {\n      \"code\": {\n        \"coding\": [\n          {\n            \"system\": \"http://loinc.org\",\n            \"code\": \"8480-6\",\n            \"display\": \"Systolic blood pressure\"\n          },\n          {\n            \"system\": \"http://snomed.info/sct\",\n            \"code\": \"271649006\",\n            \"display\": \"Systolic blood pressure\"\n          }\n        ]\n      },\n      \"valueQuantity\": {\n        \"value\": 107,\n        \"unit\": \"mmHg\",\n        \"system\": \"http://unitsofmeasure.org\",\n        \"code\": \"mm[Hg]\"\n      },\n      \"interpretation\": [\n        {\n          \"coding\": [\n            {\n              \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n              \"code\": \"N\",\n              \"display\": \"normal\"\n            }\n          ],\n          \"text\": \"Normal\"\n        }\n      ]\n    },\n    {\n      \"code\": {\n        \"coding\": [\n          {\n            \"system\": \"http://loinc.org\",\n            \"code\": \"8462-4\",\n            \"display\": \"Diastolic blood pressure\"\n          }\n        ]\n      },\n      \"valueQuantity\": {\n        \"value\": 60,\n        \"unit\": \"mmHg\",\n        \"system\": \"http://unitsofmeasure.org\",\n        \"code\": \"mm[Hg]\"\n      },\n      \"interpretation\": [\n        {\n          \"coding\": [\n            {\n              \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation\",\n              \"code\": \"L\",\n              \"display\": \"low\"\n            }\n          ],\n          \"text\": \"Below low normal\"\n        }\n      ]\n    }\n  ]\n}",
+      "fileType": null
+    }
+  ],
+  "sessionId": "{{SESSION_2_ID}}"
+}
\ No newline at end of file
diff --git a/http-client-tests/tests/session-queries.http b/http-client-tests/tests/session-queries.http
new file mode 100644
index 00000000..a4ea52da
--- /dev/null
+++ b/http-client-tests/tests/session-queries.http
@@ -0,0 +1,103 @@
+# These tests check that validation sessions are created and retrieved correctly
+
+### Initial default setting run #1
+# @name Session 1 Validation 1
+< {%
+    client.global.set("SESSION_1_VALIDATION_1_START_TIME", $timestamp);
+%}
+
+POST {{host}}/validate
+Content-Type: application/json
+
+< ../resources/session-requests/session_1_validation_1.json
+
+> {%
+    client.test("Validated Successfully", function() {
+        client.assert(response.status === 200, "Response status is not 200");
+    });
+
+    client.global.set("SESSION_1_ID", response.body.sessionId);
+    client.log("session id: " + client.global.get("SESSION_1_ID"));
+    client.global.set("SESSION_1_VALIDATION_1_RESPONSE_BODY", response.body.outcomes[0].issues.toString());
+    client.global.set("SESSION_1_VALIDATION_1_TOTAL_TIME", ($timestamp - client.global.get("SESSION_1_VALIDATION_1_START_TIME")));
+
+%}
+
+### Initial default setting run #1
+# @name Session 2 Validation 1
+< {%
+    client.global.set("SESSION_2_VALIDATION_1_START_TIME", $timestamp);
+%}
+
+POST {{host}}/validate
+Content-Type: application/json
+
+< ../resources/session-requests/session_2_validation_1.json
+
+> {%
+    client.test("Validated Successfully", function() {
+        client.assert(response.status === 200, "Response status is not 200");
+    });
+
+    client.global.set("SESSION_2_ID", response.body.sessionId);
+    client.log("session id: " + client.global.get("SESSION_2_ID"));
+    client.global.set("SESSION_2_VALIDATION_1_RESPONSE_BODY", response.body.outcomes[0].issues.toString());
+    client.global.set("SESSION_2_VALIDATION_1_TOTAL_TIME", ($timestamp - client.global.get("SESSION_2_VALIDATION_1_START_TIME")));
+
+%}
+
+### Initial default setting run #2
+# @name Session 1 Validation 2
+< {%
+    client.global.set("SESSION_1_VALIDATION_2_START_TIME", $timestamp);
+%}
+
+POST {{host}}/validate
+Content-Type: application/json
+
+< ../resources/session-requests/session_1_validation_2.json
+
+> {%
+    client.test("Validated Successfully", function() {
+        client.assert(response.status === 200, "Response status is not 200");
+    });
+    client.test("Session ID Maintained", function() {
+        client.assert(response.body.sessionId === client.global.get("SESSION_1_ID"));
+    });
+    client.test("Validation is faster", function() {
+        const DEFAULT_SESSION_2_TOTAL_TIME = ($timestamp - client.global.get("SESSION_1_VALIDATION_2_START_TIME"));
+        client.assert(client.global.get("SESSION_1_VALIDATION_2_START_TIME") > DEFAULT_SESSION_2_TOTAL_TIME);
+    });
+    client.test("Validation response is the same", function() {
+        client.assert(response.body.outcomes[0].issues.toString() === client.global.get("SESSION_1_VALIDATION_1_RESPONSE_BODY"));
+    });
+
+%}
+
+### Initial default setting run #2
+# @name Session 1 Validation 2
+< {%
+    client.global.set("SESSION_2_VALIDATION_2_START_TIME", $timestamp);
+%}
+
+POST {{host}}/validate
+Content-Type: application/json
+
+< ../resources/session-requests/session_2_validation_2.json
+
+> {%
+    client.test("Validated Successfully", function() {
+        client.assert(response.status === 200, "Response status is not 200");
+    });
+    client.test("Session ID Maintained", function() {
+        client.assert(response.body.sessionId === client.global.get("SESSION_2_ID"));
+    });
+    client.test("Validation is faster", function() {
+        const DEFAULT_SESSION_2_TOTAL_TIME = ($timestamp - client.global.get("SESSION_2_VALIDATION_2_START_TIME"));
+        client.assert(client.global.get("SESSION_2_VALIDATION_2_START_TIME") > DEFAULT_SESSION_2_TOTAL_TIME);
+    });
+    client.test("Validation response is the same", function() {
+        client.assert(response.body.outcomes[0].issues.toString() === client.global.get("SESSION_2_VALIDATION_1_RESPONSE_BODY"));
+    });
+
+%}
\ No newline at end of file
diff --git a/src/jvmMain/kotlin/controller/validation/GuavaSessionCacheAdapter.kt b/src/jvmMain/kotlin/controller/validation/GuavaSessionCacheAdapter.kt
index 6f39a117..d1f47e57 100644
--- a/src/jvmMain/kotlin/controller/validation/GuavaSessionCacheAdapter.kt
+++ b/src/jvmMain/kotlin/controller/validation/GuavaSessionCacheAdapter.kt
@@ -29,14 +29,9 @@ class GuavaSessionCacheAdapter(cacheSize : Long, cacheDuration: Long) : SessionC
     }
 
     override fun sessionExists(sessionKey: String?): Boolean {
-       // if (sessionKey == null) {return false }
         return cache.asMap().containsKey(sessionKey)
     }
 
-    override fun removeSession(s: String): ValidationEngine? {
-        return null
-    }
-
     override fun fetchSessionValidatorEngine(sessionKey: String): ValidationEngine? {
         return cache.getIfPresent(sessionKey)
     }

From a86e54441d157efa1a3007ec86eb04b5317d6227 Mon Sep 17 00:00:00 2001
From: dotasek <david.otasek@smilecdr.com>
Date: Thu, 4 Jul 2024 15:21:24 -0400
Subject: [PATCH 18/22] Update for API changes

---
 gradle.properties                                             | 2 +-
 .../kotlin/controller/validation/GuavaSessionCacheAdapter.kt  | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gradle.properties b/gradle.properties
index 3b71db8f..2196e10d 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -2,7 +2,7 @@ kotlin.code.style=official
 kotlin.js.generate.executable.default=false
 
 # versions
-fhirCoreVersion=6.3.14-SNAPSHOT
+fhirCoreVersion=6.3.15-SNAPSHOT
 
 junitVersion=5.7.1
 mockk_version=1.10.2
diff --git a/src/jvmMain/kotlin/controller/validation/GuavaSessionCacheAdapter.kt b/src/jvmMain/kotlin/controller/validation/GuavaSessionCacheAdapter.kt
index d1f47e57..cf9b9c4c 100644
--- a/src/jvmMain/kotlin/controller/validation/GuavaSessionCacheAdapter.kt
+++ b/src/jvmMain/kotlin/controller/validation/GuavaSessionCacheAdapter.kt
@@ -40,6 +40,10 @@ class GuavaSessionCacheAdapter(cacheSize : Long, cacheDuration: Long) : SessionC
         return cache.asMap().keys
     }
 
+    override fun cleanUp() {
+        cache.cleanUp()
+    }
+
     /**
      * Session ids generated internally are UUID [String].
      * @return A new [String] session id.

From 7d250d8c6d873013b4fc01d91c36c5ddda7fdfc8 Mon Sep 17 00:00:00 2001
From: dotasek <david.otasek@smilecdr.com>
Date: Tue, 16 Jul 2024 09:18:33 -0400
Subject: [PATCH 19/22] Update tests, move reload threshold to env variable,
 fix locale

---
 gradle.properties                                            | 2 +-
 http-client-tests/tests/explicit-queries.http                | 4 ++--
 http-client-tests/tests/preset-queries.http                  | 5 +++--
 src/commonMain/kotlin/constants/Preset.kt                    | 1 -
 src/commonMain/resources/static-content/polyglot/de_DE.json  | 2 +-
 src/commonMain/resources/static-content/polyglot/en.json     | 2 +-
 src/commonMain/resources/static-content/polyglot/es.json     | 2 +-
 .../kotlin/ui/components/tabs/entrytab/ManualEntryTab.kt     | 2 +-
 src/jvmMain/kotlin/Config.kt                                 | 2 +-
 src/jvmMain/kotlin/ValidatorApplicationConfig.kt             | 3 +--
 .../controller/validation/ValidationServiceFactoryImpl.kt    | 5 +++--
 src/jvmMain/resources/application.conf                       | 2 --
 12 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/gradle.properties b/gradle.properties
index 2196e10d..26dbf3c7 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -2,7 +2,7 @@ kotlin.code.style=official
 kotlin.js.generate.executable.default=false
 
 # versions
-fhirCoreVersion=6.3.15-SNAPSHOT
+fhirCoreVersion=6.3.17-SNAPSHOT
 
 junitVersion=5.7.1
 mockk_version=1.10.2
diff --git a/http-client-tests/tests/explicit-queries.http b/http-client-tests/tests/explicit-queries.http
index e01f7bb9..ffdc5bf9 100644
--- a/http-client-tests/tests/explicit-queries.http
+++ b/http-client-tests/tests/explicit-queries.http
@@ -86,7 +86,7 @@ Content-Type: application/json
     client.test("Issues are Correct", function() {
         let issues = response.body.outcomes[0].issues
         client.log("issues:" + issues.length)
-        client.assert(issues.length === 46);
+        client.assert(issues.length === 44);
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 373270004 (Substance with penicillin structure and antibacterial mechanism of action) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 108774000 (Product containing anastrozole (medicinal product)) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
 
@@ -111,7 +111,7 @@ Content-Type: application/json
     client.test("Issues are Correct", function() {
         let issues = response.body.outcomes[0].issues
         client.log("issues:" + issues.length)
-        client.assert(issues.length === 53);
+        client.assert(issues.length === 51);
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 373270004 (Substance with penicillin structure and antibacterial mechanism of action) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 108774000 (Product containing anastrozole (medicinal product)) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
         client.assert(containsIssue(issues, 314, 4, "This element does not match any known slice defined in the profile http://hl7.org.au/fhir/ips/StructureDefinition/Bundle-au-ips|0.0.1 (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL", "INFORMATION"))
diff --git a/http-client-tests/tests/preset-queries.http b/http-client-tests/tests/preset-queries.http
index 61c60aae..e2017915 100644
--- a/http-client-tests/tests/preset-queries.http
+++ b/http-client-tests/tests/preset-queries.http
@@ -1,3 +1,4 @@
+
 # These tests do validations using CliContext instances that use the presents in
 # commonMain/kotlin/constants/Preset
 
@@ -86,7 +87,7 @@ Content-Type: application/json
     client.test("Issues are Correct", function() {
         let issues = response.body.outcomes[0].issues
         client.log("issues:" + issues.length)
-        client.assert(issues.length === 46);
+        client.assert(issues.length === 44);
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 373270004 (Substance with penicillin structure and antibacterial mechanism of action) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 108774000 (Product containing anastrozole (medicinal product)) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
 
@@ -111,7 +112,7 @@ Content-Type: application/json
     client.test("Issues are Correct", function() {
         let issues = response.body.outcomes[0].issues
         client.log("issues:" + issues.length)
-        client.assert(issues.length === 53);
+        client.assert(issues.length === 51);
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 373270004 (Substance with penicillin structure and antibacterial mechanism of action) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 108774000 (Product containing anastrozole (medicinal product)) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
         client.assert(containsIssue(issues, 314, 4, "This element does not match any known slice defined in the profile http://hl7.org.au/fhir/ips/StructureDefinition/Bundle-au-ips|0.0.1 (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL", "INFORMATION"))
diff --git a/src/commonMain/kotlin/constants/Preset.kt b/src/commonMain/kotlin/constants/Preset.kt
index 20d6c26d..5341e1b0 100644
--- a/src/commonMain/kotlin/constants/Preset.kt
+++ b/src/commonMain/kotlin/constants/Preset.kt
@@ -8,7 +8,6 @@ import model.BundleValidationRule
 val DEFAULT_CONTEXT = CliContext()
     .setBaseEngine("DEFAULT")
     .setSv("4.0.1")
-    .setLocale("en")
 
 val IPS_IG = PackageInfo(
     "hl7.fhir.uv.ips",
diff --git a/src/commonMain/resources/static-content/polyglot/de_DE.json b/src/commonMain/resources/static-content/polyglot/de_DE.json
index 38ffbbd2..1321ccd0 100644
--- a/src/commonMain/resources/static-content/polyglot/de_DE.json
+++ b/src/commonMain/resources/static-content/polyglot/de_DE.json
@@ -90,7 +90,7 @@
   "preset_label" : "Common Validation Options... -German",
   "preset_description" : "Click to automatically set options for common validation tasks-German",
   "preset_notification" : "Set to validate using %{selectedPreset}. Select the Options tab for more settings. -German",
-  "preset_fhir_resource" : "FHIR Resource -German",
+  "preset_fhir_resource" : "FHIR Resource (R4) -German",
   "preset_ips" : "IPS Document -German",
   "preset_ips_au" : "Australian IPS Document -German",
   "preset_ips_nz" : "New Zealand IPS Document -German",
diff --git a/src/commonMain/resources/static-content/polyglot/en.json b/src/commonMain/resources/static-content/polyglot/en.json
index b32d6a84..3f49955d 100644
--- a/src/commonMain/resources/static-content/polyglot/en.json
+++ b/src/commonMain/resources/static-content/polyglot/en.json
@@ -92,7 +92,7 @@
   "preset_label" : "Common Validation Options...",
   "preset_description" : "Click to automatically set options for common validation tasks",
   "preset_notification" : "Set to validate using %{selectedPreset}. Select the Options tab for more settings.",
-  "preset_fhir_resource" : "FHIR Resource",
+  "preset_fhir_resource" : "FHIR Resource (R4)",
   "preset_ips" : "IPS Document",
   "preset_ips_au" : "Australian IPS Document",
   "preset_ips_nz" : "New Zealand IPS Document",
diff --git a/src/commonMain/resources/static-content/polyglot/es.json b/src/commonMain/resources/static-content/polyglot/es.json
index 4c55a597..5b01747e 100644
--- a/src/commonMain/resources/static-content/polyglot/es.json
+++ b/src/commonMain/resources/static-content/polyglot/es.json
@@ -90,7 +90,7 @@
     "preset_label" : "Common Validation Options... -Spanish",
     "preset_description" : "Click to automatically set options for common validation tasks-Spanish",
     "preset_notification" : "Set to validate using %{selectedPreset}. Select the Options tab for more settings. -Spanish",
-    "preset_fhir_resource" : "FHIR Resource -Spanish",
+    "preset_fhir_resource" : "FHIR Resource (R4) -Spanish",
     "preset_ips" : "IPS Document -Spanish",
     "preset_ips_au" : "Australian IPS Document -Spanish",
     "preset_ips_nz" : "New Zealand IPS Document -Spanish",
diff --git a/src/jsMain/kotlin/ui/components/tabs/entrytab/ManualEntryTab.kt b/src/jsMain/kotlin/ui/components/tabs/entrytab/ManualEntryTab.kt
index 76a51a87..7eff3ddb 100644
--- a/src/jsMain/kotlin/ui/components/tabs/entrytab/ManualEntryTab.kt
+++ b/src/jsMain/kotlin/ui/components/tabs/entrytab/ManualEntryTab.kt
@@ -165,7 +165,7 @@ class ManualEntryTab : RComponent<ManualEntryTabProps, ManualEntryTabState>() {
             props.toggleValidationInProgress(true)
             println("clicontext :: sv == ${cliContext.getSv()}, version == ${props.cliContext.getTargetVer()}, languageCode == ${props.cliContext.getLanguageCode()}")
             val request = assembleRequest(
-                cliContext = cliContext,
+                cliContext = CliContext(cliContext).setLocale(props.cliContext.getLanguageCode()),
                 fileName = generateFileName(fileContent),
                 fileContent = fileContent,
                 fileType = null
diff --git a/src/jvmMain/kotlin/Config.kt b/src/jvmMain/kotlin/Config.kt
index 0de8b955..070c1282 100644
--- a/src/jvmMain/kotlin/Config.kt
+++ b/src/jvmMain/kotlin/Config.kt
@@ -1 +1 @@
-data class Config(val host: String, val port: Int, val engineReloadThreshold : Int)
+data class Config(val host: String, val port: Int)
diff --git a/src/jvmMain/kotlin/ValidatorApplicationConfig.kt b/src/jvmMain/kotlin/ValidatorApplicationConfig.kt
index 5bcba59b..959991c9 100644
--- a/src/jvmMain/kotlin/ValidatorApplicationConfig.kt
+++ b/src/jvmMain/kotlin/ValidatorApplicationConfig.kt
@@ -24,8 +24,7 @@ class ValidatorApplicationConfig {
             val hoconEnvironment = hoconConfig.config("ktor.deployment.$environment")
             return Config(
                 hoconEnvironment.property("host").getString(),
-                Integer.parseInt(hoconEnvironment.property("port").getString()),
-                Integer.parseInt(hoconEnvironment.property("engineReloadThreshold").getString())
+                Integer.parseInt(hoconEnvironment.property("port").getString())
                 )
         }
         }
diff --git a/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt b/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt
index 6c7dd0b3..ac342950 100644
--- a/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt
+++ b/src/jvmMain/kotlin/controller/validation/ValidationServiceFactoryImpl.kt
@@ -48,8 +48,9 @@ class ValidationServiceFactoryImpl : ValidationServiceFactory {
     }
    
     override fun getValidationService() : ValidationService {
-        if (java.lang.Runtime.getRuntime().freeMemory() < ValidatorApplicationConfig.config.engineReloadThreshold) {
-            println("Free memory ${java.lang.Runtime.getRuntime().freeMemory()} is less than ${ValidatorApplicationConfig.config.engineReloadThreshold}. Re-initializing validationService");
+        val engineReloadThreshold = (System.getenv("ENGINE_RELOAD_THRESHOLD") ?: "250000000").toLong()
+        if (java.lang.Runtime.getRuntime().freeMemory() < engineReloadThreshold) {
+            println("Free memory ${java.lang.Runtime.getRuntime().freeMemory()} is less than ${engineReloadThreshold}. Re-initializing validationService");
             validationService = createValidationServiceInstance();
         }
         return validationService;
diff --git a/src/jvmMain/resources/application.conf b/src/jvmMain/resources/application.conf
index d9233db3..b5af434d 100644
--- a/src/jvmMain/resources/application.conf
+++ b/src/jvmMain/resources/application.conf
@@ -3,12 +3,10 @@ ktor {
         dev {
             host = "0.0.0.0"
             port = 8082
-            engineReloadThreshold = 0
         }
         prod {
             host = "0.0.0.0"
             port = 3500
-            engineReloadThreshold = 25000000
         }
     }
     application {

From 027dd1e98b14be3b6db4c82ec33ce97ee0545ca5 Mon Sep 17 00:00:00 2001
From: dotasek <david.otasek@smilecdr.com>
Date: Mon, 12 Aug 2024 10:45:59 -0400
Subject: [PATCH 20/22] Bump core version, adjust issue counts for smoke tests

---
 gradle.properties                             | 2 +-
 http-client-tests/tests/explicit-queries.http | 6 +++---
 http-client-tests/tests/preset-queries.http   | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gradle.properties b/gradle.properties
index 0ad33707..de9372aa 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -2,7 +2,7 @@ kotlin.code.style=official
 kotlin.js.generate.executable.default=false
 
 # versions
-fhirCoreVersion=6.3.18-SNAPSHOT
+fhirCoreVersion= 6.3.20-SNAPSHOT
 
 junitVersion=5.7.1
 mockk_version=1.10.2
diff --git a/http-client-tests/tests/explicit-queries.http b/http-client-tests/tests/explicit-queries.http
index ffdc5bf9..993c64d8 100644
--- a/http-client-tests/tests/explicit-queries.http
+++ b/http-client-tests/tests/explicit-queries.http
@@ -86,7 +86,7 @@ Content-Type: application/json
     client.test("Issues are Correct", function() {
         let issues = response.body.outcomes[0].issues
         client.log("issues:" + issues.length)
-        client.assert(issues.length === 44);
+        client.assert(issues.length === 45);
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 373270004 (Substance with penicillin structure and antibacterial mechanism of action) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 108774000 (Product containing anastrozole (medicinal product)) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
 
@@ -111,7 +111,7 @@ Content-Type: application/json
     client.test("Issues are Correct", function() {
         let issues = response.body.outcomes[0].issues
         client.log("issues:" + issues.length)
-        client.assert(issues.length === 51);
+        client.assert(issues.length === 53);
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 373270004 (Substance with penicillin structure and antibacterial mechanism of action) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 108774000 (Product containing anastrozole (medicinal product)) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
         client.assert(containsIssue(issues, 314, 4, "This element does not match any known slice defined in the profile http://hl7.org.au/fhir/ips/StructureDefinition/Bundle-au-ips|0.0.1 (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL", "INFORMATION"))
@@ -134,7 +134,7 @@ Content-Type: application/json
     client.test("Issues are Correct", function() {
         let issues = response.body.outcomes[0].issues
         client.log("issues:" + issues.length)
-        client.assert(issues.length === 102);
+        client.assert(issues.length === 100);
         client.assert(containsIssue(issues, 12,10,"This element does not match any known slice defined in the profile https://standards.digital.health.nz/fhir/StructureDefinition/nzps-bundle|0.3.0 (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL", "INFORMATION"))
     });
 %}
diff --git a/http-client-tests/tests/preset-queries.http b/http-client-tests/tests/preset-queries.http
index e2017915..a4502128 100644
--- a/http-client-tests/tests/preset-queries.http
+++ b/http-client-tests/tests/preset-queries.http
@@ -87,7 +87,7 @@ Content-Type: application/json
     client.test("Issues are Correct", function() {
         let issues = response.body.outcomes[0].issues
         client.log("issues:" + issues.length)
-        client.assert(issues.length === 44);
+        client.assert(issues.length === 45);
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 373270004 (Substance with penicillin structure and antibacterial mechanism of action) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 108774000 (Product containing anastrozole (medicinal product)) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
 
@@ -112,7 +112,7 @@ Content-Type: application/json
     client.test("Issues are Correct", function() {
         let issues = response.body.outcomes[0].issues
         client.log("issues:" + issues.length)
-        client.assert(issues.length === 51);
+        client.assert(issues.length === 53);
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 373270004 (Substance with penicillin structure and antibacterial mechanism of action) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
         client.assert(containsIssue(issues, 1, 2, "The Snomed CT code 108774000 (Product containing anastrozole (medicinal product)) is not a member of the IPS free set", "BUSINESSRULE", "INFORMATION"))
         client.assert(containsIssue(issues, 314, 4, "This element does not match any known slice defined in the profile http://hl7.org.au/fhir/ips/StructureDefinition/Bundle-au-ips|0.0.1 (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL", "INFORMATION"))
@@ -135,7 +135,7 @@ Content-Type: application/json
     client.test("Issues are Correct", function() {
         let issues = response.body.outcomes[0].issues
         client.log("issues:" + issues.length)
-        client.assert(issues.length === 102);
+        client.assert(issues.length === 100);
         client.assert(containsIssue(issues, 12,10,"This element does not match any known slice defined in the profile https://standards.digital.health.nz/fhir/StructureDefinition/nzps-bundle|0.3.0 (this may not be a problem, but you should check that it's not intended to match a slice)", "INFORMATIONAL", "INFORMATION"))
     });
 %}

From 2e680c153f36aa166b2d5af4111b5d17966f48a6 Mon Sep 17 00:00:00 2001
From: dotasek <david.otasek@smilecdr.com>
Date: Tue, 13 Aug 2024 14:41:22 -0400
Subject: [PATCH 21/22] Prep for release

---
 RELEASE_NOTES.md  | 3 +++
 gradle.properties | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index e69de29b..260758d9 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -0,0 +1,3 @@
+* Large rework of preset system to include pre-cached validation engines
+* Expand version endpoint to include core version
+* Updated core version including fixes related to locale terminology validation
diff --git a/gradle.properties b/gradle.properties
index de9372aa..b531540f 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -2,7 +2,7 @@ kotlin.code.style=official
 kotlin.js.generate.executable.default=false
 
 # versions
-fhirCoreVersion= 6.3.20-SNAPSHOT
+fhirCoreVersion= 6.3.20
 
 junitVersion=5.7.1
 mockk_version=1.10.2

From 65c78cd277d1f5551042d4fca144d1fb97003dd3 Mon Sep 17 00:00:00 2001
From: dotasek <david.otasek@smilecdr.com>
Date: Tue, 13 Aug 2024 15:16:45 -0400
Subject: [PATCH 22/22] Clean up

---
 build.gradle.kts  | 3 ---
 gradle.properties | 1 -
 2 files changed, 4 deletions(-)

diff --git a/build.gradle.kts b/build.gradle.kts
index 354b8e68..3650a55f 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -127,8 +127,6 @@ kotlin {
                 implementation("ch.qos.logback:logback-classic:${property("logbackVersion")}")
                 implementation("org.litote.kmongo:kmongo-coroutine-serialization:${property("kmongoVersion")}")
                 implementation("no.tornado:tornadofx:${property("tornadoFXVersion")}")
-
-              //  implementation("com.google.guava:guava:10.0.1")
             }
 
         }
@@ -281,5 +279,4 @@ tasks.create("stage") {
 
 tasks.getByName<JavaExec>("run") {
     classpath(tasks.getByName<Jar>("jvmJar")) // so that the JS artifacts generated by `jvmJar` can be found and served
-    jvmArgs("-Xmx8G")
 }
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index b531540f..2eed6f81 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -39,4 +39,3 @@ koinVersion=3.2.1
 logbackVersion=1.5.3
 kmongoVersion=4.5.0
 
-org.gradle.jvmargs=-Xmx8G