I am creating a proof-of-concept chatbot that will take patient queries (e.g. "What is the name of my doctor?"), retrieve the information requested through a FHIR API, and return the information requested (e.g. "Your doctor is Dr. Smith."). I was able to create a custom extension using an Open API document provided by HAPI FHIR that allows me to look up data in the HAPI FHIR sandbox, but I am unable to pass that JSON response into discrete variables to populate my chatbot.
Currently, I have the chatbot structured so that it utilizes the extension HAPI FHIR API to retrieve information related to "CareTeam". It successfully retrieves the information related to "CareTeam" using the following CURL:
curl -X GET -H 'Content-Type: application/json' -H 'accept: application/json' 'https://hapi.fhir.org/baseR4/CareTeam/va-team-visn6-vamc1-pc'
The JSON response is:
{
"status": 200,
"body":
{
"resourceType": "CareTeam",
"id": "va-team-visn6-vamc1-pc",
"meta":
{
"versionId": "1",
"lastUpdated": "2019-11-01T17:59:48.291+00:00",
"source": "#qsmu4cjPakjrXiTn"
},
"text":
{
"status": "additional",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><div>Hampton, VA, VAMC, Primary Care PACT</div></div>"
},
"name": "Primary Care PACT",
"participant":
[
{
"role":
[
{
"coding":
[
{
"system": "http://snomed.info/sct",
"code": "446050000",
"display": "Primary care physician"
}
],
"text": "Primary Care Physician"
}
],
"member":
{
"reference": "Practitioner/va-prac-visn6-francis",
"display": "Dr. Francis"
}
}
]
}
}
I am now trying to extract the information after display
("Dr. Francis"), assign it to a variable called careTeamMD
, and display that result to the user. I haven't had much luck reading through the Watson Assistant documentation to better understand the syntax. I have two main questions:
- Where should I be assigning the value to the variable? Should it be in the step where I use the extension (step 1), or in the step where I return that information to the user (step 3)?
- How do I assign whatever is in
display
tocareTeamMD
?
Currently, when I try to use the "Insert a variable" option, the only variable I am given from the API call in step 1 is "Ran successfully". The only variables offered under "Integration variables" are Timezone, Locale, and Channel Name. How can I get Watson Assistant to "see" the rest of the data returned in the JSON response?