19#ifndef PACS_SERVICES_PIR_PATIENT_RECONCILIATION_SERVICE_HPP
20#define PACS_SERVICES_PIR_PATIENT_RECONCILIATION_SERVICE_HPP
130 std::chrono::system_clock::now()};
238 const std::string& patient_id)
const;
std::vector< core::dicom_dataset > find_instances(const std::string &patient_id) const
Find all instances for a given patient ID.
bool add_instance(const core::dicom_dataset &dataset)
Add a DICOM instance to the managed store.
size_t instance_count() const noexcept
Get the total number of managed instances.
std::vector< core::dicom_dataset > instances_
std::vector< std::string > get_patient_ids() const
Get distinct patient IDs in the store.
reconciliation_result merge_patients(const patient_merge_request &request)
Merge instances from source patient to target patient.
void apply_demographics(core::dicom_dataset &dataset, const patient_demographics &demographics) const
std::vector< reconciliation_audit_record > audit_records_
reconciliation_result update_demographics(const demographics_update_request &request)
Update patient demographics across all matching instances.
std::vector< reconciliation_audit_record > audit_trail_for_patient(const std::string &patient_id) const
Get audit records for a specific patient.
const std::vector< reconciliation_audit_record > & audit_trail() const noexcept
Get the audit trail of reconciliation operations.
std::string generate_record_id() const
patient_reconciliation_service()=default
DICOM Dataset - ordered collection of Data Elements.
reconciliation_type
Type of patient reconciliation operation.
@ patient_link
ADT^A24: link related patients.
@ demographics_update
ADT^A08: update patient demographics.
@ patient_merge
ADT^A40: merge two patients.
Request to update patient demographics.
std::optional< std::string > operator_name
Operator performing the update.
std::string target_patient_id
Patient ID to update.
std::optional< std::string > reason
Reason for update.
patient_demographics updated_demographics
Updated demographics.
Updated patient demographics for a reconciliation operation.
std::optional< std::string > patient_name
Patient Name (0010,0010)
std::optional< std::string > patient_birth_date
Patient Birth Date (0010,0030)
std::optional< std::string > other_patient_ids
Other Patient IDs (0010,1000)
std::optional< std::string > issuer_of_patient_id
Issuer of Patient ID (0010,0021)
std::optional< std::string > patient_id
Patient ID (0010,0020)
std::optional< std::string > patient_sex
Patient Sex (0010,0040)
Request to merge two patients.
std::string target_patient_id
Patient ID to merge into (target - will retain)
std::optional< std::string > reason
Reason for merge.
std::optional< patient_demographics > target_demographics
Optional updated demographics for the target.
std::optional< std::string > operator_name
Operator performing the merge.
std::string source_patient_id
Patient ID to merge from (source - will be removed)
Audit record of a reconciliation operation.
size_t instances_updated
Number of instances affected.
std::string operator_name
Operator who performed the action.
std::chrono::system_clock::time_point timestamp
Timestamp.
std::optional< std::string > secondary_patient_id
reconciliation_type type
Type of operation.
bool success
Whether operation succeeded.
std::string record_id
Unique identifier for this audit record.
std::string primary_patient_id
Patient ID(s) involved.
Result of a reconciliation operation.
size_t instances_updated
Number of instances affected.
std::string error_message
Error message (if failed)
size_t studies_affected
Number of studies affected.
std::chrono::system_clock::time_point timestamp
Timestamp of the operation.
reconciliation_type type
Type of operation performed.
bool success
Whether the operation succeeded.