How allangalli/hotswappii works
Main Components
• Entry Point & UI: app.py and the ui/ directory contain the Streamlit interface panels (input, evaluation, benchmarks, etc.). They handle user interactions and display results.
• Core Logic: The core/ directory holds the detection, anonymization, and evaluation logic.
• Models: The models/ directory implements different NER engines and a model factory to switch between them.
• Configuration: The config/ directory contains configuration settings used across the application.
• Utilities: The utils/ directory provides supporting functions such as data processing, metrics calculations, and visualization.
• Data Storage: The data/ directory stores both sample text data and benchmark datasets/results.
Relationships & Data Flow
• The UI component (ui/) receives user input and settings, then passes them to the core detection logic (core/).
• The core module routes the input to the appropriate model (from models/) based on the configuration (config/).
• Results (detection and anonymization outcomes) are processed further for evaluation using utilities (utils/) and results stored in the data/ folder.
• Additional modules like synthetic data generation and evaluation functions integrate with external services (e.g., OpenAI, Microsoft Presidio).
Design Patterns & Technologies
• MVC/MVVM-like separation: The UI (view) is clearly separated from business logic (core) and data handling (models, utils).
• Modular design: Components are split into clear directories for configuration, processing, and presentation.
• Technologies: Streamlit drives the UI; SpaCy, transformers, and custom recognizers implement NER; and Python utilities manage data and metrics.