Skip to content

Instantly share code, notes, and snippets.

@ameyawebonise
Created January 14, 2016 04:41
Show Gist options
  • Save ameyawebonise/263b41eda0de901d3e62 to your computer and use it in GitHub Desktop.
Save ameyawebonise/263b41eda0de901d3e62 to your computer and use it in GitHub Desktop.
{
"compliance" : "BOTH",
"who" : [ {
"lhs" : {
"type" : "AllTrackers"
},
"operator" : null,
"rhs" : [ ]
} ],
"what" : [ {
"type" : "Expression",
"requirement" : {
"type" : "TrackerItem",
"id" : 4495
},
"field" : "SMART_FIELDS",
"operator" : "VHR_FIELDS_DRILLDOWN_OPERATOR",
"values" : [ {"questionId":"1","answer":"1","questionId":"3","answer":"2"} ]
} ]
}
}
@ravijadhav-webonise
Copy link

Please see the below json i have created and passing

{
"searchTerms": {
"who": [
{
"lhs": {
"type": "AllTrackers"
},
"operator": null,
"rhs": [

    ]
  }
],
"what": [
  {
    "type": "And",
    "expressions": [
      {
        "type": "Expression",
        "requirement": {
          "type": "TrackerItem",
          "id": 4491
        },
        "field": "SMART_FIELDS",
        "operator": "VHR_FIELDS_DRILLDOWN_OPERATOR",
        "values": {
          "6": {
            "questions": [
              {
                "questionId": 500,
                "sectionId": 6,
                "questionName": "Do you have an Epi Pen for this allergy?",
                "widgetId": 18,
                "questionHelp": null,
                "answer": true
              },
              {
                "questionId": 26,
                "sectionId": 6,
                "questionName": "Do you have any Allergies",
                "widgetId": 20,
                "questionHelp": null,
                "answer": true
              }
            ],
            "sectionName": "Allergies"
          }
        }
      },
      {
        "type": "Expression",
        "requirement": {
          "type": "AnyTrackerItem"
        },
        "field": "NEXT_ACTION_DATE",
        "operator": "EQUALS",
        "values": [
          "2016-01-06"
        ]
      },
      {
        "type": "Expression",
        "requirement": {
          "type": "TrackerItem",
          "id": 4491
        },
        "field": "SMART_FIELDS",
        "operator": "VHR_FIELDS_DRILLDOWN_OPERATOR",
        "values": {
          "6": {
            "questions": [
              {
                "questionId": 500,
                "sectionId": 6,
                "questionName": "Do you have an Epi Pen for this allergy?",
                "widgetId": 18,
                "questionHelp": null,
                "answer": true
              },
              {
                "questionId": 26,
                "sectionId": 6,
                "questionName": "Do you have any Allergies",
                "widgetId": 20,
                "questionHelp": null,
                "answer": true
              }
            ],
            "sectionName": "Allergies"
          }
        }
      }
    ]
  }
],
"compliance": "BOTH"

},
"name": "test",
"shared": false
}

@ameyawebonise
Copy link
Author

the above JSON is incorrect.we dont need the values as a map of sectionId:List.

@ameyawebonise
Copy link
Author

{
"searchTerms": {
"who": [
{
"lhs": {
"type": "AllTrackers"
},
"operator": null,
"rhs": [

    ]
  }
],
"what": [
  {
    "type": "And",
    "expressions": [
      {
        "type": "Expression",
        "requirement": {
          "type": "TrackerItem",
          "id": 4491
        },
        "field": "SMART_FIELDS",
        "operator": "VHR_FIELDS_DRILLDOWN_OPERATOR",
        "values":[{"questionId":500,"answer":1},{"questionId":26,"answer":1}]
      },
      {
        "type": "Expression",
        "requirement": {
          "type": "AnyTrackerItem"
        },
        "field": "NEXT_ACTION_DATE",
        "operator": "EQUALS",
        "values": [
          "2016-01-06"
        ]
      },
      {
        "type": "Expression",
        "requirement": {
          "type": "TrackerItem",
          "id": 4491
        },
        "field": "SMART_FIELDS",
        "operator": "VHR_FIELDS_DRILLDOWN_OPERATOR",
        "values": {
          "6": {
            "questions": [
              {
                "questionId": 500,
                "sectionId": 6,
                "questionName": "Do you have an Epi Pen for this allergy?",
                "widgetId": 18,
                "questionHelp": null,
                "answer": true
              },
              {
                "questionId": 26,
                "sectionId": 6,
                "questionName": "Do you have any Allergies",
                "widgetId": 20,
                "questionHelp": null,
                "answer": true
              }
            ],
            "sectionName": "Allergies"
          }
        }
      }
    ]
  }
],
"compliance": "BOTH"

},
"name": "test",
"shared": false
}

@ameyawebonise
Copy link
Author

the json posted above is correct.We need values to be a List<QuestionAnswerMapping> where QuestionAnswerMapping is as follows:

public class QuestionAnswerMapping{ int questionId; //question id chosen for filter int answer; //answer = 1 if yes 2 if no }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment