EPIC API Client
Installation
use pip install EPIC-API-Client.
see example.py for usage and setup .env accordingly.
tip: use uv pip for faster pip (pip install uv
)!
How to use
Testing on EPIC sandbox
To familiarize, play around and test out the functionality of this package, you can use the EPIC sandbox. To use this sandbox, you only need to register an app at vendor services of EPIC, enable the EPIC sandbox and you're done! In the environment file, leave the url blanc, the epic api client will then automatically refer requests to the EPIC sandbox.
Using this wrapper within Nebula
Nebula uses unix websockets to send web requests instead of simple http requests. This capability has been added to this wrapper which can be activated setting the use_unix_socket=True argument:
client = EPICClient(client_id=client_id, jwt_generator=jwt_generator, base_url=base_url, use_unix_socket=True)
Make sure to setup your Nebula environment as if you would use the Webcallout functionality from EPIC itself.
still to write about and implement
- Using FHIR API functions
- Using internal API functions (vendor services)
- authentication methods OAUTH but also basic token?
- how is this wrapper organized and what are base vs extensions?
If your favorite function is not yet implemented, let me know, I will do this for you!
Troubleshooting
Implemented functions
- Internal API functions
- handle_external_model_scores
- set_smart_data_values
- get_smart_data_values
- Internal API extention functions
- FHIR API functions
- get_metadata
- patient_read
- patient_search
- encounter_read
- encounter_search
- document_reference_read
- document_reference_search
- document_reference_create
- observation_create
- condition_read
- condition_search
- condition_create
- FHIR API extention functions
- patient_search_MRN
- mrn_to_FHIRid
handle_external_model_scores
Send predictive model scores back to the Epic Cognitive Computing Platform for filing.
:param model_id: str, the ECCP model ID the scores are for
:param job_id: str, the autogenerated job ID for the evaluation on ECCP
:param output_type: str, the type of output for the predictive model
:param server_version: str, the server version of the predictive context
:param session_id: str, the session ID of the predictive context
:param entity_ids: list, a list of dictionaries with ID and Type for the entity
:param outputs: dict, the output values of the predictive model
:param raw: dict, optional, raw features used to calculate the scores
:param predictive_context: dict, optional, additional context information for the predictive model
:return: dict, the response from the Epic Cognitive Computing Platform
example outputs
{
"Output_Name": {
"Scores": {
"Score_Name_1" : { "Values": [val1, val2,.., valN] },
"Score_Name_2" : { "Values": [val1, val2,.., valN] }
},
"Features": {
"Feature1": { "Contributions":[contrib1, contrib2, ..., contribN]},
"Feature2": { "Contributions":[contrib1, contrib2, ..., contribN]}
}
}
}
example raw
{
"Additional_Feature_1" : { "Values": [val1, val2,.., valN] },
"Additional_Feature_2" : { "Values": [val1, val2,.., valN] }
}