28#include <kcenon/common/patterns/result.h>
266 -> std::optional<std::chrono::days>;
283 std::chrono::days min_days = std::chrono::days{-365},
284 std::chrono::days max_days = std::chrono::days{365}
285 ) -> std::chrono::days;
297 -> kcenon::common::VoidResult;
324 -> std::optional<std::
string>;
356 -> std::map<core::dicom_tag, tag_action_config>;
363 -> std::vector<core::dicom_tag>;
370 -> std::vector<core::dicom_tag>;
402 [[nodiscard]]
auto shift_date(std::string_view date_string)
const
405 [[nodiscard]]
auto hash_value(std::string_view value)
const
408 [[nodiscard]]
auto encrypt_value(std::string_view value)
const
DICOM de-identification profiles per PS3.15 Annex E.
void clear_custom_actions()
Clear all custom tag actions.
auto hash_value(std::string_view value) const -> std::string
~anonymizer()=default
Default destructor.
static auto get_hipaa_identifier_tags() -> std::vector< core::dicom_tag >
Get a list of HIPAA Safe Harbor identifier tags.
private_tag_action private_tag_action_
Action for private tags.
void set_detailed_reporting(bool enable)
Enable detailed action recording.
std::optional< std::string > hash_salt_
Hash salt.
auto apply_action(core::dicom_dataset &dataset, core::dicom_tag tag, const tag_action_config &config, uid_mapping *mapping) -> tag_action_record
void add_tag_action(core::dicom_tag tag, tag_action_config config)
Add or override a tag action.
void set_hash_salt(std::string salt)
Set salt for hash operations.
anonymizer(anonymization_profile profile=anonymization_profile::basic)
Construct with a specific profile.
static auto get_gdpr_personal_data_tags() -> std::vector< core::dicom_tag >
Get a list of GDPR personal data tags.
auto get_tag_action(core::dicom_tag tag) const -> tag_action_config
Get the effective action for a tag.
std::optional< std::chrono::days > date_offset_
Date offset for shifting.
void set_profile(anonymization_profile profile)
Set a new profile.
auto get_date_offset() const noexcept -> std::optional< std::chrono::days >
Get the current date offset.
void initialize_profile_actions()
static auto get_profile_actions(anonymization_profile profile) -> std::map< core::dicom_tag, tag_action_config >
Get tags to process for a given profile.
std::vector< std::uint8_t > encryption_key_
Encryption key (if set)
void clear_date_offset()
Clear the date offset (dates will be zeroed instead)
void add_tag_actions(const std::map< core::dicom_tag, tag_action_config > &actions)
Add multiple tag actions.
auto anonymize_with_mapping(core::dicom_dataset &dataset, uid_mapping &mapping) -> kcenon::common::Result< anonymization_report >
Anonymize with consistent UID mapping.
auto has_encryption_key() const noexcept -> bool
Check if encryption is configured.
auto get_hash_salt() const -> std::optional< std::string >
Get the current hash salt.
static auto generate_random_date_offset(std::chrono::days min_days=std::chrono::days{-365}, std::chrono::days max_days=std::chrono::days{365}) -> std::chrono::days
Generate a random date offset.
anonymization_profile profile_
Current anonymization profile.
auto set_encryption_key(std::span< const std::uint8_t > key) -> kcenon::common::VoidResult
Set encryption key for encrypt actions.
void set_date_offset(std::chrono::days offset)
Set date offset for longitudinal consistency.
auto encrypt_value(std::string_view value) const -> kcenon::common::Result< std::string >
auto get_profile() const noexcept -> anonymization_profile
Get the current profile.
auto is_detailed_reporting() const noexcept -> bool
Check if detailed reporting is enabled.
bool detailed_reporting_
Whether to include detailed action records in report.
auto get_private_tag_action() const noexcept -> private_tag_action
Get the current private tag action.
auto remove_tag_action(core::dicom_tag tag) -> bool
Remove a custom tag action (reverts to profile default)
std::map< core::dicom_tag, tag_action_config > custom_actions_
Custom tag actions (override profile defaults)
auto anonymize(core::dicom_dataset &dataset) -> kcenon::common::Result< anonymization_report >
Anonymize a DICOM dataset.
auto operator=(const anonymizer &other) -> anonymizer &
Copy assignment.
void set_private_tag_action(private_tag_action action)
Set the action to take on private tags during anonymization.
DICOM Dataset - ordered collection of Data Elements.
DICOM Tag representation (Group, Element pairs)
anonymization_profile
DICOM de-identification profiles based on PS3.15 Annex E.
@ basic
Basic Profile - Remove direct identifiers.
@ shift_date
Shift dates by a fixed offset.
private_tag_action
Action to take on private tags during anonymization.
@ keep
Preserve all private tags (default for backward compatibility)
@ remove_data
Remove private data elements but keep creators (for auditing)
@ remove_all
Remove all private data elements and their creators.
Configuration for a custom tag action.
Record of an action performed on a tag.
Tag action definitions for DICOM de-identification.
UID mapping for consistent de-identification across studies.