FHIR Chat · Holding Custom complex Object inside Questionnaire Item Extn · questionnaire

Stream: questionnaire

Topic: Holding Custom complex Object inside Questionnaire Item Extn


view this post on Zulip Sravanti Cherukuri (Apr 28 2021 at 18:18):

I have a POJO with below structure.

                  class Criteria {
                     String name; 
                     String operator;
                     List<Criteria> next;
                  }

here is the sample JSON payload for above domain class.

                {
                    "name": "item_1",
                    "operator": "+",
                    "next": [
                    {
                        "name": "item_2",
                        "operator": "+"
                    }
                    ]
                }

I would like to maintain this information in extensions array under QuestionnaireItem.

{
"resourceType": "Questionnaire"
"item": [

    {
        "linkId" : "123",
        "type": "text",
        "extension": [

            // ==> How to hold Custom complex Object?
        ]
    }
]

}

view this post on Zulip Lloyd McKenzie (Apr 28 2021 at 18:31):

Take a look at complex extension patient-citizenship example here: https://build.fhir.org/extensibility

view this post on Zulip Sravanti Cherukuri (Apr 28 2021 at 19:08):

I am able to create Custom extension to represent name and operator fields in Criteria class. But how do i create custom extension to represent "next" field which is a list of same extension type

{
"url": "http://hl7.org/fhir/StructureDefinition/equation-criteria",
"extension": [
{
"url": "name",
"valueString": "Q1"
},
{
"url": "operator",
"valueString": "+"
}
]
}

view this post on Zulip Lloyd McKenzie (Apr 28 2021 at 19:12):

A list of extensions with the same URL

view this post on Zulip Sravanti Cherukuri (Apr 28 2021 at 19:33):

Can you please assist me on above query

view this post on Zulip Lloyd McKenzie (Apr 28 2021 at 19:45):

There's no recursive mechanism with extensions - so either you define another level to your extension where there's a url called "next" that contains extensions with url "name" and "operator" or you allow the context for equation-criteria to include itself and just repeat the whole extension multiple times.

view this post on Zulip Sravanti Cherukuri (Apr 28 2021 at 19:50):

Thank you,It will be a great help if you could share the sample json for this usecase.

view this post on Zulip Lloyd McKenzie (Apr 28 2021 at 22:26):

{
  "url":"some non-HL7-url/equation-crieria",
 "extension":[
   {
      "url":"name",
      "valueString":"Q1"
    }, {
      "url:"operator",
      "valueString":"+"
    },{
      "url":"next",
      "extension":[
        {
          "url":"name",
          "valueString":"Q2"
         },
         ...
      ]
    },{
      "url":"next",
      "extension":[
        {
          "url":"name",
          "valueString":"Q3"
         },
         ...
      ]
    }
  ]
}

view this post on Zulip Sravanti Cherukuri (May 20 2021 at 13:59):

Thanks Lloyd McKenzie..it helped a lot


Last updated: Apr 12 2022 at 19:14 UTC