Search criteria for appointment slots in Epic FHIR - hl7-fhir

I'm using Epic's FHIR API (with Argonaut) to search for available appointments, in their private sandbox:
POST /api/FHIR/STU3/Appointment/$find
{
"resourceType": "Parameters",
"parameter": [
{
"name": "startTime",
"valueDateTime": "2022-03-22T08:15:00Z"
},
{
"name": "endTime",
"valueDateTime": "2022-04-02T08:15:00Z"
}
]
}
And this gives me some temporary appointments starting at the desired date and time. No problem. However, if I add service-type as a parameter in the body:
POST /api/FHIR/STU3/Appointment/$find
{
"resourceType": "Parameters",
"parameter": [
{
"name": "startTime",
"valueDateTime": "2022-03-23T15:30:00Z"
},
{
"name": "endTime",
"valueDateTime": "2022-04-02T15:30:00Z"
},
{
"name": "service-type",
"valueCodeableConcept": {
"coding": [
{
"system": "urn:oid:1.2.840.114350.1.13.861.1.7.3.808267.11",
"code": "40111223"
}
]
}
}
]
}
I get a slightly different response. I see temporary appointments with the same slot IDs (different appointment IDs of course), but also see an OperationOutcome at the end of the Bundle:
{
"fullUrl": "urn:uuid:00000000-0007-792f-cd9b-f1f44af2c17c",
"resource": {
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "information",
"code": "value",
"details": {
"coding": [
{
"system": "urn:oid:1.2.840.114350.1.13.0.1.7.2.657369",
"code": "59109",
"display": "An element value is invalid."
}
],
"text": "An element value is invalid."
},
"diagnostics": "1.2.840.114350.1.13.861.1.7.3.808267.11",
"location": [
"/f:service-type(oid)"
],
"expression": [
"service-type (oid)"
]
}
]
},
"search": {
"mode": "outcome"
}
}
The service-type system and code I used here were taken right from the example on Epic's page on the $find API. I see similar results when I use service-types from actual Slots in the Epic sandbox. And if I put in a location-reference, it seems to be ignored and appointments at other locations are sometimes returned. The net result of all this is that it seems only the start and end time are honored when finding appointments.
How can I narrow down the results of a $find call using criteria other than the start and end date?

The source of truth for this API should be the fhir.epic.com documentation, but since this is a common question, I'll post some information here:
$find is not a good option for patient open scheduling. I don't know if that is your use case or not, but it is a common question, so I'll address it anyway.
$find invokes a rules engine that is defined by each healthcare organization. The logic of that rules engine is 100% up to the healthcare organization to define. In order for $find to work for you, you'll need very specific pre-coordination to build the logic in that engine.
The Epic sandboxes only have a very basic rules engine built out. It isn't particularly "real-world"-y. And it is probably good that it isn't, as it serves as an early warning that this API may not be the API you are looking for.
The $find API is a way to support cross-organization scheduling. For example, if you want front desk staff to be able to schedule a follow up visit at another organization across town that they have an established business relationship. For example, if a PCP office wants to schedule a dermatology visit for you at an external org. Note that the user in this case is the organization's scheduling staff, not the patient.
Specifically, Epic's $find support is based on Use Case 1 and 2 in the Argonaut Implementation Guide.

Related

FHIR CodableConcept - All elements must be from ValueSet - Writing Profile Differential

I want to create a profile from base Observation, in that all code elements must be from the ValueSet. For example:
{
"resourceType": "Observation",
"id": "example",
"meta": {
"profile": ["http://my.own.profile/StructureDefinition/custom-observation-profile"]
}
...
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "8867-4",
"display": "Body Weight"
},
{
"system": "http://loinc.org",
"code": "9843-4",
"display": "Body Weight"
}
]
},
...
All the elements from code.coding should be from a valueset, lets say http://my.value.set
In the differential, I have the following:
{
"id": "Observation.code",
"path": "Observation.code",
"short": "Body Weight",
"type": [
{
"code": "CodeableConcept"
}
],
"binding": {
"strength": "required",
"description": "All LOINC values whose SCALE is DOC in the LOINC database and the HL7 v3 Code System NullFlavor concept 'unknown'",
"valueSet": "http://my.value.set"
}
},
But this one is validating only the first element in the list. It does not validate the other ones. It ignores even if they are invalid.
The list can be 1..*, and I want all of them should be from the valueSet.
How do I write differential for this one?
The expectation when there's a required binding on a CodeableConcept is that one of the CodeableConcept.coding repetitions must come from the binding. There's no requirement that the others must - and the primary use for additional codings is that you don't want them to be from the same value set. The purpose of additional codings is to convey other codes from other code systems that also convey the same meaning (so that other recipients of the instance who might not necessarily recognize the code preferred by your profile can still find a code they recognize - and also so that the 'original' coding can be retained in cases where that isn't from the bound value set).
If you truly want to force all CodeableConcept.coding repetitions to be from a single value set (strongly discouraged and likely to impede interoperability), you could declare a binding on Observation.code.coding.

How to search birthData in fhir using _content?

When I search with only birthData in fhir I am getting results.
For example: http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient?_pretty=true&birthdate=2020-03-16 will return patient who has birthdate as 2020-03-16.
When I am searching with _content I am not getting any results. Something like this:
http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient?_content=2019-09-05
_content is for searching text content.
If you want to search for dates you need to use a date search parameter. E.g.:
http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient?birthDate=2019-09-05
This can be achieved using Search Parameters.
Search parameters are essentially named paths within resources that are indexed by the system so that they can be used to find resources that match a given criteria.
Using Search parameter
we can add additional search parameters that will index fields that do not have a standard search parameter defined.
we can add additional search parameters that will index extensions used by your clients.
we can disable search parameters
Example:
Lets say I have a PractitionerRole
"resourceType": "PractitionerRole",
"id": "6639",
"meta": {
"versionId": "1",
"lastUpdated": "2020-03-19T13:26:34.748+05:30",
"source": "#aYyeIlv9Yutudiwy"
},
"text": {
"status": "generated",
"div": "<div xmlns=\"<http://www.w3.org/1999/xhtml\">foo</div>">
},
"active": true,
"practitioner": {
"reference": "Practitioner/6607"
},
"organization": {
"reference": "Organization/6528"
},
"specialty": [
{
"coding": [
{
"system": "<http://snomed.info/sct",>
"code": "42343242",
"display": "Clinical immunology"
}
]
}
]
}
PractitionerRole has thier own search parameters. Apart from those search parameters we wanted to have a search parameter which will filter all practitioner roles based on practitioner.reference. We can achieve this using Search parameters. All we need to do is creating a new search parameter just like below.
{
"resourceType": "SearchParameter",
"title": "Practitioner Referecene",
"base": [ "PractitionerRole" ],
"status": "active",
"code": "practitioner_reference",
"type": "token",
"expression": "PractitionerRole.practitioner.reference",
"xpathUsage": "normal"
}
Here what fhir tells is when user wanted to filter with practitioner_reference then look for PractitionerRole.practitioner.reference.
This looks something like this:
http://localhost:8080/hapi-fhir-jpaserver/fhir/PractitionerRole?practitioner_reference=Practitioner/6607
We can also extend this to search with multiple parameters. We can create a search parameter with or condition so that it can search with multi parameters.
"resourceType": "SearchParameter",
"title": "Patient Multi Search",
"base": [ "Patient" ],
"status": "active",
"code": "pcontent",
"type": "token",
"expression": "Patient.managingOrganization.reference|Patient.birthDate|Patient.address[0].city",
"xpathUsage": "normal"
}
Above SearchParameter will search withPatient.managingOrganization.reference or Patient.birthDate or Patient.address[0].city.
The query looks like this:
Search With City → http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient?pcontent=Bruenmouth
Search With Birth Date → http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient?pcontent=2019-04-06

Can't get FHIR message to decode

I am trying to integrate with a service that provides FHIR ImageStudy messages in JSON format. Once I have the JSON message I need to convert the message to XML.
I am using the FHIR-net-api found here, https://github.com/ewoutkramer/fhir-net-api I posted earlier and got help using this library to parse standard image study messages. Here is a link to my earlier post, FHIR JSON to XML decoding in BizTalk
The service I am connecting to has added some extensions to the image study message and when I attempt to parse it I get an error that the parser failed line 1 character 1.
My understanding is that if the extension are done correctly the FHIR-net-api library should be able to parse the JSON to XML. Is this correct?
Can anyone identify if the test message below is compliant to the FHIR standard, if not what is wrong with it? I have shortened the message to only contain a single image study but the service returns multiple in a bundle. I have also removed identifying information.
{
"resourceType": "Bundle",
"total": 15,
"entry": [
{"resource": {
"resourceType": "ImagingStudy",
"id": "LALA.e1e6683d-f6d9-e311-ae0e-0050568f64",
"contained": [
{
"resourceType": "Organization",
"text": {"div": "LALA"},
"name": "LALA"
},
{
"resourceType": "Procedure",
"id": "Procedure1",
"code": {"coding": [ {
"code": "RAD-HANB",
"display": "HANDS BIL"
}]}
}
],
"extension": [ {
"url": "https://someplace.org/fhir/extensions/imagingstudy-examstatus",
"valueString": "Finalized"
}],
"started": "2013-12-03T12:30:00-08:00",
"accession": {"value": "A12345BH"},
"procedure": [{"reference": "#Procedure1"}],
"series": [ {
"modality": {
"system": "http://www.dicomlibrary.com/dicom/modality/",
"code": "CR"
},
"bodySite": {"code": "UEX"},
"instance": [
{"title": "DiagnosticReport"},
{
"title": "DiagnosticImage",
"content": [
{
"url": "/fhir/Patient/91111/ImagingStudy?_query=imageUrl&_id=6683d-f6d9-e311-ae0e-0050568f6477&-mrn=12345T&-organization=lala&accession=tester&-status=F",
"title": "Something"
},
{
"url": "/fhir/Patient/9111111/ImagingStudy?_query=html5Url&_id=e1e6683d-f6d9-e311-ae0e-0050568f6&-mrn=123345&-organization=lala&accession=testing&-status=F",
"title": "HTML5"
}
]
}
]
}]
}}
]
}
I suspect that you got a message like this: Error parsing XHTML: Incorrect document syntax. at line 1 row 1. source = " at line 8 col 13
That's what I get once I clean up the instance a little bit to include only the resource and not the wrapper from the Bundle and check it against http://fhir2.healthintersections.com.au/open/.
The first issue is that the narrative inside your div tag is not valid. It needs to look like this:
"div": "<div>LALA</div>"
However there are a bunch of others. The narrative is missing status. Narrative isn't actually allowed on contained resources, you're missing a bunch of mandatory elements, etc. Just go to the link above and paste your JSON into the "upload" box at the bottom of the page and select "validate". That will give you a full report of the issues. (Not all of those will necessarily impact your ability to convert between JSON and XML, but presumably you'll want to fix them regardless.)

Why Google Cloud Speech API doesn't transcript the whole audio file?

I'm trying to transcript a short interview audio file with Google Cloud Speech API (asynchronously) but it only transcribes the first half minute of the recording. I had several attempts with recordings longer than one minute and the results were the same. My question is, how can I achieve the full audio transcription for a given file?
You can find one of my use-cases here:
Upload the audio file:
POST https://speech.googleapis.com/v1beta1/speech:asyncrecognize?key={YOUR_API_KEY}
{
"config": {
"encoding": "LINEAR16",
"sampleRate": 16000,
},
"audio": {
"uri": "gs://protean-blend-146812.appspot.com/record__2017_02_02_12_02_17_greg_16000.wav",
}
}
Got the operation number in the response:
{
"name": "8977932499808116064"
}
Make a request with the operation number:
GET https://speech.googleapis.com/v1beta1/operations/8977932499808116064?key={YOUR_API_KEY}
Got the result:
{
"name": "8977932499808116064",
"metadata": {
"#type": "type.googleapis.com/google.cloud.speech.v1beta1.AsyncRecognizeMetadata",
"progressPercent": 100,
"startTime": "2017-02-02T11:21:41.346784Z",
"lastUpdateTime": "2017-02-02T11:23:03.150491Z"
},
"done": true,
"response": {
"#type": "type.googleapis.com/google.cloud.speech.v1beta1.AsyncRecognizeResponse",
"results": [
{
"alternatives": [
{
"transcript": "McGregor you have any stories about being lost that you have all the good advice well let me know in the Golden Triangle drug trafficking across the border",
"confidence": 0.8535113
}
]
},
{
"alternatives": [
{
"transcript": "we came across this Village very very poor Village People and some of the people there were really unfriendly they just started throwing rocks and my friend and we couldn't talk so we backed away went back quickly up the hill",
"confidence": 0.9027881
}
]
},
{
"alternatives": [
{
"transcript": "and we are wondering you know where to go and luckily I can see in the distance there in one tree",
"confidence": 0.8931573
}
]
}
]
}
}
The links, where I made the requests (at 'Try it!' section):
Upload: https://cloud.google.com/speech/reference/rest/v1beta1/speech/asyncrecognize
Operation response: https://cloud.google.com/speech/reference/rest/v1beta1/operations/get

Can I use actionResulting to link Questionnaire to a CarePlan activity?

I have asked about Questionnaire and CarePlan earlier and someone else has asked another similar question, but my question this time is a bit more specific.
This time I wonder if it's allowed to create a CarePlan using 'detail' rather than reference and then link Questionnaire in to actionResulting. Could I use the actionResulting as a link to the Questionnaire? Would the following resource be valid?
{
"resourceType": "CarePlan",
...,
"activity": [
{
"actionResulting": [
{
"reference": "Questionnaire/copd-form"
}
]
"detail": {
"category": {
"coding": [
{
"system": "http://hl7.org/fhir/care-plan-activity-category",
"code": "observation"
}
]
},
"code": {
"text": "A code for capturing COPD subjective input from patient?"
},
"prohibited": false,
"scheduledTiming": {
"repeat": {
"frequency": 1,
"period": 1,
"periodUnits": "d"
}
},
"performer": [
{
"reference": "Patient/3183"
}
],
"description": "Daily COPD form"
}
}
}
Well, pointing to the Questionnaire would be saying "as a result of this plan, this Questionnaire was designed". I suspect what you'd really want to say is "as a result of this plan, I asked the patient to fill out Questionnaire X" (which would be a DiagnosticOrder) or "as a result of this plan, the patient answered this Questionnaire" (which would be a QuestionnaireResponse). For the first of those, I believe we're still waiting on an extension to allow a DiagnosticRequest to point to the Questionnaire to be filled out.

Resources