Related
I'm dumping my direct messages in Slack.
I manage to get all the messages one by one.
However I don't find any property that tells which message is a parent message and which ones are replies.
How can we get this information?
Typical code in C#
ConversationsListResponse conversationListRespons = await slackClient.GetConversationsListAsync("",false,100,types);
foreach (var channel in conversationListRespons.channels)
{
ConversationsMessageHistory messages = await slackClient.GetConversationsHistoryAsync(channel);
Even when I test the api from the slack interface, it's not giving the information.
Are there any other apis than the ones I'm using to get the required information?
Api used: https://api.slack.com/methods/conversations.history
Here is an example: This a main Direct Message with 4 replies.
conversations.history returns them without any relationship between them.
The query in slack test interface:
and the result:
{
"ok": true,
"messages": [
{
"type": "message",
"text": "voici un log",
"files": [
{
"id": "F04M6EAEXGX",
"created": 1675280228,
"timestamp": 1675280228,
"name": "32x32.ico",
"title": "32x32.ico",
"mimetype": "application/octet-stream",
"filetype": "binary",
"pretty_type": "Binary",
"user": "U0XNQGD0R",
"user_team": "T0XN0RW8H",
"editable": false,
"size": 4286,
"mode": "hosted",
"is_external": false,
"external_type": "",
"is_public": false,
"public_url_shared": false,
"display_as_bot": false,
"username": "",
"url_private": "https://files.slack.com/files-pri/T0XN0RW8H-F04M6EAEXGX/32x32.ico",
"url_private_download": "https://files.slack.com/files-pri/T0XN0RW8H-F04M6EAEXGX/download/32x32.ico",
"media_display_type": "unknown",
"permalink": "https://sanitized.slack.com/files/U0XNQGD0R/F04M6EAEXGX/32x32.ico",
"permalink_public": "https://slack-files.com/T0XN0RW8H-F04M6EAEXGX-bb8c68eec7",
"is_starred": false,
"has_rich_preview": false,
"file_access": "visible",
"media_progress": null
}
],
"upload": false,
"user": "U0XNQGD0R",
"display_as_bot": false,
"ts": "1675280236.783609",
"blocks": [
{
"type": "rich_text",
"block_id": "Twy",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "voici un log"
}
]
}
]
}
],
"client_msg_id": "5bda3f9c-64a8-4c1b-8b5e-f37c3b2e2c5d"
},
{
"client_msg_id": "850f4ecc-59c0-4af0-b13f-e527ed7a88de",
"type": "message",
"text": "<#U0XNQ04JD> test",
"user": "U0XNQGD0R",
"ts": "1675280205.367429",
"blocks": [
{
"type": "rich_text",
"block_id": "qi/vH",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "user",
"user_id": "U0XNQ04JD"
},
{
"type": "text",
"text": " test"
}
]
}
]
}
],
"team": "T0XN0RW8H"
},
{
"client_msg_id": "e249a07d-f887-4edb-859a-1cc38559dc7b",
"type": "message",
"text": ":100:",
"user": "U0XNQGD0R",
"ts": "1675280190.138859",
"blocks": [
{
"type": "rich_text",
"block_id": "rGp",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "emoji",
"name": "100",
"unicode": "1f4af"
}
]
}
]
}
],
"team": "T0XN0RW8H"
},
{
"client_msg_id": "df2a2f63-21b1-42d5-91db-3c66b083ed7c",
"type": "message",
"text": "yes<https://www.google.com|link to google>",
"user": "U0XNQGD0R",
"ts": "1675280183.929889",
"blocks": [
{
"type": "rich_text",
"block_id": "GZV",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "yes"
},
{
"type": "link",
"url": "https://www.google.com",
"text": "link to google"
}
]
}
]
}
],
"team": "T0XN0RW8H",
"reactions": [
{
"name": "+1",
"users": [
"U0XNQGD0R"
],
"count": 1
}
]
},
{
"client_msg_id": "116e4fc3-ef4a-4148-84ad-975ff0f227e6",
"type": "message",
"text": "Salut Christophe,\nthis is a test for Slack",
"user": "U0XNQGD0R",
"ts": "1675254487.545169",
"blocks": [
{
"type": "rich_text",
"block_id": "O2s",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "Salut ,\nthis is a test for Slack"
}
]
}
]
}
],
"team": "T0XN0RW8H"
}
],
"has_more": false,
"is_limited": false,
"pin_count": 0,
"channel_actions_ts": null,
"channel_actions_count": 0
}
To start, there might be some confusion as to what constitutes a reply or thread on Slack. Your first screenshot seems like several "normal" messages posted by the same user one after the other. In Slack a thread is a message posted by selecting the thread icon that corresponds to a parent message as seen in the screenshot.
With that established, you can retrieve threaded messages by making a call to conversations.replies.
I'm trying to find DiagnosticReport resources for a given patient using the SmartHealthIt R4 server for testing (https://r4.smarthealthit.org).
I've loaded the Patient and DiagnosticReport resources shown below.
The patient has the following for id:
"resourceType": "Patient",
"id": "1435573",
The DiagnosticReport has the following for subject:
"subject": {
"reference": "Patient/1435573"
}
None of the following searches return this DiagnosticReport. How do I get all of the DiagnosticReport resources for Patient/1435573 including the one used in this example (I can modify the Patient, the DiagnosticReport, and/or the urls to get the result). The queries below are based on Hapi FHIR: searching for patient identifier using Postman. All of the queries give basically an empty bundle (contains only the self url) except for the last that gives an invalid query error.
Queries:
https://r4.smarthealthit.org/DiagnosticReport?subject=1435573
https://r4.smarthealthit.org/DiagnosticReport?patient.identifier=1435573
https://r4.smarthealthit.org/DiagnosticReport?subject=Patient/1435573
https://r4.smarthealthit.org/DiagnosticReport?subject=https://r4.smarthealthit.org/Patient/1435573
https://r4.smarthealthit.org/DiagnosticReport?subject=http://r4.smarthealthit.org/Patient/1435573
https://r4.smarthealthit.org/DiagnosticReport?subject.reference=1435573
(invalid parameter chain error)
Full Patient Resource (response from the url shown below):
https://r4.smarthealthit.org/Patient/1435573
{
"resourceType": "Patient",
"id": "1435573",
"meta": {
"versionId": "1",
"lastUpdated": "2022-11-20T12:31:20.724-05:00",
"profile": [
"http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"
]
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Generated by Synthea.Version identifier: master-branch-latest\n . Person seed: -3481236467670898486 Population seed: 1663786624475</div>"
},
"extension": [
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race",
"extension": [
{
"url": "ombCategory",
"valueCoding": {
"system": "urn:oid:2.16.840.1.113883.6.238",
"code": "2106-3",
"display": "White"
}
},
{
"url": "text",
"valueString": "White"
}
]
},
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity",
"extension": [
{
"url": "ombCategory",
"valueCoding": {
"system": "urn:oid:2.16.840.1.113883.6.238",
"code": "2186-5",
"display": "Not Hispanic or Latino"
}
},
{
"url": "text",
"valueString": "Not Hispanic or Latino"
}
]
},
{
"url": "http://hl7.org/fhir/StructureDefinition/patient-mothersMaidenName",
"valueString": "Natosha194 Rolfson709"
},
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex",
"valueCode": "M"
},
{
"url": "http://hl7.org/fhir/StructureDefinition/patient-birthPlace",
"valueAddress": {
"city": "Westfield",
"state": "Massachusetts",
"country": "US"
}
},
{
"url": "http://synthetichealth.github.io/synthea/disability-adjusted-life-years",
"valueDecimal": 0.011850126818590398
},
{
"url": "http://synthetichealth.github.io/synthea/quality-adjusted-life-years",
"valueDecimal": 30.98814987318141
}
],
"identifier": [
{
"system": "https://github.com/synthetichealth/synthea",
"value": "d7e5852a-974c-6d45-f81d-5a87bbd05d2a"
},
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR",
"display": "Medical Record Number"
}
],
"text": "Medical Record Number"
},
"system": "http://hospital.smarthealthit.org",
"value": "d7e5852a-974c-6d45-f81d-5a87bbd05d2a"
},
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "SS",
"display": "Social Security Number"
}
],
"text": "Social Security Number"
},
"system": "http://hl7.org/fhir/sid/us-ssn",
"value": "999-55-2948"
},
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "DL",
"display": "Driver's License"
}
],
"text": "Driver's License"
},
"system": "urn:oid:2.16.840.1.113883.4.3.25",
"value": "S99934182"
},
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "PPN",
"display": "Passport Number"
}
],
"text": "Passport Number"
},
"system": "http://standardhealthrecord.org/fhir/StructureDefinition/passportNumber",
"value": "X1908681X"
}
],
"name": [
{
"use": "official",
"family": "Hermiston71",
"given": [
"Glenn0",
"Adalberto916"
],
"prefix": [
"Mr."
]
}
],
"telecom": [
{
"system": "phone",
"value": "555-370-8941",
"use": "home"
}
],
"gender": "male",
"birthDate": "1960-07-09",
"deceasedDateTime": "1992-06-21T18:48:35-04:00",
"address": [
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/geolocation",
"extension": [
{
"url": "latitude",
"valueDecimal": 42.1419070399434
},
{
"url": "longitude",
"valueDecimal": -71.28041093915812
}
]
}
],
"line": [
"236 Halvorson Mews Suite 21"
],
"city": "Walpole",
"state": "MA",
"country": "US"
}
],
"maritalStatus": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-MaritalStatus",
"code": "M",
"display": "M"
}
],
"text": "M"
},
"multipleBirthBoolean": false,
"communication": [
{
"language": {
"coding": [
{
"system": "urn:ietf:bcp:47",
"code": "en-US",
"display": "English"
}
],
"text": "English"
}
}
]
}
Full DiagnosticReport Resource (response from the url shown below):
https://r4.smarthealthit.org/DiagnosticReport/1435574
{
"resourceType": "DiagnosticReport",
"id": "1435574",
"meta": {
"versionId": "1",
"lastUpdated": "2022-11-20T12:36:53.205-05:00",
"profile": [
"http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-note"
]
},
"status": "final",
"category": [
{
"coding": [
{
"system": "http://loinc.org",
"code": "34117-2",
"display": "History and physical note"
},
{
"system": "http://loinc.org",
"code": "51847-2",
"display": "Evaluation + Plan note"
}
]
}
],
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "34117-2",
"display": "History and physical note"
},
{
"system": "http://loinc.org",
"code": "51847-2",
"display": "Evaluation + Plan note"
}
]
},
"subject": {
"reference": "Patient/1435573"
},
"effectiveDateTime": "1978-09-02T17:57:46-04:00",
"issued": "1978-09-02T17:57:46.296-04:00",
"performer": [
{
"display": "Dr. Debbie941 Macejkovic424"
}
],
"presentedForm": [
{
"contentType": "text/plain; charset=utf-8",
"data": "DQoxOTc4LTA5LTAyDQoNCiMgQ2hpZWYgQ29tcGxhaW50DQpObyBjb21wbGFpbnRzLg0KDQojIEhpc3Rvcnkgb2YgUHJlc2VudCBJbGxuZXNzDQpHbGVubjANCiBpcyBhIDE4IHllYXItb2xkIG5vbi1oaXNwYW5pYyB3aGl0ZSBtYWxlLg0KDQojIFNvY2lhbCBIaXN0b3J5DQogUGF0aWVudCBoYXMgbmV2ZXIgc21va2VkLg0KIFBhdGllbnQgaWRlbnRpZmllcyBhcyBoZXRlcm9zZXh1YWwuDQoNClBhdGllbnQgY29tZXMgZnJvbSBhIG1pZGRsZSBzb2Npb2Vjb25vbWljIGJhY2tncm91bmQuDQogUGF0aWVudCBkaWQgbm90IGZpbmlzaCBoaWdoIHNjaG9vbC4NClBhdGllbnQgY3VycmVudGx5IGhhcyBCbHVlIENyb3NzIEJsdWUgU2hpZWxkLg0KDQojIEFsbGVyZ2llcw0KTm8gS25vd24gQWxsZXJnaWVzLg0KDQojIE1lZGljYXRpb25zDQpObyBBY3RpdmUgTWVkaWNhdGlvbnMuDQoNCiMgQXNzZXNzbWVudCBhbmQgUGxhbg0KUGF0aWVudCBpcyBwcmVzZW50aW5nIHdpdGggaG91c2luZyB1bnNhdGlzZmFjdG9yeSAoZmluZGluZyksIG9ubHkgcmVjZWl2ZWQgcHJpbWFyeSBzY2hvb2wgZWR1Y2F0aW9uIChmaW5kaW5nKSwgZnVsbC10aW1lIGVtcGxveW1lbnQgKGZpbmRpbmcpLCBzb2NpYWwgaXNvbGF0aW9uIChmaW5kaW5nKSwgc3RyZXNzIChmaW5kaW5nKS4gDQoNCiMjIFBsYW4NCg0K"
}
]
}
--- EDIT ---------------------------------------
This query (suggested in answer below) also does not work. Screen shots are for a newly create patient (the original was deleted).
https://r4.smarthealthit.org/DiagnosticReport?patient=1437050
--- EDIT: STEPS TO REPRODUCE ---------------------------------
It looks like the patients created by end users are routinely deleted from this server (which makes sense). Here are the steps to reproduce the issue.
POST this messge to https://launch.smarthealthit.org/v/r4/fhir/Patient
{
"identifier": [
{
"system": "https://github.com/synthetichealth/synthea",
"value": "d7e5852a-974c-6d45-f81d-5a87bbd05d2a"
},
{
"system": "http://hospital.smarthealthit.org",
"type": {
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR",
"display": "Medical Record Number"
}],
"text": "Medical Record Number"
},
"value": "d7e5852a-974c-6d45-f81d-5a87bbd05d2a"
},
{
"system": "http://hl7.org/fhir/sid/us-ssn",
"type": {
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "SS",
"display": "Social Security Number"
}],
"text": "Social Security Number"
},
"value": "999-55-2948"
},
{
"system": "urn:oid:2.16.840.1.113883.4.3.25",
"type": {
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "DL",
"display": "Driver's License"
}],
"text": "Driver's License"
},
"value": "S99934182"
},
{
"system": "http://standardhealthrecord.org/fhir/StructureDefinition/passportNumber",
"type": {
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "PPN",
"display": "Passport Number"
}],
"text": "Passport Number"
},
"value": "X1908681X"
}
],
"extension": [
{
"extension": [
{
"valueCoding": {
"system": "urn:oid:2.16.840.1.113883.6.238",
"code": "2106-3",
"display": "White"
},
"url": "ombCategory"
},
{
"valueString": "White",
"url": "text"
}
],
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
},
{
"extension": [
{
"valueCoding": {
"system": "urn:oid:2.16.840.1.113883.6.238",
"code": "2186-5",
"display": "Not Hispanic or Latino"
},
"url": "ombCategory"
},
{
"valueString": "Not Hispanic or Latino",
"url": "text"
}
],
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity"
},
{
"valueString": "Natosha194 Rolfson709",
"url": "http://hl7.org/fhir/StructureDefinition/patient-mothersMaidenName"
},
{
"valueCode": "M",
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
},
{
"valueAddress": {
"country": "US",
"city": "Westfield",
"state": "Massachusetts"
},
"url": "http://hl7.org/fhir/StructureDefinition/patient-birthPlace"
},
{
"valueDecimal": 0.011850126818590398,
"url": "http://synthetichealth.github.io/synthea/disability-adjusted-life-years"
},
{
"valueDecimal": 30.98814987318141,
"url": "http://synthetichealth.github.io/synthea/quality-adjusted-life-years"
}
],
"address": [{
"country": "US",
"extension": [{
"extension": [
{
"valueDecimal": 42.1419070399434,
"url": "latitude"
},
{
"valueDecimal": -71.28041093915812,
"url": "longitude"
}
],
"url": "http://hl7.org/fhir/StructureDefinition/geolocation"
}],
"city": "Walpole",
"line": ["236 Halvorson Mews Suite 21"],
"state": "MA"
}],
"gender": "male",
"multipleBirthBoolean": false,
"birthDate": "1960-07-09",
"meta": {"profile": ["http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"]},
"deceasedDateTime": "1992-06-21T18:48:35-04:00",
"name": [{
"given": [
"Glenn0",
"Adalberto916"
],
"use": "official",
"prefix": ["Mr."],
"family": "Hermiston71"
}],
"telecom": [{
"system": "phone",
"use": "home",
"value": "555-370-8941"
}],
"text": {
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Generated by <a href=\"https://github.com/synthetichealth/synthea\">Synthea<\/a>.Version identifier: master-branch-latest\n . Person seed: -3481236467670898486 Population seed: 1663786624475<\/div>",
"status": "generated"
},
"communication": [{"language": {
"coding": [{
"system": "urn:ietf:bcp:47",
"code": "en-US",
"display": "English"
}],
"text": "English"
}}],
"maritalStatus": {
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/v3-MaritalStatus",
"code": "M",
"display": "M"
}],
"text": "M"
},
"resourceType": "Patient"
}
Modify this message by replacing PATIENT_ID with the id returned when the Patient resource is posted and then post that to https://launch.smarthealthit.org/v/r4/fhir/DiagnosticReport
{
"code": {"coding": [
{
"system": "http://loinc.org",
"code": "34117-2",
"display": "History and physical note"
},
{
"system": "http://loinc.org",
"code": "51847-2",
"display": "Evaluation + Plan note"
}
]},
"performer": [{
"display": "Dr. Debbie941 Macejkovic424"
}],
"effectiveDateTime": "1978-09-02T17:57:46-04:00",
"meta": {"profile": ["http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-note"]},
"subject": {"reference": "https://r4.smarthealthit.org/Patient/PATIENT_ID"},
"presentedForm": [{
"data": "DQoxOTc4LTA5LTAyDQoNCiMgQ2hpZWYgQ29tcGxhaW50DQpObyBjb21wbGFpbnRzLg0KDQojIEhpc3Rvcnkgb2YgUHJlc2VudCBJbGxuZXNzDQpHbGVubjANCiBpcyBhIDE4IHllYXItb2xkIG5vbi1oaXNwYW5pYyB3aGl0ZSBtYWxlLg0KDQojIFNvY2lhbCBIaXN0b3J5DQogUGF0aWVudCBoYXMgbmV2ZXIgc21va2VkLg0KIFBhdGllbnQgaWRlbnRpZmllcyBhcyBoZXRlcm9zZXh1YWwuDQoNClBhdGllbnQgY29tZXMgZnJvbSBhIG1pZGRsZSBzb2Npb2Vjb25vbWljIGJhY2tncm91bmQuDQogUGF0aWVudCBkaWQgbm90IGZpbmlzaCBoaWdoIHNjaG9vbC4NClBhdGllbnQgY3VycmVudGx5IGhhcyBCbHVlIENyb3NzIEJsdWUgU2hpZWxkLg0KDQojIEFsbGVyZ2llcw0KTm8gS25vd24gQWxsZXJnaWVzLg0KDQojIE1lZGljYXRpb25zDQpObyBBY3RpdmUgTWVkaWNhdGlvbnMuDQoNCiMgQXNzZXNzbWVudCBhbmQgUGxhbg0KUGF0aWVudCBpcyBwcmVzZW50aW5nIHdpdGggaG91c2luZyB1bnNhdGlzZmFjdG9yeSAoZmluZGluZyksIG9ubHkgcmVjZWl2ZWQgcHJpbWFyeSBzY2hvb2wgZWR1Y2F0aW9uIChmaW5kaW5nKSwgZnVsbC10aW1lIGVtcGxveW1lbnQgKGZpbmRpbmcpLCBzb2NpYWwgaXNvbGF0aW9uIChmaW5kaW5nKSwgc3RyZXNzIChmaW5kaW5nKS4gDQoNCiMjIFBsYW4NCg0K",
"contentType": "text/plain; charset=utf-8"
}],
"category": [{"coding": [
{
"system": "http://loinc.org",
"code": "34117-2",
"display": "History and physical note"
},
{
"system": "http://loinc.org",
"code": "51847-2",
"display": "Evaluation + Plan note"
}
]}],
"issued": "1978-09-02T17:57:46.296-04:00",
"resourceType": "DiagnosticReport",
"status": "final"
}
Then try to find the DiagnosticReport using the information (e.g. ID) for the Patient.
It appears the Patient and DiagnosticReport are now deleted, but you can use the patient search parameter. For example, https://r4.smarthealthit.org/DiagnosticReport?patient=3190019b-9001-4e31-a3c4-380b12b8002a currently returns a Bundle of 5 DiagnosticReports.
I'm trying to find a patient with a DiagnosticReport using the SmartHealthIt FHIR server at https://r4.smarthealthit.org.
Queries are based on the guide at https://www.hl7.org/fhir/search.html.
If I execute the following query I get the following result that includes a patient with the id 87a339d0-8cae-418e-89c7-8651e6aab3c6.
Query:
https://r4.smarthealthit.org/Patient?_type=DiagnosticReport&_summary=true
Result:
If I then query for the DiagnosticReport resources for this patient and try to filer for just the DiagnosticReport resources, I get a result that does not include any DiagnosticReport resources as shown below. Likewise, if I just retrieve the patient using https://r4.smarthealthit.org/Patient/87a339d0-8cae-418e-89c7-8651e6aab3c6, I get a response that does not include the text "DiagnosticReport" or "next" (in case the resource was paged).
How do I find the set of patients that have a DiagnosticReport on a FHIR server?
Query:
https://r4.smarthealthit.org/Patient/87a339d0-8cae-418e-89c7-8651e6aab3c6?_elements=DiagnosticReport
Result:
{
"resourceType": "Patient",
"id": "87a339d0-8cae-418e-89c7-8651e6aab3c6",
"meta": {
"versionId": "227",
"lastUpdated": "2022-07-22T03:04:04.165-04:00",
"tag": [
{
"system": "https://smarthealthit.org/tags",
"code": "synthea-5-2019"
}
]
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Generated by Synthea.Version identifier: v2.4.0-100-g26a4b936\n . Person seed: 911708758626700213 Population seed: 1559319163074</div>"
},
"extension": [
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race",
"extension": [
{
"url": "ombCategory",
"valueCoding": {
"system": "urn:oid:2.16.840.1.113883.6.238",
"code": "2106-3",
"display": "White"
}
},
{
"url": "text",
"valueString": "White"
}
]
},
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity",
"extension": [
{
"url": "ombCategory",
"valueCoding": {
"system": "urn:oid:2.16.840.1.113883.6.238",
"code": "2186-5",
"display": "Not Hispanic or Latino"
}
},
{
"url": "text",
"valueString": "Not Hispanic or Latino"
}
]
},
{
"url": "http://hl7.org/fhir/StructureDefinition/patient-mothersMaidenName",
"valueString": "Vonnie Kunde"
},
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex",
"valueCode": "F"
},
{
"url": "http://hl7.org/fhir/StructureDefinition/patient-birthPlace",
"valueAddress": {
"city": "Milton",
"state": "Massachusetts",
"country": "US"
}
},
{
"url": "http://synthetichealth.github.io/synthea/disability-adjusted-life-years",
"valueDecimal": 26.256072397468692
},
{
"url": "http://synthetichealth.github.io/synthea/quality-adjusted-life-years",
"valueDecimal": 29.743927602531308
}
],
"identifier": [
{
"system": "https://github.com/synthetichealth/synthea",
"value": "293ee354-f8ad-4345-b10c-759fdfdcc082"
},
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR",
"display": "Medical Record Number"
}
],
"text": "Medical Record Number"
},
"system": "http://hospital.smarthealthit.org",
"value": "293ee354-f8ad-4345-b10c-759fdfdcc082"
},
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "SS",
"display": "Social Security Number"
}
],
"text": "Social Security Number"
},
"system": "http://hl7.org/fhir/sid/us-ssn",
"value": "999-97-9098"
},
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "DL",
"display": "Driver's License"
}
],
"text": "Driver's License"
},
"system": "urn:oid:2.16.840.1.113883.4.3.25",
"value": "S99981121"
},
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "PPN",
"display": "Passport Number"
}
],
"text": "Passport Number"
},
"system": "http://standardhealthrecord.org/fhir/StructureDefinition/passportNumber",
"value": "X1974835X"
}
],
"name": [
{
"use": "official",
"family": "Kshlerin",
"given": [
"Danae"
],
"prefix": [
"Mrs."
]
},
{
"use": "maiden",
"family": "Graham",
"given": [
"Danae"
],
"prefix": [
"Mrs."
]
}
],
"telecom": [
{
"system": "phone",
"value": "555-182-4285",
"use": "home"
}
],
"gender": "female",
"birthDate": "1964-05-13",
"address": [
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/geolocation",
"extension": [
{
"url": "latitude",
"valueDecimal": 42.50128
},
{
"url": "longitude",
"valueDecimal": -70.897502
}
]
}
],
"line": [
"662 Ullrich Path Suite 61"
],
"city": "Salem",
"state": "Massachusetts",
"postalCode": "01907",
"country": "US"
}
],
"maritalStatus": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-MaritalStatus",
"code": "M",
"display": "M"
}
],
"text": "M"
},
"multipleBirthBoolean": false,
"communication": [
{
"language": {
"coding": [
{
"system": "urn:ietf:bcp:47",
"code": "en-US",
"display": "English"
}
],
"text": "English"
}
}
]
}
---EDIT-----------------------
I'm not seeing the patient id I originally used as an example now (the data could be paged and the order not consistent so it might be on a subsequent page).
This patient ID is coming up and gives the same behavior:
87a339d0-8cae-418e-89c7-8651e6aab3c6
The following query sometimes (often) includes the patient 87a339d0-8cae-418e-89c7-8651e6aab3c6:
https://r4.smarthealthit.org/Patient?_type=DiagnosticReport&_summary=true
The following query response contains neither the text "diag" nor "next"
https://r4.smarthealthit.org/Patient/87a339d0-8cae-418e-89c7-8651e6aab3c6?_elements=DiagnosticReport
The following query response contains neither the text "diag" nor "next"
https://r4.smarthealthit.org/Patient/87a339d0-8cae-418e-89c7-8651e6aab3c6
--- SECOND EDIT -------------------------
Not finding the DiagnosticReport in the Patient resource was just me being forgetful. You need to use the $everything locator as in:
https://r4.smarthealthit.org/Patient/87a339d0-8cae-418e-89c7-8651e6aab3c6/$everything
This does contain a "next" link.
I haven't yet confirmed that you eventually get to the DianosticReport resources using the next links (it seems to time out for the link below).
https://r4.smarthealthit.org/?_getpages=28d6d4cb-7f1e-4049-9cec-d3f44fba9dbf&_getpagesoffset=150&_count=50&_pretty=true&_bundletype=searchset
---THIRD EDIT --------------------------------
This patient can be used to confirm a patient with a DiagnosticReport exists:
d78af07c-9cb9-4f31-9b11-c45a28f2eec8
This url gives the first page of the patient that has a next link:
https://r4.smarthealthit.org/Patient/d78af07c-9cb9-4f31-9b11-c45a28f2eec8/$everything
This is the next link that gives the DiagnosticReport:
https://r4.smarthealthit.org/?_getpages=483b5a20-60e6-4007-8b63-3f7bbd366b18&_getpagesoffset=50&_count=50&_pretty=true&_bundletype=searchset
Here is a DiagnosticReport from the response.
"resource": {
"resourceType": "DiagnosticReport",
"id": "ca42703d-054c-4fc5-aaa5-c9d4f9688e89",
"meta": {
"versionId": "4",
"lastUpdated": "2021-04-06T03:13:59.601-04:00",
"tag": [
{
"system": "https://smarthealthit.org/tags",
"code": "synthea-5-2019"
}
]
},
"status": "final",
"category": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0074",
"code": "LAB",
"display": "Laboratory"
}
]
}
],
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "57698-3",
"display": "Lipid Panel"
}
],
"text": "Lipid Panel"
},
"subject": {
"reference": "Patient/d78af07c-9cb9-4f31-9b11-c45a28f2eec8"
},
"encounter": {
"reference": "Encounter/2e0cc97b-c879-4762-bb5c-7127e44d7daa"
},
"effectiveDateTime": "2018-09-17T15:29:24+00:00",
"issued": "2018-09-17T15:29:24.181+00:00",
"result": [
{
"reference": "Observation/b512ea5d-c4c2-49e4-9eb1-30b2579136c4",
"display": "Total Cholesterol"
},
{
"reference": "Observation/3acb284d-e861-4db2-bbbc-b1522129df3c",
"display": "Triglycerides"
},
{
"reference": "Observation/9d3359e5-58e7-4c3c-8cfd-8cb6397dbcf7",
"display": "Low Density Lipoprotein Cholesterol"
},
{
"reference": "Observation/a708a2a4-8d9a-4869-a432-c5f09a46e67f",
"display": "High Density Lipoprotein Cholesterol"
}
]
},
For a list of patients having a DiagnosticReport perhaps you could just get a list of all DiagnosticReports because this will contain the references to the patients for each of the DiagnosticReport found.
To do so you can use the query:
https://r4.smarthealthit.org/DiagnosticReport?_summary=true
In the resultset, you will see references to patients e.g.
"subject": {
"reference": "Patient/15661112-796c-460c-bf7a-6b297e33f113"
},
If you already knew the patient id e.g. 87a339d0-8cae-418e-89c7-8651e6aab3c6, you could just do:
https://r4.smarthealthit.org/DiagnosticReport?subject=87a339d0-8cae-418e-89c7-8651e6aab3c6
RE: _type parameter
Just a note on what you tried so far, the query using _type parameters is not quite right because you use type when query against the base endpoint i.e. without specifying the any type, so:
Query: https://r4.smarthealthit.org/Patient?_type=DiagnosticReport&_summary=true
Should actually have been as below, without the Patient type in the query:
Query: https://r4.smarthealthit.org?_type=DiagnosticReport&_summary=true
Read more about the _type parameter here: https://www.hl7.org/fhir/search.html#_type
RE: _elements parameter
Also, the _elements parameter is not meant for resources but for specifying base elements defined in the resource. Your query that has _elements=DiagnosticReport is not correct because the is no such element on the Patient resource, hence why you may be getting results that are not consistent.
Hope that helps?
How do I add the below to an R4 Patient?
"search": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/match-grade",
"valueCode": "certain"
}
],
"mode": "match",
"score": 1.0
}
The objects that were under stu2 and stu3 (I think) have been deprecated.
DSTU3 and Later
// Create an example patient
Patient patient = new Patient();
patient.addIdentifier().setUse(Identifier.IdentifierUse.OFFICIAL).setSystem("urn:example").setValue("7000135");
// Create an extension
Extension ext = new Extension();
ext.setUrl("http://example.com/extensions#someext");
ext.setValue(new DateTimeType("2011-01-02T11:13:15"));
// Add the extension to the resource
patient.addExtension(ext);
Full "response" json from patient match below (sample data, not real data !! )
{
"resourceType": "Bundle",
"id": "94897c77-4120-482f-bdb4-4c8b9a71ade1",
"meta": {
"versionId": "1",
"lastUpdated": "2020-11-24T08:45:49.445-05:00"
},
"type": "searchset",
"total": 1,
"link": [
{
"relation": "self",
"url": "http://wildfhir4.aegis.net/fhir4-0-0/Patient/$match?"
}
],
"entry": [
{
"fullUrl": "http://wildfhir4.aegis.net/fhir4-0-0/Patient/9126db824dcf4d5ab3f68e63bd5eaced",
"resource": {
"resourceType": "Patient",
"id": "9126db824dcf4d5ab3f68e63bd5eaced",
"meta": {
"versionId": "1",
"lastUpdated": "2020-09-03T09:03:28.193-04:00",
"tag": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-ActReason",
"code": "HTEST",
"display": "test health data"
}
]
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table><tbody><tr><td>Name</td><td>Peter James \n <b>Chalmers</b> ("Jim") \n </td></tr><tr><td>Address</td><td>534 Erewhon, Pleasantville, Vic, 3999</td></tr><tr><td>Contacts</td><td>Home: unknown. Work: (03) 5555 6473</td></tr><tr><td>Id</td><td>MRN: 12345 (Acme Healthcare)</td></tr></tbody></table></div>"
},
"identifier": [
{
"use": "usual",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
},
"system": "urn:oid:1.2.36.146.595.217.0.1",
"value": "12345",
"period": {
"start": "2001-05-06"
},
"assigner": {
"display": "Acme Healthcare"
}
}
],
"active": true,
"name": [
{
"use": "official",
"family": "Chalmers",
"given": [
"Peter",
"James"
]
},
{
"use": "usual",
"given": [
"Jim"
]
},
{
"use": "maiden",
"family": "Windsor",
"given": [
"Peter",
"James"
],
"period": {
"end": "2002"
}
}
],
"telecom": [
{
"use": "home"
},
{
"system": "phone",
"value": "(03) 5555 6473",
"use": "work",
"rank": 1
},
{
"system": "phone",
"value": "(03) 3410 5613",
"use": "mobile",
"rank": 2
},
{
"system": "phone",
"value": "(03) 5555 8834",
"use": "old",
"period": {
"end": "2014"
}
}
],
"gender": "male",
"birthDate": "1974-12-25",
"_birthDate": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/patient-birthTime",
"valueDateTime": "1974-12-25T14:35:45-05:00"
}
]
},
"deceasedBoolean": false,
"address": [
{
"use": "home",
"type": "both",
"text": "534 Erewhon St PeasantVille, Rainbow, Vic 3999",
"line": [
"534 Erewhon St"
],
"city": "PleasantVille",
"district": "Rainbow",
"state": "Vic",
"postalCode": "3999",
"period": {
"start": "1974-12-25"
}
}
],
"contact": [
{
"relationship": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0131",
"code": "N"
}
]
}
],
"name": {
"family": "du Marché",
"_family": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/humanname-own-prefix",
"valueString": "VV"
}
]
},
"given": [
"Bénédicte"
]
},
"telecom": [
{
"system": "phone",
"value": "+33 (237) 998327"
}
],
"address": {
"use": "home",
"type": "both",
"line": [
"534 Erewhon St"
],
"city": "PleasantVille",
"district": "Rainbow",
"state": "Vic",
"postalCode": "3999",
"period": {
"start": "1974-12-25"
}
},
"gender": "female",
"period": {
"start": "2012"
}
}
],
"managingOrganization": {
"reference": "Organization/1"
}
},
"search": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/match-grade",
"valueCode": "certain"
}
],
"mode": "match",
"score": 1.0
}
}
]
}
APPEND: I found this:
https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-structures-r4/org/hl7/fhir/r4/model/codesystems/MatchGrade.html
That extension isn't allowed on Patient. It's defined with a context of Bundle.entry.search. It's not a characteristic of the patient themselves, it's a characteristic of a particular entry in a search result based on a specific set of search criteria. The same Patient instance might well be a good result on one search and a poor result on a different search. So to add the extension, you'd have to add it on a 'search' object, not patient.
Ok.
Here it is. The primary objects were inner/nested objects under Bundle....thus why I didn't see them early. (example : Bundle.BundleEntrySearchComponent)
// a java example with the import statements. #shocking!
//import org.hl7.fhir.r4.model.Bundle;
//import org.hl7.fhir.r4.model.CodeType;
//import org.hl7.fhir.r4.model.Extension;
//import org.hl7.fhir.r4.model.Patient;
//import org.hl7.fhir.r4.model.codesystems.MatchGrade;
//import java.util.Collections;
Bundle innerBundle = new Bundle();
innerBundle.setType(Bundle.BundleType.SEARCHSET);
innerBundle.setTotal(1);
Patient pat = new Patient();
HumanName hn = new HumanName();
hn.setFamily("Smith");
p.setName(Collections.singletonList(hn));
Bundle.BundleEntrySearchComponent besc = new Bundle.BundleEntrySearchComponent();
besc.setScore(0.88);
besc.setMode(Bundle.SearchEntryMode.MATCH);
Bundle.BundleEntryComponent bec = new Bundle.BundleEntryComponent();
Extension matchGradeExtension = besc.addExtension();
matchGradeExtension.setUrl("http://hl7.org/fhir/StructureDefinition/match-grade");
matchGradeExtension.setValue(new CodeType(MatchGrade.PROBABLE.toCode()));
bec.setResource(pat);
bec.setSearch(besc);
innerBundle.setEntry(Collections.singletonList(bec));
Json looks like this:
{
"resourceType": "Bundle",
"type": "searchset",
"total": 1,
"entry": [
{
"resource": {
"resourceType": "Patient",
"name": [
{
"family": "Smith"
}
]
},
"search": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/match-grade",
"valueCode": "certain"
}
],
"mode": "match",
"score": 0.88
}
}
]
}
How can I get DocumentReference for particular document from DocumentManifest list of documents?
Here is an example of returned DocumentManifest
{
"title": {
},
"id": {
},
"updated": {
},
"content": {
"type": {
"#id": "urn:uuid:xxxxxx-xxxx-xxxx-xxxx-xxxxxxx",
"text": "Patient Document List"
},
"resourceType": "DocumentManifest",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Some Test ORG</div>"
},
"contained": {
"resourceType": "Patient",
"identifier": {
"use": "official",
"system": "",
"value": "12345678987654321"
}
},
"subject": {
"reference": "Patient Documents"
},
"recipient": {
"organization": {
"display": "Some Test ORG"
}
},
"created": "2018-02-09T13:26:53-07:00",
"status": "current",
"content": {
"reference": [
"Binary/DOCUMENT-1000123",
"Binary/DOCUMENT-1000124",
"Binary/DOCUMENT-1000125"
]
}
}
}
I have tried to use something like
GET [service-url]/DocumentReference/?_query=generate&uri=[service-url]/BINARY/DOCUMENT-1000125
but I had no luck.
That DocumentManifest is not pointing at a DocumentReference. It is point at a document.
FYI: What you have shown is not compliant with IHE-MHD use of DocumentReference/DocumentManifest/Binary.