Patient context

This commit is contained in:
2026-02-04 01:53:35 +01:00
parent 0e842eb0fb
commit d83291831c
10 changed files with 249106 additions and 231928 deletions

View File

@@ -24,6 +24,15 @@ from eb_dashboard_constants import CONFIG_FOLDER_NAME
thread_local_storage = threading.local()
def run_with_context(func, context, *args, **kwargs):
"""
Wrapper to set thread-local context before running a function in a new thread.
Useful for ThreadPoolExecutor where context is lost.
"""
thread_local_storage.current_patient_context = context
return func(*args, **kwargs)
# These will be set/accessed from the main module
httpx_clients = {}
_clients_lock = threading.Lock()