imednet_tui package¶
Modular terminal user interface plugin for iMednet.
Submodules¶
imednet_tui.app module¶
Terminal user interface application for iMednet.
- class imednet_tui.app.DashboardScreen[source]¶
Bases:
Screen[None]Main interactive study exploration dashboard.
- CSS: ClassVar[str] = '\n DashboardScreen {\n layout: vertical;\n }\n\n #dashboard-grid {\n layout: grid;\n grid-size: 3 2;\n grid-columns: 1fr 1fr 2fr;\n grid-rows: 1fr 1fr;\n height: 1fr;\n }\n\n SubjectTable {\n height: 1fr;\n }\n\n #studies-box {\n border: solid green;\n }\n\n #sites-box {\n border: solid blue;\n }\n\n #subjects-box {\n border: solid magenta;\n }\n\n #bottom-pane {\n column-span: 3;\n height: 100%;\n border-top: solid white;\n }\n\n #bottom-pane > ContentSwitcher {\n height: 1fr;\n }\n\n #bottom-pane TabPane {\n height: 1fr;\n padding: 0;\n }\n\n #bottom-pane JobMonitor,\n #bottom-pane LogViewer {\n height: 1fr;\n }\n\n DashboardScreen.compact #dashboard-grid {\n grid-size: 2 3;\n grid-columns: 1fr 1fr;\n grid-rows: 1fr 1fr 2fr;\n }\n\n DashboardScreen.compact #subjects-box {\n column-span: 2;\n }\n\n DashboardScreen.compact #bottom-pane {\n column-span: 2;\n }\n\n #truncation-notice {\n display: none;\n height: 1;\n max-height: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n text-wrap: nowrap;\n padding: 0 1;\n background: $warning 20%;\n color: $text;\n }\n\n #truncation-notice.visible {\n display: block;\n }\n\n /* High contrast mode styles */\n DashboardScreen.high-contrast {\n background: #000000;\n color: #FFFFFF;\n }\n\n DashboardScreen.high-contrast #truncation-notice {\n height: 1;\n max-height: 1;\n background: #FFFFFF;\n color: #000000;\n border: none;\n }\n\n DashboardScreen.high-contrast #studies-box {\n border: heavy white;\n background: black;\n color: white;\n }\n\n DashboardScreen.high-contrast #sites-box {\n border: heavy white;\n background: black;\n color: white;\n }\n\n DashboardScreen.high-contrast #subjects-box {\n border: heavy white;\n background: black;\n color: white;\n }\n\n DashboardScreen.high-contrast #bottom-pane {\n border-top: heavy white;\n background: black;\n color: white;\n }\n\n DashboardScreen.high-contrast ListItem {\n color: white;\n background: black;\n }\n\n DashboardScreen.high-contrast ListItem:focus {\n background: white;\n color: black;\n }\n\n DashboardScreen.high-contrast DataTable {\n color: white;\n background: black;\n }\n\n DashboardScreen.high-contrast DataTable > .datatable--header {\n background: black;\n color: white;\n text-style: bold;\n }\n\n DashboardScreen.high-contrast DataTable > .datatable--cursor {\n background: white;\n color: black;\n }\n\n DashboardScreen.high-contrast JobMonitor {\n border: none;\n background: #000000;\n color: #FFFFFF;\n }\n\n DashboardScreen.high-contrast LogViewer,\n DashboardScreen.high-contrast LogViewer:focus {\n border: heavy white;\n background: #000000;\n color: #FFFFFF;\n text-opacity: 100%;\n background-tint: #000000 0%;\n }\n\n DashboardScreen.high-contrast JobMonitor #batch_id_input {\n background: black;\n color: white;\n }\n\n DashboardScreen.high-contrast JobMonitor #batch_id_input:focus {\n background: black;\n color: white;\n text-style: bold underline;\n }\n\n DashboardScreen.high-contrast Input > .input--placeholder {\n color: white;\n background: black;\n }\n\n DashboardScreen.high-contrast Input > .input--cursor {\n background: white;\n color: black;\n }\n\n DashboardScreen.high-contrast JobMonitor #job_monitor_notice {\n background: black;\n color: white;\n }\n\n DashboardScreen.high-contrast JobMonitor #job_detail_panel,\n DashboardScreen.high-contrast JobMonitor #job_detail_panel:focus,\n DashboardScreen.high-contrast JobMonitor #job_detail_panel > #job_detail_body {\n background: #000000;\n color: #FFFFFF;\n }\n\n DashboardScreen.high-contrast JobMonitor #job_detail_panel {\n border-left: heavy white;\n }\n\n DashboardScreen.high-contrast JobMonitor #job_detail_panel:focus {\n border-left: double white;\n }\n\n DashboardScreen.high-contrast Tabs {\n background: black;\n color: white;\n }\n\n DashboardScreen.high-contrast Tab {\n background: black;\n color: white;\n }\n\n DashboardScreen.high-contrast Tab:focus {\n background: white;\n color: black;\n }\n '¶
Inline CSS, useful for quick scripts. Rules here take priority over CSS_PATH.
Note
This CSS applies to the whole app.
- __init__(sdk, *, initial_study_key=None, initial_batch_ids=None, **kwargs)[source]¶
Initialize the DashboardScreen.
- Parameters:
sdk (ImednetFacade | AsyncImednetFacade) – Active iMednet SDK facade instance.
initial_study_key (str | None) – Optional initial study key to select upon mount.
initial_batch_ids (Sequence[str] | None) – Optional initial batch IDs to register upon mount.
**kwargs (Any) – Additional screen arguments.
- Return type:
None
- absolute_offset: Offset | None¶
Force an absolute offset for the widget (used by tooltips).
- active_phi_registry()[source]¶
Resolve the isolated
SensitivityRegistryfor the active study.- Return type:
- bindings_updated_signal: Signal[Screen]¶
A signal published when the bindings have been updated
- clear_site_filter()[source]¶
Clear any active site filter and reload unfiltered study subjects.
- Return type:
bool
- compose()[source]¶
Compose children widgets for the dashboard screen.
- Yields:
Header, status banner, containers, grid panels, tab panes, and footer.
- Return type:
Iterable[Widget]
- invalidate_phi_cache()[source]¶
Clear cached per-study
phi_fieldsregistries on explicit refresh.- Return type:
None
- async load_all_data()[source]¶
Fetch remaining pages for truncated or active Study, Site, and Subject views.
- Return type:
None
- lock¶
asyncio lock to be used to synchronize the state of the widget.
Two different tasks might call methods on a widget at the same time, which might result in a race condition. This can be fixed by adding async with widget.lock: around the method calls.
- message_signal: Signal[Message]¶
Subscribe to this signal to be notified of all messages sent to this widget.
This is a fairly low-level mechanism, and shouldn’t replace regular message handling.
- on_mount()[source]¶
Sync high-contrast mode, attach SDK log handler, and apply initial CLI options.
- Return type:
None
- on_resize(event)[source]¶
Reflow dashboard grid responsively when terminal dimensions change.
- Parameters:
event (Resize) – Textual resize event carrying updated viewport dimensions.
- Return type:
None
- on_site_list_site_selected(message)[source]¶
Handle site selection by filtering displayed subjects or toggling off active filter.
- Parameters:
message (SiteSelected) – Site selection event containing site details.
- Return type:
None
- on_study_list_study_selected(message)[source]¶
Handle study selection by populating sites, subjects, and jobs.
- Parameters:
message (StudySelected) – Study selection event containing study details.
- Return type:
None
- on_unmount()[source]¶
Detach the SDK/TUI log handler and restore original logger settings on unmount.
- Return type:
None
- refresh_truncation_notice()[source]¶
Update the dashboard truncation status banner based on widget state.
- Return type:
None
- screen_layout_refresh_signal: Signal[Screen]¶
The signal that is published when the screen’s layout is refreshed.
- text_selection_started_signal: Signal[Screen]¶
A signal published when text selection has started.
- class imednet_tui.app.ImednetTuiApp[source]¶
Bases:
App[None]The iMednet TUI Application.
- BINDINGS: ClassVar[list[BindingType]] = [('q', 'quit', 'Quit'), ('d', 'toggle_dark', 'Dark Mode'), ('h', 'toggle_high_contrast', 'High Contrast'), ('r', 'refresh_data', 'Refresh'), ('a', 'load_all', 'Load All'), ('escape', 'handle_escape', 'Clear Filter')]¶
The default key bindings.
- CSS: ClassVar[str] = '\n Screen {\n background: $surface;\n }\n\n .high-contrast {\n background: #000000;\n color: #FFFFFF;\n }\n\n .high-contrast #truncation-notice {\n height: 1;\n max-height: 1;\n background: #FFFFFF;\n color: #000000;\n border: none;\n }\n\n .high-contrast LogViewer,\n .high-contrast LogViewer:focus {\n background: #000000;\n color: #FFFFFF;\n text-opacity: 100%;\n background-tint: #000000 0%;\n }\n\n .high-contrast #job_detail_panel,\n .high-contrast #job_detail_panel:focus,\n .high-contrast #job_detail_panel > #job_detail_body {\n background: #000000;\n color: #FFFFFF;\n }\n\n .high-contrast #job_detail_panel {\n border-left: heavy white;\n }\n\n .high-contrast #job_detail_panel:focus {\n border-left: double white;\n }\n '¶
Inline CSS, useful for quick scripts. This is loaded after CSS_PATH, and therefore takes priority in the event of a specificity clash.
- __init__(sdk, *, high_contrast=None, study_key=None, batch_ids=None, **kwargs)[source]¶
Initialize the iMednet TUI application.
- Parameters:
sdk (ImednetFacade | AsyncImednetFacade) – Active iMednet SDK facade instance.
high_contrast (bool | None) – Optional explicit high-contrast toggle; defaults to reading
IMEDNET_HIGH_CONTRAST=1fromos.environwithout modifying it.study_key (str | None) – Optional initial study key to select on launch.
batch_ids (Sequence[str] | None) – Optional initial batch IDs to register in the Jobs tab.
**kwargs (Any) – Additional application arguments.
- Return type:
None
- action_handle_escape()[source]¶
Exit batch input, close the job detail panel on the Jobs tab, or clear site filter.
- Return type:
None
- action_load_all()[source]¶
Load all remaining items across bounded Study, Site, and Subject views.
- Return type:
None
- action_refresh_data()[source]¶
Refresh studies and any active study/site panes on the dashboard screen.
- Return type:
None
- action_toggle_high_contrast()[source]¶
Toggle accessibility high contrast mode without mutating
os.environ.- Return type:
None
- animation_level: AnimationLevel¶
Determines what type of animations the app will display.
See [textual.constants.TEXTUAL_ANIMATIONS][textual.constants.TEXTUAL_ANIMATIONS].
- app_resume_signal: Signal[App]¶
The signal that is published when the app is resumed after a suspend.
When the app is resumed after a [App.suspend][textual.app.App.suspend] call this signal will be [published][textual.signal.Signal.publish]; [subscribe][textual.signal.Signal.subscribe] to this signal to perform work after the app has resumed.
- app_suspend_signal: Signal[App]¶
The signal that is published when the app is suspended.
When [App.suspend][textual.app.App.suspend] is called this signal will be [published][textual.signal.Signal.publish]; [subscribe][textual.signal.Signal.subscribe] to this signal to perform work before the suspension takes place.
- check_action(action, parameters)[source]¶
Suppress single-key global actions while typing inside an Input widget.
- Parameters:
action (str) –
parameters (tuple[object, ...]) –
- Return type:
bool | None
- cursor_position¶
The position of the terminal cursor in screen-space.
This can be set by widgets and is useful for controlling the positioning of OS IME and emoji popup menus.
- hover_over: Widget | None¶
The first widget with a hover style under the mouse.
- message_signal: Signal[Message]¶
Subscribe to this signal to be notified of all messages sent to this widget.
This is a fairly low-level mechanism, and shouldn’t replace regular message handling.
- mode_change_signal: Signal[str]¶
A signal published when the current screen mode changes.
- mouse_over: Widget | None¶
The widget directly under the mouse.
- mouse_position¶
The current screen-space mouse position.
- mouse_position_high_resolution: tuple[float, float]¶
A high resolution (floating point) mouse position. If supported by the terminal, this may be more granular than mouse_position
- on_mount()[source]¶
Configure application title, contrast mode, and dashboard screen on mount.
- Return type:
None
- screen_change_signal: Signal[Screen]¶
A signal published when the current screen changes.
- scroll_sensitivity_x: float¶
Number of columns to scroll in the X direction with wheel or trackpad.
- scroll_sensitivity_y: float¶
Number of lines to scroll in the Y direction with wheel or trackpad.
- supports_smooth_scrolling: bool¶
Does the terminal support smooth scrolling?
- theme_changed_signal: Signal[Theme]¶
Signal that is published when the App’s theme is changed.
Subscribers will receive the new theme object as an argument to the callback.
- theme_variables: dict[str, str]¶
Variables generated from the current theme.
- use_command_palette: bool¶
A flag to say if the application should use the command palette.
If set to False any call to [action_command_palette][textual.app.App.action_command_palette] will be ignored.
- class imednet_tui.app.JobDetailPanel[source]¶
Bases:
VerticalScrollFocusable, keyboard-scrollable split pane displaying sanitized job metadata and errors.
- __init__(content='', *, markup=False, **kwargs)[source]¶
Initialize the scrollable job detail pane.
- Parameters:
content (str) –
markup (bool) –
kwargs (Any) –
- Return type:
None
- absolute_offset: Offset | None¶
Force an absolute offset for the widget (used by tooltips).
- allow_focus()[source]¶
Allow keyboard focus only when visible inside an active displayed tab pane.
- Return type:
bool
- can_focus: bool = True¶
Widget may receive focus.
- can_focus_children: bool = False¶
Widget’s children may receive focus.
- compose()[source]¶
Compose inner Static body inside the scrollable viewport.
- Return type:
Iterable[Widget]
- lock¶
asyncio lock to be used to synchronize the state of the widget.
Two different tasks might call methods on a widget at the same time, which might result in a race condition. This can be fixed by adding async with widget.lock: around the method calls.
- message_signal: Signal[Message]¶
Subscribe to this signal to be notified of all messages sent to this widget.
This is a fairly low-level mechanism, and shouldn’t replace regular message handling.
- class imednet_tui.app.JobMonitor[source]¶
Bases:
ContainerWidget registering, polling, and displaying study background jobs.
- DEFAULT_CSS: ClassVar[str] = '\n JobMonitor {\n layout: vertical;\n height: 1fr;\n background: $surface;\n border: none;\n }\n\n JobMonitor #batch_id_input {\n height: 1;\n border: none;\n padding: 0 1;\n background: $boost;\n color: $text;\n }\n\n JobMonitor #batch_id_input:focus {\n background: $panel;\n text-style: bold;\n }\n\n JobMonitor #job_monitor_notice {\n height: 1;\n max-height: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n text-wrap: nowrap;\n padding: 0 1;\n color: $text;\n }\n\n JobMonitor #job_split_pane {\n layout: horizontal;\n width: 1fr;\n height: 1fr;\n }\n\n JobMonitor #job_table {\n width: 1fr;\n height: 1fr;\n }\n\n JobMonitor #job_detail_panel {\n display: none;\n width: 1fr;\n height: 1fr;\n overflow-x: auto;\n overflow-y: auto;\n padding: 0 1;\n background: $panel;\n color: $text;\n border-left: solid $primary;\n }\n\n JobMonitor #job_detail_panel:focus {\n border-left: double $accent;\n }\n\n JobMonitor #job_detail_panel > #job_detail_body {\n width: 1fr;\n height: auto;\n min-height: 100%;\n }\n\n JobMonitor #job_detail_panel.visible {\n display: block;\n }\n '¶
Default TCSS.
- __init__(sdk, *, max_concurrency=5, phi_cache=None, **kwargs)[source]¶
Initialize the JobMonitor widget.
- Parameters:
sdk (ImednetFacade | AsyncImednetFacade) – Active iMednet SDK facade instance.
max_concurrency (int) – Maximum number of concurrent status polling requests.
phi_cache (_StudyPhiRegistryCache | None) – Optional shared per-study
SensitivityRegistrycache.**kwargs (Any) – Additional widget arguments.
- Return type:
None
- absolute_offset: Offset | None¶
Force an absolute offset for the widget (used by tooltips).
- close_job_detail()[source]¶
Close
#job_detail_panelif open; return True when a panel was closed.- Return type:
bool
- compose()[source]¶
Compose inline batch input, status notice, and bounded horizontal split pane.
- Return type:
Iterable[Widget]
- property is_polling_active: bool¶
Return True when the background refresh timer is unpaused.
- lock¶
asyncio lock to be used to synchronize the state of the widget.
Two different tasks might call methods on a widget at the same time, which might result in a race condition. This can be fixed by adding async with widget.lock: around the method calls.
- message_signal: Signal[Message]¶
Subscribe to this signal to be notified of all messages sent to this widget.
This is a fairly low-level mechanism, and shouldn’t replace regular message handling.
- on_input_submitted(event)[source]¶
Validate and stage/register batch IDs submitted from
#batch_id_input.- Parameters:
event (Submitted) –
- Return type:
None
- async refresh_jobs(*, retry_placeholders=False)[source]¶
Poll active jobs and update the job table and summary for the active study.
- Parameters:
retry_placeholders (bool) – When True, re-poll cached placeholder entries (such as
NOT_FOUND) during manual user-initiated refreshes.- Return type:
None
- render()[source]¶
Return summary text representation for non-composited inspection.
- Return type:
Text
- async resolve_job_result(job_id, *, study_key=None)[source]¶
Resolve
resultUrlonce on demand for a terminal tracked job via the SPI facade.- Parameters:
job_id (str) –
study_key (str | None) –
- Return type:
bool
- schedule_refresh(*, retry_placeholders=False)[source]¶
Schedule job polling through a single exclusive worker group when mounted.
- Parameters:
retry_placeholders (bool) –
- Return type:
None
- property semaphore: Semaphore¶
Asyncio semaphore bounding simultaneous job status queries.
- set_study(study_key)[source]¶
Set the active study key, display cached study jobs, and trigger refresh.
- Parameters:
study_key (str) – Active study key to track jobs for.
- Return type:
None
- toggle_job_detail(job_id)[source]¶
Toggle inline
#job_detail_panelforjob_id; return True when open.- Parameters:
job_id (str) –
- Return type:
bool
- track_job(job_id, study_key=None)[source]¶
Register a known job ID to monitor for the specified or active study.
- Parameters:
job_id (str) – Known background job or batch identifier.
study_key (str | None) – Optional study key override; defaults to
current_study_key.
- Return type:
None
- track_jobs(job_ids, *, study_key=None, refresh=True)[source]¶
Register one or more batch/job IDs for a study.
- Parameters:
job_ids (Sequence[str] | str) – Batch ID string or sequence of batch IDs to register.
study_key (str | None) – Study key to partition the IDs under; defaults to active study.
refresh (bool) – When True, trigger an immediate poll if the study is active.
- Returns:
Normalized batch IDs processed from
job_ids.- Return type:
list[str]
- property tracked_job_ids: list[str]¶
Return tracked job IDs in registration order for the active study.
- untrack_job(job_id, study_key=None)[source]¶
Remove a tracked batch/job ID from the specified or active study.
- Parameters:
job_id (str) – Batch or job identifier to stop tracking.
study_key (str | None) – Optional study key override; defaults to
current_study_key.
- Returns:
True if a tracked job entry was removed; False otherwise.
- Return type:
bool
- class imednet_tui.app.JobTable[source]¶
Bases:
DataTable[Text]Keyboard-scrollable table displaying tracked background study jobs.
- BINDINGS: ClassVar[list[BindingType]] = [('enter,space', 'toggle_job_detail', 'Inspect Job'), ('delete,backspace', 'untrack_selected_job', 'Untrack Job')]¶
- Key(s) | Description |:- | :- |enter | Select cells under the cursor. |up | Move the cursor up. |down | Move the cursor down. |right | Move the cursor right. |left | Move the cursor left. |pageup | Move one page up. |pagedown | Move one page down. |ctrl+home | Move to the top. |ctrl+end | Move to the bottom. |home | Move to the home position (leftmost column). |end | Move to the end position (rightmost column). |
- __init__(**kwargs)[source]¶
Initialize the JobTable widget.
- Parameters:
kwargs (Any) –
- Return type:
None
- absolute_offset: Offset | None¶
Force an absolute offset for the widget (used by tooltips).
- action_toggle_job_detail()[source]¶
Toggle the inline
#job_detail_panelfor the currently highlighted job row.- Return type:
None
- action_untrack_selected_job()[source]¶
Remove the currently highlighted job row from the enclosing JobMonitor.
- Return type:
None
- allow_focus()[source]¶
Allow focus only while all ancestor containers and tab panes are displayed.
- Return type:
bool
- columns: dict[ColumnKey, Column]¶
Metadata about the columns of the table, indexed by their key.
- cursor_background_priority¶
Should we prioritize the cursor component class CSS background or the renderable background in the event where a cell contains a renderable with a background color.
- cursor_foreground_priority¶
Should we prioritize the cursor component class CSS foreground or the renderable foreground in the event where a cell contains a renderable with a foreground color.
- lock¶
asyncio lock to be used to synchronize the state of the widget.
Two different tasks might call methods on a widget at the same time, which might result in a race condition. This can be fixed by adding async with widget.lock: around the method calls.
- message_signal: Signal[Message]¶
Subscribe to this signal to be notified of all messages sent to this widget.
This is a fairly low-level mechanism, and shouldn’t replace regular message handling.
- class imednet_tui.app.LogViewer[source]¶
Bases:
LogLog viewer widget for auditing actions and SDK events.
- DEFAULT_CSS: ClassVar[str] = '\n LogViewer {\n height: 1fr;\n background: $surface;\n border: solid $primary;\n }\n '¶
Default TCSS.
- __init__(*, registry_resolver=None, **kwargs)[source]¶
Initialize the LogViewer widget.
- Parameters:
registry_resolver (Callable[[], SensitivityRegistry | None] | None) – Optional callable resolving the active study registry.
**kwargs (Any) – Additional widget arguments.
- Return type:
None
- absolute_offset: Offset | None¶
Force an absolute offset for the widget (used by tooltips).
- active_registry()[source]¶
Resolve active study
SensitivityRegistrywhen attached to a dashboard.- Return type:
SensitivityRegistry | None
- highlight¶
Enable highlighting.
- highlighter: Highlighter¶
The Rich Highlighter object to use, if highlight=True
- lock¶
asyncio lock to be used to synchronize the state of the widget.
Two different tasks might call methods on a widget at the same time, which might result in a race condition. This can be fixed by adding async with widget.lock: around the method calls.
- message_signal: Signal[Message]¶
Subscribe to this signal to be notified of all messages sent to this widget.
This is a fairly low-level mechanism, and shouldn’t replace regular message handling.
- class imednet_tui.app.SiteList[source]¶
Bases:
ListViewList of sites for a selected study.
- class SiteSelected[source]¶
Bases:
MessageEvent emitted when a site is selected.
- ALLOW_SELECTOR_MATCH: ClassVar[set[str]] = {}¶
Additional attributes that can be used with the [on decorator][textual.on].
These attributes must be widgets.
- __init__(site_id, site_name)[source]¶
Initialize the site selected event.
- Parameters:
site_id (str) – Identifier of the site.
site_name (str) – Human-readable site name.
- Return type:
None
- can_replace(message)¶
Check if another message may supersede this one.
- Parameters:
message (Message) – Another message.
- Returns:
True if this message may replace the given message
- Return type:
bool
- property control: DOMNode | None¶
The widget associated with this message, or None by default.
- handler_name: ClassVar[str] = 'on_site_list_site_selected'¶
Name of the default message handler.
- property is_forwarded: bool¶
Has the message been forwarded?
- prevent_default(prevent=True)¶
Suppress the default action(s). This will prevent handlers in any base classes from being called.
- Parameters:
prevent (bool) – True if the default action should be suppressed, or False if the default actions should be performed.
- Return type:
Message
- set_sender(sender)¶
Set the sender of the message.
- Parameters:
sender (MessagePump) – The sender.
- Return type:
Self
Note
When creating a message the sender is automatically set. Normally there will be no need for this method to be called. This method will be used when strict control is required over the sender of a message.
- Returns:
Self.
- Parameters:
sender (MessagePump) –
- Return type:
Self
- stop(stop=True)¶
Stop propagation of the message to parent.
- Parameters:
stop (bool) – The stop flag.
- Return type:
Message
- __init__(sdk, **kwargs)[source]¶
Initialize the SiteList widget.
- Parameters:
sdk (ImednetFacade | AsyncImednetFacade) – Active iMednet SDK facade instance.
**kwargs (Any) – Additional widget arguments.
- Return type:
None
- absolute_offset: Offset | None¶
Force an absolute offset for the widget (used by tooltips).
- async load_sites(study_key, *, load_all=False)[source]¶
Fetch and populate site items for a given study key.
- Parameters:
study_key (str) – Study key to load sites for.
load_all (bool) – When True, fetch all pages instead of the initial bounded batch.
- Return type:
None
- lock¶
asyncio lock to be used to synchronize the state of the widget.
Two different tasks might call methods on a widget at the same time, which might result in a race condition. This can be fixed by adding async with widget.lock: around the method calls.
- message_signal: Signal[Message]¶
Subscribe to this signal to be notified of all messages sent to this widget.
This is a fairly low-level mechanism, and shouldn’t replace regular message handling.
- class imednet_tui.app.StudyList[source]¶
Bases:
ListViewList of available clinical studies.
- class StudySelected[source]¶
Bases:
MessageEvent emitted when a study is selected.
- ALLOW_SELECTOR_MATCH: ClassVar[set[str]] = {}¶
Additional attributes that can be used with the [on decorator][textual.on].
These attributes must be widgets.
- __init__(study_key, study_name)[source]¶
Initialize the study selected event.
- Parameters:
study_key (str) – Unique identifier of the study.
study_name (str) – Human-readable study name.
- Return type:
None
- can_replace(message)¶
Check if another message may supersede this one.
- Parameters:
message (Message) – Another message.
- Returns:
True if this message may replace the given message
- Return type:
bool
- property control: DOMNode | None¶
The widget associated with this message, or None by default.
- handler_name: ClassVar[str] = 'on_study_list_study_selected'¶
Name of the default message handler.
- property is_forwarded: bool¶
Has the message been forwarded?
- prevent_default(prevent=True)¶
Suppress the default action(s). This will prevent handlers in any base classes from being called.
- Parameters:
prevent (bool) – True if the default action should be suppressed, or False if the default actions should be performed.
- Return type:
Message
- set_sender(sender)¶
Set the sender of the message.
- Parameters:
sender (MessagePump) – The sender.
- Return type:
Self
Note
When creating a message the sender is automatically set. Normally there will be no need for this method to be called. This method will be used when strict control is required over the sender of a message.
- Returns:
Self.
- Parameters:
sender (MessagePump) –
- Return type:
Self
- stop(stop=True)¶
Stop propagation of the message to parent.
- Parameters:
stop (bool) – The stop flag.
- Return type:
Message
- __init__(sdk, *, preferred_study_key=None, **kwargs)[source]¶
Initialize the StudyList widget.
- Parameters:
sdk (ImednetFacade | AsyncImednetFacade) – Active iMednet SDK facade instance.
preferred_study_key (str | None) – Optional study key to highlight when initially loaded.
**kwargs (Any) – Additional widget arguments.
- Return type:
None
- absolute_offset: Offset | None¶
Force an absolute offset for the widget (used by tooltips).
- async load_studies(*, load_all=False)[source]¶
Fetch and populate study items from the SDK facade asynchronously.
- Parameters:
load_all (bool) – When True, fetch all pages instead of the initial bounded batch.
- Return type:
None
- lock¶
asyncio lock to be used to synchronize the state of the widget.
Two different tasks might call methods on a widget at the same time, which might result in a race condition. This can be fixed by adding async with widget.lock: around the method calls.
- message_signal: Signal[Message]¶
Subscribe to this signal to be notified of all messages sent to this widget.
This is a fairly low-level mechanism, and shouldn’t replace regular message handling.
- class imednet_tui.app.SubjectTable[source]¶
Bases:
DataTable[Text]Interactive table displaying subjects.
- __init__(sdk, **kwargs)[source]¶
Initialize the SubjectTable widget.
- Parameters:
sdk (ImednetFacade | AsyncImednetFacade) – Active iMednet SDK facade instance.
**kwargs (Any) – Additional widget arguments.
- Return type:
None
- absolute_offset: Offset | None¶
Force an absolute offset for the widget (used by tooltips).
- columns: dict[ColumnKey, Column]¶
Metadata about the columns of the table, indexed by their key.
- cursor_background_priority¶
Should we prioritize the cursor component class CSS background or the renderable background in the event where a cell contains a renderable with a background color.
- cursor_foreground_priority¶
Should we prioritize the cursor component class CSS foreground or the renderable foreground in the event where a cell contains a renderable with a foreground color.
- async load_subjects(study_key, site_id=None, *, load_all=False)[source]¶
Fetch and populate subject rows for a study with optional site filtering.
- Parameters:
study_key (str) – Study key to query subjects from.
site_id (str | None) – Optional site identifier to filter results directly via the SDK facade.
load_all (bool) – When True, fetch all pages instead of the initial bounded batch.
- Return type:
None
- lock¶
asyncio lock to be used to synchronize the state of the widget.
Two different tasks might call methods on a widget at the same time, which might result in a race condition. This can be fixed by adding async with widget.lock: around the method calls.
- message_signal: Signal[Message]¶
Subscribe to this signal to be notified of all messages sent to this widget.
This is a fairly low-level mechanism, and shouldn’t replace regular message handling.
- class imednet_tui.app.TextualLogHandler[source]¶
Bases:
HandlerLogging handler routing records to a Textual Log widget.
- __init__(log_widget, *, registry_resolver=None)[source]¶
Initialize handler with target Log widget.
- Parameters:
log_widget (Log) – The Textual Log widget to write to.
registry_resolver (Callable[[], SensitivityRegistry | None] | None) – Optional callable returning the active study registry.
- Return type:
None
- imednet_tui.app.run_tui(sdk, force=False, *, high_contrast=None, study_key=None, batch_ids=None)[source]¶
Run the TUI application.
- Parameters:
sdk (ImednetFacade | AsyncImednetFacade) – Active iMednet SDK facade instance.
force (bool) – If True, bypass stream interactivity checks and launch the TUI unconditionally.
high_contrast (bool | None) – Optional explicit high-contrast mode flag.
study_key (str | None) – Optional initial study key to select on launch.
batch_ids (Sequence[str] | None) – Optional initial batch IDs to track in the Jobs tab.
- Raises:
RuntimeError – If stdin or stdout is not connected to an interactive TTY and force is False.
- Return type:
None
imednet_tui.cli module¶
CLI entry point for the iMednet TUI plugin.
imednet_tui.terminal module¶
Terminal environment and stream interactivity utilities for TUI.