The question being asked is quite general, and the Cerner CDS hooks tutorial should pretty much get you there, but if you want to view a snippet of my code where I also did this (in Python), please see below. However, not all the context to this code is included. Patient observations/conditions are fetched with GET HTTP methods, filtered based upon LOINC codes.
# create the patient view card
def getPatientViewCard(currentPatient, to_display):
full_name = currentPatient.first_name + ' ' + currentPatient.last_name
patient_view_card = {
'cards' : [
{
'summary' : f'{full_name} is displayed in the card below',
'detail' : f'{to_display}',
'indicator' : 'info',
'source' : {
'label' : 'My App',
'url' : '
https://www.urltomyapp.com/'
},
'links' : [
{
'label' : 'Go to my App',
'url' : f'{config_setup["general"]["smart_app_url"]}',
'type' : 'smart'
}
]
}
]
}
return patient_view_card
# create the text to be displayed in the patient view card
def obtainCardText(currentPatient, patientObservations, patientChartData):
to_display = 'The patient has the following diagnoses:'
if len(patientObservations.conditions) > 0:
to_display += f'<br> • <b>Conditions:</b> {patientObservations.conditions}'
if len(patientObservations.medications) > 0:
to_display += f'<br> • <b>Medications:</b> {patientObservations.medications}'
if len(patientObservations.allergies) > 0:
to_display += f'<br> • <b>Allergies:</b> {patientObservations.allergies}'
to_display += '\n\n '
return to_display