Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profile Snapshot not being generated #4018

Open
EniacMlezi opened this issue Aug 13, 2024 · 3 comments
Open

Profile Snapshot not being generated #4018

EniacMlezi opened this issue Aug 13, 2024 · 3 comments
Labels
Bug Bug bug bug. VSTS-Planned Planned for an upcoming sprint

Comments

@EniacMlezi
Copy link

Describe the bug
During validation of a Resource on Create (ProfileValidationOnCreate = true), I get the following error:
Internal logic failure: StructureDefinition 'http://nictiz.nl/fhir/StructureDefinition/ext-SOAPReport.SOAPLineCode' has no snapshot component. (Parameter 'sd')

Which is true, but shouldn't profile snapshots be generated?

These are the profiles I'm trying to use:
SoapLine:

{
  "resourceType": "StructureDefinition",
  "id": "nl-core-SOAPReport.SOAPLine",
  "text": {
    "status": "empty",
    "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">No narrative is provided for definitional resources. A human-readable rendering can be found in the implementation guide(s) where this resource is used.</div>"
  },
  "url": "http://nictiz.nl/fhir/StructureDefinition/nl-core-SOAPReport.SOAPLine",
  "name": "NlcoreSOAPReportSOAPLine",
  "title": "nl core SOAPReport.SOAPLine",
  "status": "draft",
  "publisher": "Nictiz",
  "contact": [
    {
      "name": "Nictiz",
      "telecom": [
        {
          "system": "url",
          "value": "https://www.nictiz.nl",
          "use": "work"
        }
      ]
    }
  ],
  "description": "A SOAP report is a textual report of a (partial) consult with relation to a single problem according to the SOAP structure. SOAP (acronym for subjective, objective, assessment, plan) is a method used by health professionals to structurally record information that comes up during contact between the patient and a health professionals in the patient's record. The following standardized format is used for reporting:\r\n\r\n* Subjective: the patient's complaint and request for help and the amnesic data\r\n* Objective: the findings from the physical and supplementary examination.\r\n* Assessment: the working hypothesis and the thinking process, for example a differential diagnosis of the healthcare professional.\r\n* Plan: the diagnostic plan or treatment plan and what has been discussed or agreed with the patient.\r\n\r\nThe SOAP report is mainly used in general practice care.\r\n\r\nNote: the zib doesn't state explicitly if zib SOAPReport pertains a consult or a partial consult, but it has become clear that the zib, and thus this profile, should be interpreted as a partial consult with relation to a single problem (see <https://bits.nictiz.nl/browse/ZIB-1474>). The text above has been adjusted according to this insight.",
  "purpose": "A derived profile from [zib-SOAPReport.SOAPLine](http://nictiz.nl/fhir/StructureDefinition/zib-SOAPReport.SOAPLine) to provide a version better suited for implementation purposes. This profile augments the base profile with elements found in the various use cases that have adopted the zib.",
  "copyright": "Copyright and related rights waived via CC0, https://creativecommons.org/publicdomain/zero/1.0/. This does not apply to information from third parties, for example a medical terminology system. The implementer alone is responsible for identifying and obtaining any necessary licenses or authorizations to utilize third party IP in connection with the specification or otherwise.",
  "fhirVersion": "4.0.1",
  "mapping": [
    {
      "identity": "zib-soapreport-v1.0-2020EN",
      "uri": "https://zibs.nl/wiki/SOAPReport-v1.0(2020EN)",
      "name": "zib SOAPReport-v1.0(2020EN)"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "Observation",
  "baseDefinition": "http://nictiz.nl/fhir/StructureDefinition/zib-SOAPReport.SOAPLine",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Observation",
        "path": "Observation",
        "comment": "Zib SOAPReport is implemented using two profiles: this profile implements the SOAPLine concept of the zib, while <http://nictiz.nl/fhir/StructureDefinition/nl-core-SOAPReport> represents the SOAPReport concept of the zib.",
        "alias": [
          "nl-core-SOAPReport.SOAPLine"
        ]
      },
      {
        "id": "Observation.subject",
        "path": "Observation.subject",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Patient",
              "http://hl7.org/fhir/StructureDefinition/Group",
              "http://hl7.org/fhir/StructureDefinition/Device",
              "http://hl7.org/fhir/StructureDefinition/Location",
              "http://nictiz.nl/fhir/StructureDefinition/nl-core-Patient"
            ]
          }
        ]
      }
    ]
  }
}

ZIB SoapLine:

{
  "resourceType": "StructureDefinition",
  "id": "zib-SOAPReport.SOAPLine",
  "text": {
    "status": "empty",
    "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">No narrative is provided for definitional resources. A human-readable rendering can be found in the implementation guide(s) where this resource is used.</div>"
  },
  "url": "http://nictiz.nl/fhir/StructureDefinition/zib-SOAPReport.SOAPLine",
  "name": "ZibSOAPReportSOAPLine",
  "title": "zib SOAPReport.SOAPLine",
  "status": "draft",
  "publisher": "Nictiz",
  "contact": [
    {
      "name": "Nictiz",
      "telecom": [
        {
          "system": "url",
          "value": "https://www.nictiz.nl",
          "use": "work"
        }
      ]
    }
  ],
  "description": "A SOAP report is a textual report of a (partial) consult with relation to a single problem according to the SOAP structure. SOAP (acronym for subjective, objective, assessment, plan) is a method used by health professionals to structurally record information that comes up during contact between the patient and a health professionals in the patient's record. The following standardized format is used for reporting:\r\n\r\n* Subjective: the patient's complaint and request for help and the amnesic data\r\n* Objective: the findings from the physical and supplementary examination.\r\n* Assessment: the working hypothesis and the thinking process, for example a differential diagnosis of the healthcare professional.\r\n* Plan: the diagnostic plan or treatment plan and what has been discussed or agreed with the patient.\r\n\r\nThe SOAP report is mainly used in general practice care.\r\n\r\nNote: the zib doesn't state explicitly if zib SOAPReport pertains a consult or a partial consult, but it has become clear that the zib, and thus this profile, should be interpreted as a partial consult with relation to a single problem (see <https://bits.nictiz.nl/browse/ZIB-1474>). The text above has been adjusted according to this insight.",
  "purpose": "This Observation resource represents the SOAPLine concept of the Dutch [zib ('Zorginformatiebouwsteen', i.e. Health and Care Information Model) SOAPReport v1.0 (2020)](https://zibs.nl/wiki/SOAPReport-v1.0(2020EN)).",
  "copyright": "Copyright and related rights waived via CC0, https://creativecommons.org/publicdomain/zero/1.0/. This does not apply to information from third parties, for example a medical terminology system. The implementer alone is responsible for identifying and obtaining any necessary licenses or authorizations to utilize third party IP in connection with the specification or otherwise.",
  "fhirVersion": "4.0.1",
  "mapping": [
    {
      "identity": "zib-soapreport-v1.0-2020EN",
      "uri": "https://zibs.nl/wiki/SOAPReport-v1.0(2020EN)",
      "name": "zib SOAPReport-v1.0(2020EN)"
    }
  ],
  "kind": "resource",
  "abstract": true,
  "type": "Observation",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Observation",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Observation",
        "path": "Observation",
        "short": "SOAPLine",
        "comment": "Zib SOAPReport is implemented using two profiles: this profile implements the SOAPLine concept of the zib, while <http://nictiz.nl/fhir/StructureDefinition/zib-SOAPReport> represents the SOAPReport concept of the zib.",
        "alias": [
          "SOEPRegel"
        ],
        "constraint": [
          {
            "key": "zib-SOAPReport-1",
            "severity": "error",
            "human": "In a SOAP report an ICPC code may be assigned, but only to the S and A line.",
            "expression": "extension('http://nictiz.nl/fhir/StructureDefinition/ext-SOAPReport.SOAPLineCode').exists() implies (code.coding.where(code = '255362007' and system = 'http://snomed.info/sct').exists() or code.coding.where(code = '129265001' and system = 'http://snomed.info/sct').exists())"
          }
        ],
        "mapping": [
          {
            "identity": "zib-soapreport-v1.0-2020EN",
            "map": "NL-CM:13.6.4",
            "comment": "SOAPLine"
          }
        ]
      },
      {
        "id": "Observation.extension:soapLineCode",
        "path": "Observation.extension",
        "sliceName": "soapLineCode",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://nictiz.nl/fhir/StructureDefinition/ext-SOAPReport.SOAPLineCode"
            ]
          }
        ],
        "condition": [
          "zib-SOAPReport-1"
        ]
      },
      {
        "id": "Observation.extension:soapLineCode.value[x]",
        "path": "Observation.extension.value[x]",
        "condition": [
          "zib-SOAPReport-1"
        ]
      },
      {
        "id": "Observation.status",
        "path": "Observation.status",
        "comment": "Unless explicitly recorded, a value of _final_ would be expected."
      },
      {
        "id": "Observation.code",
        "path": "Observation.code",
        "short": "SOAPLineHeader",
        "definition": "The name of the SOAP line as a coded description. In a SOAP report this can be one of the following: subjective, objective, assessment or plan.",
        "alias": [
          "SOEPRegelNaam"
        ],
        "condition": [
          "zib-SOAPReport-1"
        ],
        "binding": {
          "strength": "required",
          "valueSet": "http://decor.nictiz.nl/fhir/ValueSet/2.16.840.1.113883.2.4.3.11.60.40.2.13.6.2--20200901000000"
        },
        "mapping": [
          {
            "identity": "zib-soapreport-v1.0-2020EN",
            "map": "NL-CM:13.6.6",
            "comment": "SOAPLineHeader"
          }
        ]
      },
      {
        "id": "Observation.code.coding",
        "path": "Observation.code.coding",
        "condition": [
          "zib-SOAPReport-1"
        ]
      },
      {
        "id": "Observation.value[x]",
        "path": "Observation.value[x]",
        "slicing": {
          "discriminator": [
            {
              "type": "type",
              "path": "$this"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Observation.value[x]:valueString",
        "path": "Observation.value[x]",
        "sliceName": "valueString",
        "short": "SOAPLineText",
        "definition": "The actual content of the section as free formatted text.",
        "alias": [
          "SOEPRegelTekst"
        ],
        "type": [
          {
            "code": "string"
          }
        ],
        "mapping": [
          {
            "identity": "zib-soapreport-v1.0-2020EN",
            "map": "NL-CM:13.6.7",
            "comment": "SOAPLineText"
          }
        ]
      }
    ]
  }
}

SoapLineCode Extension:

{
  "resourceType": "StructureDefinition",
  "id": "ext-SOAPReport.SOAPLineCode",
  "text": {
    "status": "empty",
    "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">No narrative is provided for definitional resources. A human-readable rendering can be found in the implementation guide(s) where this resource is used.</div>"
  },
  "url": "http://nictiz.nl/fhir/StructureDefinition/ext-SOAPReport.SOAPLineCode",
  "name": "ExtSOAPReportSOAPLineCode",
  "title": "ext SOAPReport.SOAPLineCode",
  "status": "draft",
  "publisher": "Nictiz",
  "contact": [
    {
      "name": "Nictiz",
      "telecom": [
        {
          "system": "url",
          "value": "https://www.nictiz.nl",
          "use": "work"
        }
      ]
    }
  ],
  "description": "An extension to provide the SOAPLine code. The extension can be seen as an addition to the SOAPLineHeader and SOAPLineText concept mapped to the code and text element.",
  "purpose": "This extension represents the SOAPLineCode concept of the Dutch [zib ('Zorginformatiebouwsteen', i.e. Health and Care Information Model) SOAPReport v1.0 (2020)](https://zibs.nl/wiki/SOAPReport-v1.0(2020EN)).",
  "copyright": "Copyright and related rights waived via CC0, https://creativecommons.org/publicdomain/zero/1.0/. This does not apply to information from third parties, for example a medical terminology system. The implementer alone is responsible for identifying and obtaining any necessary licenses or authorizations to utilize third party IP in connection with the specification or otherwise.",
  "fhirVersion": "4.0.1",
  "mapping": [
    {
      "identity": "zib-soapreport-v1.0-2020EN",
      "uri": "https://zibs.nl/wiki/SOAPReport-v1.0(2020EN)",
      "name": "zib SOAPReport-v1.0(2020EN)"
    }
  ],
  "kind": "complex-type",
  "abstract": false,
  "context": [
    {
      "type": "element",
      "expression": "Observation"
    }
  ],
  "type": "Extension",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Extension",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Extension",
        "path": "Extension",
        "max": "1"
      },
      {
        "id": "Extension.url",
        "path": "Extension.url",
        "fixedUri": "http://nictiz.nl/fhir/StructureDefinition/ext-SOAPReport.SOAPLineCode"
      },
      {
        "id": "Extension.value[x]",
        "path": "Extension.value[x]",
        "short": "SOAPLineCode",
        "definition": "Coded values can be added to a line that describe essential aspects of the line.\r\nIn a SOAP report an ICPC code may be assigned, but only to the S and A line.",
        "alias": [
          "SOEPRegelCode"
        ],
        "type": [
          {
            "code": "CodeableConcept"
          }
        ],
        "binding": {
          "strength": "required",
          "valueSet": "http://decor.nictiz.nl/fhir/ValueSet/2.16.840.1.113883.2.4.3.11.60.40.2.13.6.1--20200901000000"
        },
        "mapping": [
          {
            "identity": "zib-soapreport-v1.0-2020EN",
            "map": "NL-CM:13.6.5",
            "comment": "SOAPLineCode"
          }
        ]
      },
      {
        "id": "Extension.value[x].coding",
        "path": "Extension.value[x].coding",
        "binding": {
          "strength": "required",
          "valueSet": "http://decor.nictiz.nl/fhir/ValueSet/2.16.840.1.113883.2.4.3.11.60.40.2.13.6.1--20200901000000"
        }
      }
    ]
  }
}

FHIR Version?
R4

Data provider?
SQL Server

To Reproduce
Steps to reproduce the behavior:

  1. Set ProfileValidationOnCreate = true
  2. POST the above profiles
  3. POST A SoapLine, like:
{
    "id": "00db645f-557c-490a-9a48-46377b6a2cde",
    "resourceType": "Observation",
    "meta": {
        "profile": [
        "http://nictiz.nl/fhir/StructureDefinition/nl-core-SOAPReport.SOAPLine"
        ]
    },
    "extension": [
        {
            "url": "http://nictiz.nl/fhir/StructureDefinition/ext-SOAPReport.SOAPLineCode",
            "valueCodeableConcept": {
                "coding": { "system":"http://hl7.org/fhir/sid/icpc-1-nl", "code": "T90", "display": "Diabetes mellitus" }
            }
        }
    ],
    "status": "final",
    "encounter": {
        "type": "Encounter",
        "reference": "Encounter/34833a30-44f9-42f6-9eb3-2786ddf0cee5"
    },
    "valueString": "test",
    "code": {
        "coding": [
        {
            "system": "http://snomed.info/sct",
            "code": "260224007",
            "display": "Objective"
        }
        ]
    }
}

Expected behavior
201 Created result.

Actual behavior
400 Bad Request:

"issue": [
        {
            "severity": "fatal",
            "code": "exception",
            "details": {
                "coding": [
                    {
                        "system": "http://hl7.org/fhir/dotnet-api-operation-outcome",
                        "code": "5003"
                    }
                ],
                "text": "Internal logic failure: StructureDefinition 'http://nictiz.nl/fhir/StructureDefinition/ext-SOAPReport.SOAPLineCode' has no snapshot component. (Parameter 'sd')"
            },
            "location": [
                "Observation // OperationOutcome.Location is deprecated, please use OperationOutcome.Expression"
            ],
            "expression": [
                "Observation"
            ]
        }
    ]
@EniacMlezi EniacMlezi added the Bug Bug bug bug. label Aug 13, 2024
@EniacMlezi
Copy link
Author

Looks like this could be a possible fix:
FirelyTeam/firely-net-sdk#1786

@EniacMlezi
Copy link
Author

Just tested it out, seems to be working with this patch:

diff --git a/src/Microsoft.Health.Fhir.Shared.Core/Features/Validation/ProfileValidator.cs b/src/Microsoft.Health.Fhir.Shared.Core/Features/Validation/ProfileValidator.cs
index 9ed39c7be..ccf7e573b 100644
--- a/src/Microsoft.Health.Fhir.Shared.Core/Features/Validation/ProfileValidator.cs
+++ b/src/Microsoft.Health.Fhir.Shared.Core/Features/Validation/ProfileValidator.cs
@@ -27,7 +27,7 @@ namespace Microsoft.Health.Fhir.Core.Features.Validation
 
             try
             {
-                _resolver = new MultiResolver(new CachedResolver(ZipSource.CreateValidationSource(), options.Value.CacheDurationInSeconds), profilesResolver);
+                _resolver = new SnapshotSource(new MultiResolver(new CachedResolver(ZipSource.CreateValidationSource(), options.Value.CacheDurationInSeconds), profilesResolver));
             }
             catch (Exception)
             {
@@ -41,7 +41,7 @@ namespace Microsoft.Health.Fhir.Core.Features.Validation
             var ctx = new ValidationSettings()
             {
                 ResourceResolver = _resolver,
-                GenerateSnapshot = true,
+                GenerateSnapshot = false,
                 Trace = false,
                 ResolveExternalReferences = false,
             };

@EXPEkesheth
Copy link
Collaborator

Thanks for suggesting the change, we will review the PR and revert back
#AB125854

@EXPEkesheth EXPEkesheth added the VSTS-Planned Planned for an upcoming sprint label Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug bug bug. VSTS-Planned Planned for an upcoming sprint
Projects
None yet
Development

No branches or pull requests

2 participants