Clients
Bases: BaseClient
Source code in healthchain/sandbox/clients/ehr.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
|
__init__(func, workflow, strategy, timeout=10.0)
Initializes the EHRClient with a data generator function and optional workflow and use case. Should be a subclass of BaseUseCase. Example - ClinicalDecisionSupport()
PARAMETER | DESCRIPTION |
---|---|
func
|
A function to generate data for requests.
TYPE:
|
workflow
|
The workflow context to apply to the data generator.
TYPE:
|
strategy
|
The strategy object to construct requests based on the generated data.
TYPE:
|
timeout
|
The maximum time in seconds to wait for a response from the server. This parameter determines how long the client will wait before considering a request timed out.
TYPE:
|
Source code in healthchain/sandbox/clients/ehr.py
generate_request(*args, **kwargs)
Generates a request using the data produced by the data generator function, and appends it to the internal request queue.
Parameters:
*args (Any): Positional arguments passed to the data generator function.
**kwargs (Any): Keyword arguments passed to the data generator function.
Raises:
ValueError: If the use case is not configured.
Source code in healthchain/sandbox/clients/ehr.py
send_request(url)
async
Sends all queued requests to the specified URL and collects the responses.
Parameters:
url (str): The URL to which the requests will be sent.
Returns:
List[dict]: A list of JSON responses from the server.
Notes:
This method logs errors rather than raising them, to avoid interrupting the batch processing of requests.