trifork / klg-docs

Public documentation for Gateway
0 stars 8 forks source link

Model Issues: This property must be an Array, not an Object #17

Closed LindaLawton closed 2 years ago

LindaLawton commented 2 years ago

I have a large number of unit tests which I use to test my mapping of objects. They are all failing. These tests all worked against the previous post endpoint since June 2021.

All the reports that we have been testing with over the last five months we are talking about thousands of reports that previously were sent to the gateway with no issues. are now also failing.

Lets have a look at a report. Again this bundle was previously sent with no issues to the Post Endpoint we have been using since June 2021 to test.

bundle.json

The first thing to note in the large number of errors returned. But lets just look at this one since it seams to be a treading theme across the errors. This property must be an Array, not an Object

     {
            "severity": "error",
            "code": "processing",
            "diagnostics": "This property must be an Array, not an Object",
            "location": [
                "Bundle.entry[0].resource.category",
                "Line 32, Col 22"
            ]
        },

Line 32 is coding

     "category": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/condition-category",
              "code": "problem-list-item"
            }
          ]
        },

Theses tests all use the documented model found here KLGateway as well as the samples found here Downloads

If we look at the file entitled Condition-ProblemerMedPersonligPleje.json

You will notice that it looks exactly the same.

 "category": {
    "coding": [
      {
         "system": "http://terminology.hl7.org/CodeSystem/condition-category",
          "code": "problem-list-item"
      }
    ]
  },

This makes me wonder why I am getting a This property must be an Array, not an Object message.

I decided to try and see what would happen if I changed it from an object to an array and see what happens.

     "category": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/condition-category",
              "code": "problem-list-item"
            }
          ]        ,

This results in two errors

  {
            "severity": "error",
            "code": "processing",
            "diagnostics": "Unrecognised property '@system'",
            "location": [
                "Bundle.entry[0].resource.category[0]",
                "Line 33, Col 84"
            ]
        },
        {
            "severity": "error",
            "code": "processing",
            "diagnostics": "Unrecognised property '@code'",
            "location": [
                "Bundle.entry[0].resource.category[0]",
                "Line 35, Col 14"
            ]
        },

So not only is category no longer an object and it is now an array but system and code are not valid for category.

update

Still trying to debug this If we check the Care Gateway page which was given to use a few weeks ago you will notice that.

 "category": {
    "coding": [
      {
         "system": "http://terminology.hl7.org/CodeSystem/condition-category",
          "code": "problem-list-item"
      }
    ]
  },

Appears to be gone.

If we check Resource Profile: CareCondition it appears to still be required

image

LindaLawton commented 2 years ago

I found another change. This is the old identifier for the Patient. value is the patients CPR number.

 "identifier": {
          "use": "official",
          "system": "urn:oid:1.2.208.176.1.2",
          "value": "0101010101"
        },

The documentation for that model can be found here Resource Profile: CareCitizen

image

changed

It would appear by looking at Care Gateway

that this fields is now an array

   "identifier" : [
          {
            "use" : "official",
            "system" : "urn:oid:1.2.208.176.1.2",
            "value" : "0101570001"
          }
        ],

Why would a bundle have an array of patents??

LindaLawton commented 2 years ago

Another change. Category appears to be an array on goal now.

jkiddo commented 2 years ago

Questions towards why changes to the IG has occured in the past I cannot answer.

LindaLawton commented 2 years ago

I don't think I asked Why things where changed more What things where changed.

@jkiddo this is not in the past these requests worked in January. They do not work now with the new endpoint. There for this is not the past.

These are breaking changes can you tell us what you have changed from the old POST endpoint to the new PUT endpoint.

Will the documentation be updated to reflect these changes? As i have shown its hard to understand what we should be sending.

jkiddo commented 2 years ago

We haven't changed anything in the IG's. The only think, interface-wise we have changed is supporting PUT instead of POST.

jkiddo commented 2 years ago

think=thing

jkiddo commented 2 years ago

Throwing the official validator at your bundle yields the following:

java -jar ../Downloads/validator_cli.jar kmd.json -ig https://build.fhir.org/ig/hl7dk/kl-gateway/package.tgz
FHIR Validation tool Version 5.6.36 (Git# 17bf21ecf852). Built 2022-02-26T05:01:10.796Z (54 hours old)
  Java:   16.0.1 from /Library/Java/JavaVirtualMachines/adoptopenjdk-16.jdk/Contents/Home on x86_64 (64bit). 4096MB available
  Paths:  Current = /Users/jvi/Documents, Package Cache = /Users/jvi/.fhir/packages
  Params: kmd.json -ig https://build.fhir.org/ig/hl7dk/kl-gateway/package.tgz
Scanning for versions (no -version parameter):
   ..Detect format for kmd.json
  From Package https://build.fhir.org/ig/hl7dk/kl-gateway/package.tgz: 4.0
-> use version 4.0
Loading
  Load FHIR v4.0 from hl7.fhir.r4.core#4.0.1 - 4572 resources (00:05.0652)
Installing hl7.terminology#3.1.0 to the package cache
  Fetching:...................................................................................
  Installing: ................................................................................... done.
  Load hl7.terminology#3.1.0 - 4117 resources (00:05.0662)
  Terminology server http://tx.fhir.org - Version 2.0.12-SNAPSHOT (00:01.0776)
  Load https://build.fhir.org/ig/hl7dk/kl-gateway/package.tgz+  .. load IG from hl7.fhir.dk.core#1.1.0
+  .. load IG from dk.fhir.ig.kl.common.caresocial#current
Installing dk.fhir.ig.kl.common.caresocial#current to the package cache
  Fetching:....
  Installing: .... done.
 - 145 resources (00:03.0962)
  Get set...  go (00:00.0026)
Validating
  Validate kmd.json   ..Detect format for kmd.json
 00:00.0616
Done. Times: Loading: 00:21.0645, validation: 00:00.0617. Memory = 346Mb

*FAILURE*: 58 errors, 0 warnings, 14 notes
  Error @ Bundle.entry[0].resource.category (line 32, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[1].resource.category (line 73, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[2].resource.category (line 122, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[3].resource.category (line 171, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[4].resource.category (line 220, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[5].resource.category (line 269, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[6].resource.category (line 318, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[7].resource.category (line 367, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[8].resource.category (line 416, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[9].resource.category (line 457, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[10].resource.category (line 498, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[11].resource.category (line 539, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[12].resource.category (line 580, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[13].resource.category (line 621, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[14].resource.category (line 662, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[15].resource.category (line 703, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[16].resource.category (line 744, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[17].resource.category (line 785, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[18].resource.category (line 826, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[19].resource.category (line 867, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[20].resource.category (line 908, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[21].resource.category (line 949, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[22].resource.category (line 990, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[23].resource.category (line 1031, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[24].resource.category (line 1072, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[25].resource.category (line 1113, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[26].resource.category (line 1154, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[27].resource.category (line 1195, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[28].resource.category (line 1236, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[29].resource.category (line 1277, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[30].resource.category (line 1318, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[31].resource.category (line 1359, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[32].resource.category (line 1400, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[33].resource.category (line 1441, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[34].resource.category (line 1482, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[35].resource.category (line 1523, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[36].resource.category (line 1564, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[37].resource.category (line 1605, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[38].resource.category (line 1646, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[39].resource.category (line 1687, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[40].resource.category (line 1728, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[41].resource.category (line 1769, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[42].resource.category (line 1810, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[43].resource.category (line 1851, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[44].resource.category (line 1892, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[45].resource.category (line 1933, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[46].resource.category (line 1974, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[47].resource.category (line 2015, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[48].resource.category (line 2056, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[49].resource.category (line 2097, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[50].resource.category (line 2129, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[51].resource.category (line 2187, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[52].resource.category (line 2245, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[53].resource.category (line 2303, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[54].resource.category (line 2361, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[55].resource.category (line 2419, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[56].resource.category (line 2477, col22): This property must be an Array, not an Object
  Error @ Bundle.entry[69].resource.identifier (line 2991, col29): This property must be an Array, not an Object
  Information @ Bundle.entry[1].resource.ofType(Condition).severity (line 89, col22): None of the codings provided are in the value set 'Condition/Diagnosis Severity' (http://hl7.org/fhir/ValueSet/condition-severity), and a coding is recommended to come from this value set) (codes = http://kl.dk/fhir/common/caresocial/CodeSystem/FSIII#B1)
  Information @ Bundle.entry[2].resource.ofType(Condition).severity (line 138, col22): None of the codings provided are in the value set 'Condition/Diagnosis Severity' (http://hl7.org/fhir/ValueSet/condition-severity), and a coding is recommended to come from this value set) (codes = http://kl.dk/fhir/common/caresocial/CodeSystem/FSIII#B1)
  Information @ Bundle.entry[3].resource.ofType(Condition).severity (line 187, col22): None of the codings provided are in the value set 'Condition/Diagnosis Severity' (http://hl7.org/fhir/ValueSet/condition-severity), and a coding is recommended to come from this value set) (codes = http://kl.dk/fhir/common/caresocial/CodeSystem/FSIII#B1)
  Information @ Bundle.entry[4].resource.ofType(Condition).severity (line 236, col22): None of the codings provided are in the value set 'Condition/Diagnosis Severity' (http://hl7.org/fhir/ValueSet/condition-severity), and a coding is recommended to come from this value set) (codes = http://kl.dk/fhir/common/caresocial/CodeSystem/FSIII#B1)
  Information @ Bundle.entry[5].resource.ofType(Condition).severity (line 285, col22): None of the codings provided are in the value set 'Condition/Diagnosis Severity' (http://hl7.org/fhir/ValueSet/condition-severity), and a coding is recommended to come from this value set) (codes = http://kl.dk/fhir/common/caresocial/CodeSystem/FSIII#B1)
  Information @ Bundle.entry[6].resource.ofType(Condition).severity (line 334, col22): None of the codings provided are in the value set 'Condition/Diagnosis Severity' (http://hl7.org/fhir/ValueSet/condition-severity), and a coding is recommended to come from this value set) (codes = http://kl.dk/fhir/common/caresocial/CodeSystem/FSIII#B1)
  Information @ Bundle.entry[7].resource.ofType(Condition).severity (line 383, col22): None of the codings provided are in the value set 'Condition/Diagnosis Severity' (http://hl7.org/fhir/ValueSet/condition-severity), and a coding is recommended to come from this value set) (codes = http://kl.dk/fhir/common/caresocial/CodeSystem/FSIII#B1)
  Information @ Bundle.entry[50].resource.ofType(Goal).target[0].detail.ofType(CodeableConcept) (line 2160, col26): Binding for path Bundle.entry[50].resource.ofType(Goal).target[0].detail.ofType(CodeableConcept) has no source, so can't be checked
  Information @ Bundle.entry[51].resource.ofType(Goal).target[0].detail.ofType(CodeableConcept) (line 2218, col26): Binding for path Bundle.entry[51].resource.ofType(Goal).target[0].detail.ofType(CodeableConcept) has no source, so can't be checked
  Information @ Bundle.entry[52].resource.ofType(Goal).target[0].detail.ofType(CodeableConcept) (line 2276, col26): Binding for path Bundle.entry[52].resource.ofType(Goal).target[0].detail.ofType(CodeableConcept) has no source, so can't be checked
  Information @ Bundle.entry[53].resource.ofType(Goal).target[0].detail.ofType(CodeableConcept) (line 2334, col26): Binding for path Bundle.entry[53].resource.ofType(Goal).target[0].detail.ofType(CodeableConcept) has no source, so can't be checked
  Information @ Bundle.entry[54].resource.ofType(Goal).target[0].detail.ofType(CodeableConcept) (line 2392, col26): Binding for path Bundle.entry[54].resource.ofType(Goal).target[0].detail.ofType(CodeableConcept) has no source, so can't be checked
  Information @ Bundle.entry[55].resource.ofType(Goal).target[0].detail.ofType(CodeableConcept) (line 2450, col26): Binding for path Bundle.entry[55].resource.ofType(Goal).target[0].detail.ofType(CodeableConcept) has no source, so can't be checked
  Information @ Bundle.entry[56].resource.ofType(Goal).target[0].detail.ofType(CodeableConcept) (line 2508, col26): Binding for path Bundle.entry[56].resource.ofType(Goal).target[0].detail.ofType(CodeableConcept) has no source, so can't be checked
jkiddo commented 2 years ago

From the errors I assume that you have coded the json by hand? If that is the case my I recommend that you have a look at eg. https://github.com/FirelyTeam/firely-net-sdk ?

LindaLawton commented 2 years ago

I don't code anything by hand. I am using auto mapper. We ordinally looked at using a Fhir library (I don't remember which one off hand) but were not able to find one that supported the changes to the model. I wonder if the changes we noted in the model are the ones that we are having issues with now. That were fixed by your moving to the PUT endpoint. Hard to know at this point.

TBH I think it would have been helpful to have your advice 10 months ago when I started on this project. As we are at the end of the project now I don't see us having the time to make a change that big now.

jkiddo commented 2 years ago

The Firely SDK is fully capable of supporting the KL Gateway model as well as all REST operations (among these, PUT) - and yes, the advice probably comes a little late (technically, our part of the project didn't start until late november last year but it sure would have made sense if any such advices where given at time of project start).

jkiddo commented 2 years ago

Regardless - what are your current issues (its hard for me to disect at stream of errors you may/may not have fixed if I start reading from the top)?

LindaLawton commented 2 years ago

Currently no issues. Im just trying to work out token storage for refresh tokens currently.

Can you monitor my speed and let me know if you want me to slow this down at all?