|
PACS System 0.1.0
PACS DICOM system library
|
#include <prefetch_manager.h>

Classes | |
| struct | impl |
Public Member Functions | |
| prefetch_manager (prefetch_repositories repositories, std::shared_ptr< remote_node_manager > node_manager, std::shared_ptr< job_manager > job_manager, std::shared_ptr< services::worklist_scu > worklist_scu=nullptr, std::shared_ptr< di::ILogger > logger=nullptr) | |
| Construct a prefetch manager from split repositories. | |
| prefetch_manager (const prefetch_manager_config &config, prefetch_repositories repositories, std::shared_ptr< remote_node_manager > node_manager, std::shared_ptr< job_manager > job_manager, std::shared_ptr< services::worklist_scu > worklist_scu=nullptr, std::shared_ptr< di::ILogger > logger=nullptr) | |
| Construct with custom configuration and split repositories. | |
| prefetch_manager (std::shared_ptr< storage::prefetch_repository > repo, std::shared_ptr< remote_node_manager > node_manager, std::shared_ptr< job_manager > job_manager, std::shared_ptr< services::worklist_scu > worklist_scu=nullptr, std::shared_ptr< di::ILogger > logger=nullptr) | |
| Construct a prefetch manager with dependencies. | |
| prefetch_manager (const prefetch_manager_config &config, std::shared_ptr< storage::prefetch_repository > repo, std::shared_ptr< remote_node_manager > node_manager, std::shared_ptr< job_manager > job_manager, std::shared_ptr< services::worklist_scu > worklist_scu=nullptr, std::shared_ptr< di::ILogger > logger=nullptr) | |
| Construct with custom configuration. | |
| ~prefetch_manager () | |
| Destructor - stops scheduler and monitor if running. | |
| prefetch_manager (const prefetch_manager &)=delete | |
| auto | operator= (const prefetch_manager &) -> prefetch_manager &=delete |
| prefetch_manager (prefetch_manager &&)=delete | |
| auto | operator= (prefetch_manager &&) -> prefetch_manager &=delete |
| auto | add_rule (const prefetch_rule &rule) -> kcenon::pacs::VoidResult |
| Add a new prefetch rule. | |
| auto | update_rule (const prefetch_rule &rule) -> kcenon::pacs::VoidResult |
| Update an existing prefetch rule. | |
| auto | remove_rule (std::string_view rule_id) -> kcenon::pacs::VoidResult |
| Remove a prefetch rule. | |
| auto | get_rule (std::string_view rule_id) const -> std::optional< prefetch_rule > |
| Get a rule by ID. | |
| auto | list_rules () const -> std::vector< prefetch_rule > |
| List all prefetch rules. | |
| void | process_worklist (const std::vector< core::dicom_dataset > &worklist_items) |
| Process worklist items and trigger prefetch. | |
| auto | process_worklist_async (const std::vector< core::dicom_dataset > &worklist_items) -> std::future< void > |
| Process worklist items asynchronously. | |
| auto | prefetch_priors (std::string_view patient_id, std::string_view current_modality, std::optional< std::string_view > body_part=std::nullopt) -> prefetch_result |
| Prefetch prior studies for a patient. | |
| auto | prefetch_priors_async (std::string_view patient_id, std::string_view current_modality, std::optional< std::string_view > body_part=std::nullopt) -> std::future< prefetch_result > |
| Prefetch prior studies asynchronously. | |
| auto | prefetch_study (std::string_view source_node_id, std::string_view study_uid) -> std::string |
| Prefetch a specific study. | |
| auto | prefetch_patient (std::string_view source_node_id, std::string_view patient_id, std::chrono::hours lookback=std::chrono::hours{8760}) -> std::string |
| Prefetch all studies for a patient. | |
| void | start_scheduler () |
| Start the scheduler for cron-based rules. | |
| void | stop_scheduler () |
| Stop the scheduler. | |
| auto | is_scheduler_running () const noexcept -> bool |
| Check if scheduler is running. | |
| void | start_worklist_monitor (std::string_view worklist_node_id) |
| Start the worklist monitor. | |
| void | stop_worklist_monitor () |
| Stop the worklist monitor. | |
| auto | is_worklist_monitor_running () const noexcept -> bool |
| Check if worklist monitor is running. | |
| auto | pending_prefetches () const -> size_t |
| Get number of pending prefetch operations. | |
| auto | completed_today () const -> size_t |
| Get number of prefetches completed today. | |
| auto | failed_today () const -> size_t |
| Get number of prefetches failed today. | |
| auto | get_rule_statistics (std::string_view rule_id) const -> prefetch_rule_statistics |
| Get statistics for a specific rule. | |
| auto | config () const noexcept -> const prefetch_manager_config & |
| Get current configuration. | |
| void | set_config (prefetch_manager_config new_config) |
| Update configuration. | |
Private Attributes | |
| std::unique_ptr< impl > | impl_ |
Definition at line 111 of file prefetch_manager.h.
|
explicit |
Construct a prefetch manager from split repositories.
| repositories | Split prefetch repositories for rules and history |
| node_manager | Remote node manager for DICOM operations (required) |
| job_manager | Job manager for async operations (required) |
| worklist_scu | Worklist SCU for MWL queries (optional) |
| logger | Logger instance (optional, defaults to NullLogger) |
Definition at line 394 of file prefetch_manager.cpp.
|
explicit |
Construct with custom configuration and split repositories.
| config | Manager configuration |
| repositories | Split prefetch repositories for rules and history |
| node_manager | Remote node manager for DICOM operations (required) |
| job_manager | Job manager for async operations (required) |
| worklist_scu | Worklist SCU for MWL queries (optional) |
| logger | Logger instance (optional, defaults to NullLogger) |
Definition at line 408 of file prefetch_manager.cpp.
References config(), kcenon::pacs::client::prefetch_manager::impl::config, impl_, kcenon::pacs::client::prefetch_manager::impl::job_mgr, kcenon::pacs::client::prefetch_manager::impl::load_rules_from_repo(), kcenon::pacs::client::prefetch_manager::impl::logger, kcenon::pacs::client::prefetch_manager::impl::node_manager, kcenon::pacs::client::prefetch_manager::impl::repositories, and kcenon::pacs::client::prefetch_manager::impl::worklist_scu.

|
explicit |
Construct a prefetch manager with dependencies.
Compatibility-only overload. Prefer split repositories for new wiring.
| repo | Prefetch repository for persistence (required) |
| node_manager | Remote node manager for DICOM operations (required) |
| job_manager | Job manager for async operations (required) |
| worklist_scu | Worklist SCU for MWL queries (optional) |
| logger | Logger instance (optional, defaults to NullLogger) |
Definition at line 426 of file prefetch_manager.cpp.
|
explicit |
Construct with custom configuration.
Compatibility-only overload. Prefer split repositories for new wiring.
| config | Manager configuration |
| repo | Prefetch repository for persistence (required) |
| node_manager | Remote node manager for DICOM operations (required) |
| job_manager | Job manager for async operations (required) |
| worklist_scu | Worklist SCU for MWL queries (optional) |
| logger | Logger instance (optional, defaults to NullLogger) |
Definition at line 440 of file prefetch_manager.cpp.
References kcenon::pacs::client::prefetch_manager::impl::compatibility_repo, config(), kcenon::pacs::client::prefetch_manager::impl::config, impl_, kcenon::pacs::client::prefetch_manager::impl::job_mgr, kcenon::pacs::client::prefetch_manager::impl::load_rules_from_repo(), kcenon::pacs::client::prefetch_manager::impl::logger, kcenon::pacs::client::prefetch_manager::impl::node_manager, and kcenon::pacs::client::prefetch_manager::impl::worklist_scu.

| kcenon::pacs::client::prefetch_manager::~prefetch_manager | ( | ) |
Destructor - stops scheduler and monitor if running.
Definition at line 464 of file prefetch_manager.cpp.
References stop_scheduler(), and stop_worklist_monitor().

|
delete |
|
delete |
|
nodiscard |
Add a new prefetch rule.
| rule | The rule to add |
Definition at line 473 of file prefetch_manager.cpp.
References kcenon::pacs::client::prefetch_manager::impl::compatibility_repo, impl_, kcenon::pacs::client::prefetch_manager::impl::logger, kcenon::pacs::client::prefetch_rule::name, kcenon::pacs::client::prefetch_manager::impl::repositories, kcenon::pacs::client::prefetch_rule::rule_id, kcenon::pacs::client::prefetch_repositories::rules, kcenon::pacs::client::prefetch_manager::impl::rules_cache, and kcenon::pacs::client::prefetch_manager::impl::rules_mutex.
|
nodiscard |
Get number of prefetches completed today.
Definition at line 863 of file prefetch_manager.cpp.
References kcenon::pacs::client::prefetch_manager::impl::compatibility_repo, kcenon::pacs::client::prefetch_repositories::history, impl_, and kcenon::pacs::client::prefetch_manager::impl::repositories.
|
nodiscardnoexcept |
Get current configuration.
Definition at line 908 of file prefetch_manager.cpp.
References kcenon::pacs::client::prefetch_manager::impl::config, and impl_.
Referenced by prefetch_manager(), and prefetch_manager().

|
nodiscard |
Get number of prefetches failed today.
Definition at line 877 of file prefetch_manager.cpp.
References kcenon::pacs::client::prefetch_manager::impl::compatibility_repo, kcenon::pacs::client::prefetch_repositories::history, impl_, and kcenon::pacs::client::prefetch_manager::impl::repositories.
|
nodiscard |
Get a rule by ID.
| rule_id | ID of the rule to retrieve |
Definition at line 589 of file prefetch_manager.cpp.
References impl_, kcenon::pacs::client::prefetch_manager::impl::rules_cache, and kcenon::pacs::client::prefetch_manager::impl::rules_mutex.
Referenced by get_rule_statistics().

|
nodiscard |
Get statistics for a specific rule.
| rule_id | Rule ID to get statistics for |
Definition at line 891 of file prefetch_manager.cpp.
References get_rule().

|
nodiscardnoexcept |
Check if scheduler is running.
Definition at line 809 of file prefetch_manager.cpp.
References impl_, and kcenon::pacs::client::prefetch_manager::impl::scheduler_running.
|
nodiscardnoexcept |
Check if worklist monitor is running.
Definition at line 851 of file prefetch_manager.cpp.
References impl_, and kcenon::pacs::client::prefetch_manager::impl::worklist_monitor_running.
|
nodiscard |
List all prefetch rules.
Definition at line 599 of file prefetch_manager.cpp.
References impl_, kcenon::pacs::client::prefetch_manager::impl::rules_cache, and kcenon::pacs::client::prefetch_manager::impl::rules_mutex.
|
delete |
|
delete |
|
nodiscard |
Get number of pending prefetch operations.
Definition at line 859 of file prefetch_manager.cpp.
References impl_, and kcenon::pacs::client::prefetch_manager::impl::pending_count.
|
nodiscard |
Prefetch all studies for a patient.
| source_node_id | Source node to retrieve from |
| patient_id | Patient ID to prefetch studies for |
| lookback | Lookback period (default: 1 year) |
Definition at line 754 of file prefetch_manager.cpp.
References impl_, kcenon::pacs::client::prefetch_manager::impl::job_mgr, kcenon::pacs::client::prefetch_manager::impl::logger, and kcenon::pacs::client::low.
|
nodiscard |
Prefetch prior studies for a patient.
Searches configured source nodes for prior studies matching the patient and modality criteria.
| patient_id | Patient ID to search for |
| current_modality | Current exam modality |
| body_part | Optional body part filter |
Definition at line 649 of file prefetch_manager.cpp.
References kcenon::pacs::client::body_part, kcenon::pacs::client::prefetch_result::elapsed, kcenon::pacs::client::prefetch_manager::impl::get_matching_rules(), impl_, kcenon::pacs::client::prefetch_manager::impl::logger, kcenon::pacs::client::prefetch_manager::impl::node_manager, kcenon::pacs::client::prefetch_result::patient_id, and kcenon::pacs::client::prior_studies.
Referenced by prefetch_priors_async(), and process_worklist().


|
nodiscard |
Prefetch prior studies asynchronously.
| patient_id | Patient ID to search for |
| current_modality | Current exam modality |
| body_part | Optional body part filter |
Definition at line 697 of file prefetch_manager.cpp.
References kcenon::pacs::client::body_part, and prefetch_priors().

|
nodiscard |
Prefetch a specific study.
| source_node_id | Source node to retrieve from |
| study_uid | Study Instance UID to prefetch |
Definition at line 715 of file prefetch_manager.cpp.
References kcenon::pacs::client::prefetch_manager::impl::config, kcenon::pacs::client::prefetch_manager_config::deduplicate_requests, impl_, kcenon::pacs::client::prefetch_manager::impl::is_study_local(), kcenon::pacs::client::prefetch_manager::impl::is_study_pending(), kcenon::pacs::client::prefetch_manager::impl::job_mgr, kcenon::pacs::client::prefetch_manager::impl::logger, kcenon::pacs::client::low, kcenon::pacs::client::prefetch_manager::impl::mark_study_pending(), and kcenon::pacs::client::prefetch_manager::impl::record_prefetch_history().

| void kcenon::pacs::client::prefetch_manager::process_worklist | ( | const std::vector< core::dicom_dataset > & | worklist_items | ) |
Process worklist items and trigger prefetch.
Evaluates each worklist item against enabled rules and triggers appropriate prefetch operations.
| worklist_items | Worklist items from MWL query |
Definition at line 608 of file prefetch_manager.cpp.
References kcenon::pacs::client::body_part, kcenon::pacs::client::prefetch_manager::impl::get_matching_rules(), impl_, kcenon::pacs::client::prefetch_manager::impl::increment_rule_stats(), kcenon::pacs::client::prefetch_manager::impl::logger, kcenon::pacs::core::tags::modality, kcenon::pacs::core::tags::patient_id, prefetch_priors(), kcenon::pacs::core::tags::scheduled_station_ae_title, kcenon::pacs::client::station_ae, and kcenon::pacs::client::worklist_match.
Referenced by process_worklist_async().


|
nodiscard |
Process worklist items asynchronously.
| worklist_items | Worklist items from MWL query |
Definition at line 638 of file prefetch_manager.cpp.
References process_worklist().

|
nodiscard |
Remove a prefetch rule.
| rule_id | ID of the rule to remove |
Definition at line 553 of file prefetch_manager.cpp.
References kcenon::pacs::client::prefetch_manager::impl::compatibility_repo, impl_, kcenon::pacs::client::prefetch_manager::impl::logger, kcenon::pacs::client::prefetch_manager::impl::repositories, kcenon::pacs::client::prefetch_repositories::rules, kcenon::pacs::client::prefetch_manager::impl::rules_cache, and kcenon::pacs::client::prefetch_manager::impl::rules_mutex.
| void kcenon::pacs::client::prefetch_manager::set_config | ( | prefetch_manager_config | new_config | ) |
Update configuration.
| new_config | New configuration to apply |
Definition at line 912 of file prefetch_manager.cpp.
References kcenon::pacs::client::prefetch_manager::impl::config, and impl_.
| void kcenon::pacs::client::prefetch_manager::start_scheduler | ( | ) |
Start the scheduler for cron-based rules.
Begins checking and executing scheduled prefetch rules. Does nothing if already running.
Definition at line 776 of file prefetch_manager.cpp.
References impl_, kcenon::pacs::client::prefetch_manager::impl::logger, kcenon::pacs::client::prefetch_manager::impl::scheduler_loop(), kcenon::pacs::client::prefetch_manager::impl::scheduler_running, and kcenon::pacs::client::prefetch_manager::impl::scheduler_thread.

| void kcenon::pacs::client::prefetch_manager::start_worklist_monitor | ( | std::string_view | worklist_node_id | ) |
Start the worklist monitor.
Begins periodic polling of the worklist for new items.
| worklist_node_id | Node ID for worklist queries |
Definition at line 817 of file prefetch_manager.cpp.
References impl_, kcenon::pacs::client::prefetch_manager::impl::logger, kcenon::pacs::client::prefetch_manager::impl::worklist_monitor_loop(), kcenon::pacs::client::prefetch_manager::impl::worklist_monitor_running, kcenon::pacs::client::prefetch_manager::impl::worklist_monitor_thread, and kcenon::pacs::client::prefetch_manager::impl::worklist_node_id.

| void kcenon::pacs::client::prefetch_manager::stop_scheduler | ( | ) |
Stop the scheduler.
Stops the scheduler thread. Does nothing if not running.
Definition at line 789 of file prefetch_manager.cpp.
References impl_, kcenon::pacs::client::prefetch_manager::impl::logger, kcenon::pacs::client::prefetch_manager::impl::scheduler_cv, kcenon::pacs::client::prefetch_manager::impl::scheduler_mutex, kcenon::pacs::client::prefetch_manager::impl::scheduler_running, and kcenon::pacs::client::prefetch_manager::impl::scheduler_thread.
Referenced by ~prefetch_manager().

| void kcenon::pacs::client::prefetch_manager::stop_worklist_monitor | ( | ) |
Stop the worklist monitor.
Stops periodic worklist polling. Does nothing if not running.
Definition at line 831 of file prefetch_manager.cpp.
References impl_, kcenon::pacs::client::prefetch_manager::impl::logger, kcenon::pacs::client::prefetch_manager::impl::worklist_cv, kcenon::pacs::client::prefetch_manager::impl::worklist_monitor_running, kcenon::pacs::client::prefetch_manager::impl::worklist_monitor_thread, and kcenon::pacs::client::prefetch_manager::impl::worklist_mutex.
Referenced by ~prefetch_manager().

|
nodiscard |
Update an existing prefetch rule.
| rule | The rule to update (rule_id must match existing) |
Definition at line 511 of file prefetch_manager.cpp.
References kcenon::pacs::client::prefetch_manager::impl::compatibility_repo, impl_, kcenon::pacs::client::prefetch_manager::impl::logger, kcenon::pacs::pacs_void_error(), kcenon::pacs::client::prefetch_manager::impl::repositories, kcenon::pacs::client::prefetch_rule::rule_id, kcenon::pacs::client::prefetch_repositories::rules, kcenon::pacs::client::prefetch_manager::impl::rules_cache, and kcenon::pacs::client::prefetch_manager::impl::rules_mutex.

|
private |
Definition at line 440 of file prefetch_manager.h.
Referenced by add_rule(), completed_today(), config(), failed_today(), get_rule(), is_scheduler_running(), is_worklist_monitor_running(), list_rules(), pending_prefetches(), prefetch_manager(), prefetch_manager(), prefetch_patient(), prefetch_priors(), prefetch_study(), process_worklist(), remove_rule(), set_config(), start_scheduler(), start_worklist_monitor(), stop_scheduler(), stop_worklist_monitor(), and update_rule().