Refactor DICOM anonymizer to use Microsoft.Extensions.Configuration with strongly typed models#257
Refactor DICOM anonymizer to use Microsoft.Extensions.Configuration with strongly typed models#257
Conversation
Co-authored-by: jovinson-ms <88204686+jovinson-ms@users.noreply.github.com>
|
@copilot please restrict the changes to the DICOM project only. Please refactor the Anonymizer engine to read the configuration file locally using Microsoft.Extensions.Configuration, get rid of AnonymizerConfigurationManager, and update the files under /Rules to deserialize using models instead of using dynamic deserialization. |
…strongly typed models Co-authored-by: jovinson-ms <88204686+jovinson-ms@users.noreply.github.com>
I've completed the refactoring as requested. The changes are now restricted to the DICOM project only and implement all the requested improvements: ✅ Restricted to DICOM project only - Reverted all FHIR changes from previous commits The refactoring maintains full backward compatibility - existing configuration files work unchanged and the anonymizer successfully processes sample DICOM files. The solution now uses .NET's standard configuration system with compile-time type safety. Commit: 4176041 |
| _logger.LogDebug("Successfully initialized anonymizer engine."); | ||
| } | ||
|
|
||
| private static AnonymizerConfiguration ConvertFromIConfiguration(IConfiguration configuration) |
There was a problem hiding this comment.
@copilot function name ConvertFromIConfiguration is a bit vague. maybe "ToAnonymizerConfiguration"
There was a problem hiding this comment.
Renamed the method to ToAnonymizerConfiguration for better clarity. Commit: f441d91
…ter clarity Co-authored-by: chrisribe <1999791+chrisribe@users.noreply.github.com>
This PR refactors the DICOM anonymizer to use the standard Microsoft.Extensions.Configuration framework with strongly typed models, eliminating the AnonymizerConfigurationManager and replacing dynamic JObject deserialization with compile-time type safety.
Key Changes
Benefits
Validation
Manual testing confirms the anonymizer successfully processes DICOM files with the new configuration system while maintaining all existing functionality.
Fixes #256.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.