imednet_workflows package
Subpackages
- imednet_workflows.uat package
- Submodules
- imednet_workflows.uat.inspector module
FormVariableMapStudySchemaInspectorStudySnapshotStudySnapshot.active_sites()StudySnapshot.captured_atStudySnapshot.enrollment_forms()StudySnapshot.formsStudySnapshot.forms_by_keyStudySnapshot.intervalsStudySnapshot.intervals_by_nameStudySnapshot.model_configStudySnapshot.model_post_init()StudySnapshot.scheduled_forms()StudySnapshot.sitesStudySnapshot.study_keyStudySnapshot.unscheduled_forms()StudySnapshot.variablesStudySnapshot.variables_by_form
- imednet_workflows.uat.models module
Submodules
imednet_workflows.cached_loader module
- class imednet_workflows.cached_loader.CachedRecordsLoader[source]
Bases:
objectLoad study records through a local SQLite cache with incremental sync.
- __init__(sdk, *, cache_dir=None, database_name='records_cache.sqlite3', retry_attempts=3)[source]
- Parameters:
sdk (ImednetSDK) –
cache_dir (str | Path | None) –
database_name (str) –
retry_attempts (int) –
- Return type:
None
- get_cached_records(study_key, *, conn=None)[source]
Return cached records for
study_keywithout contacting the API.- Return type:
list[Record]- Parameters:
study_key (str) –
conn (Connection | None) –
- iter_cached_records(study_key, *, conn=None, chunk_size=5000)[source]
Yield cached records for
study_keyin bounded chunks.- Return type:
Iterator[Record]- Parameters:
study_key (str) –
conn (Connection | None) –
chunk_size (int) –
- load_records(study_key, *, reconcile=True)[source]
Synchronise the cache for
study_keyand return cached records.- Return type:
list[Record]- Parameters:
study_key (str) –
reconcile (bool) –
imednet_workflows.chunked_pipeline module
- class imednet_workflows.chunked_pipeline.ChunkedRecordPipeline[source]
Bases:
objectChunked iteration utilities for large-study workflows.
imednet_workflows.cli module
imednet_workflows.config_version_control module
SQLite-backed version control ledger for study configurations.
Provides immutable, append-only commit history with SHA-256 content hashing, diff capability, and safe rollback. History blocks are read-only once written.
- class imednet_workflows.config_version_control.ConfigVersionStore[source]
Bases:
objectImmutable append-only store for
StudyConfigurationversions.Each call to
commit_config()creates a new entry signed with a SHA-256 digest of the serialised configuration body. History is strictly read-only — individual commit rows may never be edited or deleted.- Parameters:
db_path (
str|Path) – Filesystem path for the SQLite database. Defaults to~/.imednet/config_versions.sqlite3.
- __init__(db_path=PosixPath('/home/runner/.imednet/config_versions.sqlite3'))[source]
- Parameters:
db_path (str | Path) –
- Return type:
None
- commit_config(study_key, config, user, desc)[source]
Serialise config, compute its SHA-256 hash, and persist the commit.
- Parameters:
study_key (
str) – Identifies the study this configuration belongs to.config (
StudyConfiguration) – TheStudyConfigurationto store.user (
str) – Identifier of the person or process making the change.desc (
str) – Human-readable description of what changed.
- Return type:
str- Returns:
The
commit_id(SHA-256 hex digest of the serialised JSON body).- Raises:
ValueError – If a commit with the same content hash already exists for this study, indicating a no-op duplicate.
- diff_configs(commit_a, commit_b)[source]
Compute a property-level diff between two commits.
Compares the flat JSON key space of the two commits. Returns a dict with three sub-keys:
added— keys present in b but not in a.removed— keys present in a but not in b.changed— keys present in both but with different values.
- Parameters:
commit_a (
str) – SHA-256 commit ID of the before state.commit_b (
str) – SHA-256 commit ID of the after state.
- Return type:
dict[str,Any]- Returns:
Dict with
added,removed, andchangedsub-dicts.- Raises:
KeyError – If either commit ID is not found in the store.
- get_history(study_key)[source]
Return all commits for study_key, ordered oldest-first.
- Parameters:
study_key (
str) – The study whose history should be retrieved.- Return type:
list[dict[str,Any]]- Returns:
A list of dicts, each with keys
commit_id,study_key,version_tag,modified_by,description, andtimestamp. Theconfig_databody is intentionally omitted to keep the payload small — userollback_config()to retrieve the full body for a specific commit.
- rollback_config(study_key, commit_id)[source]
Restore and return the
StudyConfigurationstored at commit_id.This method is non-destructive — it does not modify any existing history rows. The caller is responsible for creating a new commit via
commit_config()if they wish to record the rollback.- Parameters:
study_key (
str) – The study the commit must belong to.commit_id (
str) – The SHA-256 commit ID to restore.
- Return type:
- Returns:
The deserialised
StudyConfiguration.- Raises:
KeyError – If the commit is not found or does not belong to the requested study.
imednet_workflows.data_extraction module
Provides workflows for extracting specific datasets from iMednet studies.
- class imednet_workflows.data_extraction.DataExtractionWorkflow[source]
Bases:
objectProvides methods for complex data extraction tasks involving multiple iMednet endpoints.
- Parameters:
sdk (
ImednetSDK) – An instance of the ImednetSDK.
- __init__(sdk)[source]
- Parameters:
sdk (ImednetSDK) –
- extract_audit_trail(study_key, start_date=None, end_date=None, user_filter=None, **filters)[source]
Extracts the audit trail (record revisions) based on specified filters.
- Parameters:
study_key (
str) – The key identifying the study.start_date (
Optional[str]) – Optional start date filter (YYYY-MM-DD format expected by API).end_date (
Optional[str]) – Optional end date filter (YYYY-MM-DD format expected by API).user_filter (
Optional[Dict[str,Union[Any,Tuple[str,Any],List[Any]]]]) – Optional dictionary of base filter conditions.**filters (
Any) – Additional key-value pairs to be added as equality filters.
- Return type:
List[RecordRevision]- Returns:
A list of RecordRevision objects matching the criteria.
- extract_records_by_criteria(study_key, record_filter=None, subject_filter=None, visit_filter=None, **other_filters)[source]
Extracts records based on criteria spanning subjects, visits, and records.
- Parameters:
study_key (
str) – The key identifying the study.record_filter (
Optional[Dict[str,Union[Any,Tuple[str,Any],List[Any]]]]) – Dictionary of conditions for the records endpoint.subject_filter (
Optional[Dict[str,Union[Any,Tuple[str,Any],List[Any]]]]) – Dictionary of conditions for the subjects endpoint.visit_filter (
Optional[Dict[str,Union[Any,Tuple[str,Any],List[Any]]]]) – Dictionary of conditions for the visits endpoint.**other_filters (
Any) – Additional keyword arguments passed as filters to the records endpoint list method.
- Return type:
List[Record]- Returns:
A list of Record objects matching all specified criteria.
imednet_workflows.duckdb_centralizer module
DuckDB ingestion workflow for incremental eCRF centralization.
- class imednet_workflows.duckdb_centralizer.DuckDBIngestionWorkflow[source]
Bases:
objectIncremental eCRF centralization pipeline using a bronze/silver DuckDB layout.
- __init__(sdk, db_path)[source]
- Parameters:
sdk (ImednetSDK) –
db_path (str) –
- Return type:
None
imednet_workflows.extraction_engine module
- class imednet_workflows.extraction_engine.ExtractionResult[source]
Bases:
BaseModelCanonical extraction output grouped by reporting domain.
- adverse_events: list[AdverseEvent]
- device_deficiencies: list[DeviceDeficiency]
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- protocol_deviations: list[ProtocolDeviation]
- validation_errors: list[dict[str, Any]]
- imednet_workflows.extraction_engine.extract_canonical_records(records, study_configuration)[source]
Extract canonical AE/PD/DD models from raw records using study mappings.
- Return type:
- Parameters:
records (list[imednet.models.records.Record]) –
study_configuration (StudyConfiguration) –
imednet_workflows.job_poller module
Utility for polling job status.
- class imednet_workflows.job_poller.AsyncJobPoller[source]
Bases:
BaseJobPollerAsynchronously poll a job until completion.
- class imednet_workflows.job_poller.BaseJobPoller[source]
Bases:
objectBase class for polling a job until it reaches a terminal state.
imednet_workflows.namespace module
imednet_workflows.query_management module
Provides workflows for managing queries within iMednet studies.
- class imednet_workflows.query_management.QueryManagementWorkflow[source]
Bases:
objectProvides methods for common query management tasks.
- Parameters:
sdk (
ImednetSDK) – An instance of the ImednetSDK.
- __init__(sdk)[source]
- Parameters:
sdk (ImednetSDK) –
- get_open_queries(study_key, additional_filter=None, **kwargs)[source]
Retrieves all open queries for a given study, potentially filtered further.
An ‘open’ query is defined as one where the query comment with the highest sequence number has its ‘closed’ field set to False.
Note: This method fetches queries based on additional_filter and then filters for the ‘open’ state client-side.
- Parameters:
study_key (
str) – The key identifying the study.additional_filter (
Optional[Dict[str,Union[Any,Tuple[str,Any],List[Any]]]]) – An optional dictionary of conditions to apply via the API.**kwargs (
Any) – Additional keyword arguments passed directly to sdk.queries.list.
- Return type:
List[Query]- Returns:
A list of open Query objects matching the criteria.
- get_queries_by_site(study_key, site_key, additional_filter=None, **kwargs)[source]
Retrieves all queries for a specific site within a study.
- Parameters:
study_key (
str) – The key identifying the study.site_key (
str) – The name of the site.additional_filter (
Optional[Dict[str,Union[Any,Tuple[str,Any],List[Any]]]]) – Extra conditions to combine with the subject filter.**kwargs (
Any) – Additional keyword arguments passed directly to sdk.queries.list.
- Return type:
List[Query]- Returns:
A list of Query objects for the specified site.
- get_queries_for_subject(study_key, subject_key, additional_filter=None, **kwargs)[source]
Retrieves all queries for a specific subject within a study.
- Parameters:
study_key (
str) – The key identifying the study.subject_key (
str) – The key identifying the subject.additional_filter (
Optional[Dict[str,Union[Any,Tuple[str,Any],List[Any]]]]) – An optional dictionary of conditions to combine with the subject filter.**kwargs (
Any) – Additional keyword arguments passed directly to sdk.queries.list.
- Return type:
List[Query]- Returns:
A list of Query objects for the specified subject.
- get_query_state_counts(study_key, **kwargs)[source]
Counts queries grouped by their current state (open/closed/unknown).
The state is determined by the ‘closed’ field of the query comment with the highest sequence number. Queries without any comments are counted as ‘unknown’.
Note: This method fetches all queries matching the base criteria (if any are passed via kwargs) and then performs the aggregation client-side.
- Parameters:
study_key (
str) – The key identifying the study.**kwargs (
Any) – Additional keyword arguments passed directly to sdk.queries.list (e.g., for initial filtering before counting).
- Return type:
Dict[str,int]- Returns:
A dictionary with keys ‘open’, ‘closed’, ‘unknown’ and their respective counts.
imednet_workflows.record_mapper module
- class imednet_workflows.record_mapper.RecordMapper[source]
Bases:
objectMaps EDC records for a study into a pandas DataFrame.
- Features:
Fetches variable definitions for column mapping.
Dynamically creates a Pydantic model for type validation of record data.
Fetches records, applying server-side filtering where possible.
Merges metadata and record data.
Offers choice between variable names or labels for column headers.
Handles parsing errors gracefully for individual records.
Example
sdk = ImednetSDK(api_key, security_key, base_url) mapper = RecordMapper(sdk) # Get DataFrame with labels as columns, filtered by visit df_labels = mapper.dataframe(study_key=”MYSTUDY”, visit_key=”VISIT1”) # Get DataFrame with variable names as columns df_names = mapper.dataframe(study_key=”MYSTUDY”, use_labels_as_columns=False)
- __init__(sdk, *, loader=None, chunk_size=5000)[source]
Initialize with an
ImednetSDKinstance.loaderenables cache-backed streaming for large-study workflows.chunk_sizecontrols the maximum number of records parsed into each yielded batch when using chunked mapping helpers.- Parameters:
sdk (ImednetSDK) –
loader (CachedRecordsLoader | None) –
chunk_size (int) –
- Return type:
None
- dataframe(study_key, visit_key=None, use_labels_as_columns=True, variable_whitelist=None, form_whitelist=None)[source]
Return a
pandas.DataFrameof records for a study.This method still materialises all yielded chunks into one DataFrame. For bounded-memory processing of large studies, prefer
iter_dataframes().- Return type:
DataFrame- Parameters:
study_key (str) –
visit_key (str | None) –
use_labels_as_columns (bool) –
variable_whitelist (List[str] | None) –
form_whitelist (List[int] | None) –
- iter_dataframes(study_key, visit_key=None, use_labels_as_columns=True, variable_whitelist=None, form_whitelist=None)[source]
Yield mapped record DataFrames in bounded chunks.
Each yielded frame contains at most
chunk_sizemapped records from this mapper instance. Prefer this method overdataframe()when processing or exporting large studies so each chunk can be committed before the next batch is parsed.- Return type:
Iterator[DataFrame]- Parameters:
study_key (str) –
visit_key (str | None) –
use_labels_as_columns (bool) –
variable_whitelist (List[str] | None) –
form_whitelist (List[int] | None) –
imednet_workflows.record_update module
Utilities for submitting and updating records in iMedNet studies.
- class imednet_workflows.record_update.RecordUpdateWorkflow[source]
Bases:
objectProvides workflows for creating or updating records, including batch submission and optional job status monitoring.
- Parameters:
sdk (
Union[ImednetSDK,AsyncImednetSDK]) – An instance of the ImednetSDK.
- __init__(sdk)[source]
- Parameters:
sdk (ImednetSDK | AsyncImednetSDK) –
- async async_create_or_update_records(study_key, records_data, wait_for_completion=False, timeout=300, poll_interval=5)[source]
Asynchronous variant of
create_or_update_records().- Return type:
- Parameters:
study_key (str) –
records_data (List[Dict[str, Any]]) –
wait_for_completion (bool) –
timeout (int) –
poll_interval (int) –
- create_new_record(study_key, form_identifier, subject_identifier, data, form_identifier_type='key', subject_identifier_type='key', wait_for_completion=False, timeout=300, poll_interval=5)[source]
Creates a new (unscheduled) record for an existing subject.
- Parameters:
study_key (
str) – The study key.form_identifier (
Union[str,int]) – The form key or ID.subject_identifier (
Union[str,int]) – The subject key, ID, or OID.data (
Dict[str,Any]) – The dictionary of record data (variable names and values).form_identifier_type (
Literal['key','id']) – Whether form_identifier is a ‘key’ or ‘id’.subject_identifier_type (
Literal['key','id','oid']) – Whether subject_identifier is a ‘key’, ‘id’, or ‘oid’.wait_for_completion (
bool) – If True, wait for the job to complete.timeout (
int) – Timeout in seconds for waiting.poll_interval (
int) – Polling interval in seconds.
- Return type:
- Returns:
The Job status object.
- create_or_update_records(study_key, records_data, wait_for_completion=False, timeout=300, poll_interval=5)[source]
Submit records for creation or update and optionally wait for completion.
- Return type:
- Parameters:
study_key (str) –
records_data (List[Dict[str, Any]]) –
wait_for_completion (bool) –
timeout (int) –
poll_interval (int) –
- register_subject(study_key, form_identifier, site_identifier, data, form_identifier_type='key', site_identifier_type='name', wait_for_completion=False, timeout=300, poll_interval=5)[source]
Registers a new subject by submitting a single record.
- Parameters:
study_key (
str) – The study key.form_identifier (
Union[str,int]) – The form key or ID.site_identifier (
Union[str,int]) – The site name or ID.data (
Dict[str,Any]) – The dictionary of record data (variable names and values).form_identifier_type (
Literal['key','id']) – Whether form_identifier is a ‘key’ or ‘id’.site_identifier_type (
Literal['name','id']) – Whether site_identifier is a ‘name’ or ‘id’.wait_for_completion (
bool) – If True, wait for the job to complete.timeout (
int) – Timeout in seconds for waiting.poll_interval (
int) – Polling interval in seconds.
- Return type:
- Returns:
The Job status object.
- update_scheduled_record(study_key, form_identifier, subject_identifier, interval_identifier, data, form_identifier_type='key', subject_identifier_type='key', interval_identifier_type='name', wait_for_completion=False, timeout=300, poll_interval=5)[source]
Updates an existing scheduled record for a subject.
- Parameters:
study_key (
str) – The study key.form_identifier (
Union[str,int]) – The form key or ID.subject_identifier (
Union[str,int]) – The subject key, ID, or OID.interval_identifier (
Union[str,int]) – The interval name or ID.data (
Dict[str,Any]) – The dictionary of record data (variable names and values).form_identifier_type (
Literal['key','id']) – Whether form_identifier is a ‘key’ or ‘id’.subject_identifier_type (
Literal['key','id','oid']) – Whether subject_identifier is a ‘key’, ‘id’, or ‘oid’.interval_identifier_type (
Literal['name','id']) – Whether interval_identifier is a ‘name’ or ‘id’.wait_for_completion (
bool) – If True, wait for the job to complete.timeout (
int) – Timeout in seconds for waiting.poll_interval (
int) – Polling interval in seconds.
- Return type:
- Returns:
The Job status object.
imednet_workflows.register_subjects module
Workflow for registering subjects (patients) in iMednet via the Records API. This workflow is self-contained and does not borrow from record_update.py. It provides a simple, robust interface for registering one or more subjects.
- class imednet_workflows.register_subjects.RegisterSubjectsWorkflow[source]
Bases:
objectManages the registration of subjects using the iMedNet SDK.
- _sdk
An instance of the ImednetSDK.
- Type:
- __init__(sdk)[source]
- Parameters:
sdk (ImednetSDK) –
- register_subjects(study_key, subjects, email_notify=None)[source]
Registers multiple subjects in the specified study. Sites and subject identifiers are validated before submission.
- Parameters:
study_key (
str) – The key identifying the study.subjects (
List[RegisterSubjectRequest]) – A list of RegisterSubjectRequest objects, each defining a subject to be registered.email_notify (
Optional[str]) – Optional email address to notify upon completion.
- Return type:
- Returns:
A
Jobobject representing the background job created for the registration request.- Raises:
ApiError – If the API call fails.
imednet_workflows.schema_profiler module
- class imednet_workflows.schema_profiler.FieldProfile[source]
Bases:
BaseModelSummary statistics for a single form field.
- inferred_type: str
- label: str
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- population_rate: float
- unique_count: int
- unique_values: list[str]
- variable_name: str
- class imednet_workflows.schema_profiler.FormProfile[source]
Bases:
BaseModelSummary statistics for a single form.
- fields: dict[str, FieldProfile]
- form_key: str
- form_name: str
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- record_count: int
- class imednet_workflows.schema_profiler.SchemaProfiler[source]
Bases:
objectProfile form and record-data population across cached records.
- __init__(sdk, loader=None)[source]
- Parameters:
sdk (ImednetSDK) –
loader (CachedRecordsLoader | None) –
- Return type:
None
- profile_records(study_key, *, records=None)[source]
Return per-form field profiling statistics for
study_key.- Return type:
dict[str,FormProfile]- Parameters:
study_key (str) –
records (Iterable[Record] | None) –
imednet_workflows.standards_validation module
- class imednet_workflows.standards_validation.CategoricalNormalizer[source]
Bases:
object
- class imednet_workflows.standards_validation.NormalizationResult[source]
Bases:
BaseModel- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- normalized_record: dict[str, Any]
- warnings: list[str]
- class imednet_workflows.standards_validation.StandardsReadinessReport[source]
Bases:
BaseModel- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- score: float
- successfully_validated_fields: int
- total_expected_fields: int
- violations: list[ValidationViolation]
- warnings: list[str]
- class imednet_workflows.standards_validation.StandardsReadinessValidator[source]
Bases:
object- __init__(profile, normalizer=None)[source]
- Parameters:
profile (StandardsProfile) –
normalizer (CategoricalNormalizer | None) –
- Return type:
None
imednet_workflows.state_ledger module
Stateful incremental high-water mark tracker for workflow streams.
- class imednet_workflows.state_ledger.ExtractionStateLedger[source]
Bases:
objectManages transactional state bookmarks per study to guarantee absolute ingestion tracking.
- __init__(ledger_path='/var/lib/imednet/pipeline_ledger.json')[source]
- Parameters:
ledger_path (str) –
- Return type:
None
- delete_entry(study_key, stream_name=None)[source]
Deletes a study or specific stream entry from the ledger under the file lock.
Returns
Trueif the entry existed and was removed,Falseotherwise.- Return type:
bool- Parameters:
study_key (str) –
stream_name (str | None) –
- get_last_timestamp(study_key, stream_name)[source]
Returns the high-water mark timestamp for a given study and stream.
- Return type:
Optional[datetime]- Parameters:
study_key (str) –
stream_name (str) –
- set_last_timestamp(study_key, stream_name, timestamp, records_processed=0, status='success', error_message=None, metadata=None)[source]
Sets the high-water mark timestamp atomically.
- Return type:
None- Parameters:
study_key (str) –
stream_name (str) –
timestamp (datetime) –
records_processed (int) –
status (str) –
error_message (str | None) –
metadata (Dict[str, Any] | None) –
- transaction(study_key, stream_name, fallback_timestamp=None)[source]
Context manager for transactional state tracking. Yields a dict where user can record ‘records_processed’, ‘new_timestamp’, and ‘metadata’. Saves automatically upon exiting the context with no exceptions. The ledger file lock is held for the entire duration of the context.
- Return type:
Generator[Dict[str,Any],None,None]- Parameters:
study_key (str) –
stream_name (str) –
fallback_timestamp (datetime | None) –
- write_state(state)[source]
Writes the ledger state atomically using a temporary file.
- Return type:
None- Parameters:
state (LedgerState) –
- class imednet_workflows.state_ledger.LedgerState[source]
Bases:
BaseModelSchema for the entire ledger file containing all studies.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- studies: Dict[str, StudyState]
- class imednet_workflows.state_ledger.StreamState[source]
Bases:
BaseModelSchema for individual stream execution checkpoints.
- error_message: Optional[str]
- last_run_status: str
- last_timestamp: datetime
- metadata: Dict[str, Any]
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- records_processed: int
- class imednet_workflows.state_ledger.StudyState[source]
Bases:
BaseModelSchema for all streams in a given study context.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- streams: Dict[str, StreamState]
imednet_workflows.study_structure module
- async imednet_workflows.study_structure.async_get_study_structure(sdk, study_key)[source]
Asynchronous variant of
get_study_structure().- Return type:
- Parameters:
sdk (AsyncImednetSDK) –
study_key (str) –
- imednet_workflows.study_structure.get_study_structure(sdk, study_key)[source]
Fetches and aggregates study structure information (intervals, forms, variables).
- Parameters:
sdk (
ImednetSDK) – An initialized ImednetSDK instance.study_key (
str) – The key of the study to fetch structure for.
- Return type:
- Returns:
A StudyStructure object containing nested intervals, forms, and variables.
- Raises:
ImednetError – If fetching any part of the structure fails.
imednet_workflows.subject_data module
Provides a workflow to retrieve comprehensive data for a specific subject.
- class imednet_workflows.subject_data.SubjectComprehensiveData[source]
Bases:
BaseModelStructure to hold aggregated data for a subject.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class imednet_workflows.subject_data.SubjectDataWorkflow[source]
Bases:
objectProvides methods to retrieve comprehensive data related to a specific subject.
- Parameters:
sdk (
ImednetSDK) – An instance of the ImednetSDK.
- __init__(sdk)[source]
- Parameters:
sdk (ImednetSDK) –
- get_all_subject_data(study_key, subject_key)[source]
Retrieves subject details, visits, records, and queries for a specific subject.
- Parameters:
study_key (
str) – The key identifying the study.subject_key (
str) – The key identifying the subject.
- Return type:
- Returns:
A SubjectComprehensiveData object containing the aggregated data.
imednet_workflows.sync_worker module
- class imednet_workflows.sync_worker.SyncWorker[source]
Bases:
objectBackground cache refresher that runs incremental record sync loops.
- __init__(loader, *, config, stop_event=None)[source]
- Parameters:
loader (CachedRecordsLoader) –
config (SyncWorkerConfig) –
stop_event (Event | None) –
- Return type:
None
- class imednet_workflows.sync_worker.SyncWorkerConfig[source]
Bases:
objectSyncWorkerConfig(study_key: ‘str’, interval_seconds: ‘int’ = 900, reconcile: ‘bool’ = True, lock_timeout_seconds: ‘int’ = 30)
- __init__(study_key, interval_seconds=900, reconcile=True, lock_timeout_seconds=30)
- Parameters:
study_key (str) –
interval_seconds (int) –
reconcile (bool) –
lock_timeout_seconds (int) –
- Return type:
None
-
interval_seconds:
int
-
lock_timeout_seconds:
int
-
reconcile:
bool
-
study_key:
str
imednet_workflows.triage_store module
- class imednet_workflows.triage_store.TriageStore[source]
Bases:
objectThread-safe SQLite-backed triage queue and decision store.
- __init__(db_path, *, timeout=30.0, retry_attempts=3)[source]
- Parameters:
db_path (str | Path) –
timeout (float) –
retry_attempts (int) –
- Return type:
None
- add_annotation(item_id, user_id, comment)[source]
- Return type:
None- Parameters:
item_id (str) –
user_id (str) –
comment (str) –
- assign_item(item_id, assignee)[source]
- Return type:
None- Parameters:
item_id (str) –
assignee (str) –
- get_queue(study_key, status=None)[source]
- Return type:
list[TriageItem]- Parameters:
study_key (str) –
status (TriageStatus | None) –
- get_triage_item(item_id)[source]
- Return type:
Optional[TriageItem]- Parameters:
item_id (str) –
- update_status(item_id, to_status, user_id, comment)[source]
- Return type:
None- Parameters:
item_id (str) –
to_status (TriageStatus) –
user_id (str) –
comment (str | None) –
- upsert_item(item)[source]
- Return type:
None- Parameters:
item (TriageItem) –