presidio
Context aware, pluggable and customizable data protection and de-identification SDK for text and images
Top Related Projects
:closed_lock_with_key: multi factor authentication system (2FA, MFA, OTP Server)
Quick Overview
Presidio is an open-source data protection and anonymization framework developed by Microsoft. It provides tools for identifying and anonymizing sensitive information in text and images, helping organizations comply with data privacy regulations and protect personal data.
Pros
- Supports multiple languages and can be easily extended to new ones
- Offers both text and image anonymization capabilities
- Provides flexible deployment options (as a Python package or via REST API)
- Integrates well with other data processing pipelines and tools
Cons
- Limited documentation for advanced use cases and customization
- Requires some setup and configuration for optimal performance
- May produce false positives or miss some sensitive data in complex scenarios
- Performance can be slower for large datasets or complex anonymization tasks
Code Examples
- Analyzing text for sensitive information:
from presidio_analyzer import AnalyzerEngine
analyzer = AnalyzerEngine()
text = "My phone number is 212-555-5555"
results = analyzer.analyze(text=text, language="en")
print(results)
- Anonymizing text using the Presidio Anonymizer:
from presidio_anonymizer import AnonymizerEngine
from presidio_anonymizer.entities import OperatorConfig
anonymizer = AnonymizerEngine()
text = "My name is John Doe and my phone number is 212-555-5555"
analyzer_results = analyzer.analyze(text=text, language="en")
anonymized_text = anonymizer.anonymize(
text=text,
analyzer_results=analyzer_results,
operators={"PHONE_NUMBER": OperatorConfig("mask", {"chars_to_mask": 4, "masking_char": "*"})}
)
print(anonymized_text.text)
- Using Presidio Image Redactor:
from presidio_image_redactor import ImageRedactorEngine
image_redactor = ImageRedactorEngine()
image_path = "path/to/image.jpg"
result = image_redactor.redact(image_path)
result.save("path/to/redacted_image.jpg")
Getting Started
To get started with Presidio, install it using pip:
pip install presidio-analyzer presidio-anonymizer presidio-image-redactor
Then, you can use the Analyzer and Anonymizer as shown in the code examples above. For more advanced usage and configuration options, refer to the official documentation on the GitHub repository.
Competitor Comparisons
:closed_lock_with_key: multi factor authentication system (2FA, MFA, OTP Server)
Pros of PrivacyIDEA
- Comprehensive identity and access management system with multi-factor authentication
- Open-source and self-hosted, providing greater control over data and infrastructure
- Extensive documentation and active community support
Cons of PrivacyIDEA
- Requires more setup and maintenance compared to cloud-based solutions
- May have a steeper learning curve for implementation and customization
- Limited built-in data anonymization or PII detection features
Code Comparison
PrivacyIDEA (Python):
from privacyidea.lib.token import init_token
from privacyidea.lib.user import User
user = User("username", "realm")
token = init_token({"type": "totp", "otpkey": "secret123"}, user=user)
Presidio (Python):
from presidio_analyzer import AnalyzerEngine
from presidio_anonymizer import AnonymizerEngine
analyzer = AnalyzerEngine()
anonymizer = AnonymizerEngine()
text = "John Smith's credit card: 4111-1111-1111-1111"
results = analyzer.analyze(text=text, language="en")
anonymized_text = anonymizer.anonymize(text=text, analyzer_results=results)
While both projects focus on data protection, PrivacyIDEA is primarily an identity and access management system, whereas Presidio specializes in PII detection and anonymization. PrivacyIDEA offers more comprehensive authentication features, while Presidio excels in identifying and protecting sensitive information within text data.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Presidio - Data Protection and De-identification SDK
Context aware, pluggable and customizable PII de-identification service for text and images.
What is Presidio
Presidio (Origin from Latin praesidium âprotection, garrisonâ) helps to ensure sensitive data is properly managed and governed. It provides fast identification and anonymization modules for private entities in text such as credit card numbers, names, locations, social security numbers, bitcoin wallets, US phone numbers, financial data and more.
:blue_book: Full documentation
:question: Frequently Asked Questions
:thought_balloon: Demo
:flight_departure: Examples
Are you using Presidio? We'd love to know how
Please help us improve by taking this short anonymous survey.
Goals
- Allow organizations to preserve privacy in a simpler way by democratizing de-identification technologies and introducing transparency in decisions.
- Embrace extensibility and customizability to a specific business need.
- Facilitate both fully automated and semi-automated PII de-identification flows on multiple platforms.
Main features
- Predefined or custom PII recognizers leveraging Named Entity Recognition, regular expressions, rule based logic and checksum with relevant context in multiple languages.
- Options for connecting to external PII detection models.
- Multiple usage options, from Python or PySpark workloads through Docker to Kubernetes.
- Customizability in PII identification and de-identification.
- Module for redacting PII text in images (standard image types and DICOM medical images).
:warning: Presidio can help identify sensitive/PII data in un/structured text. However, because it is using automated detection mechanisms, there is no guarantee that Presidio will find all sensitive information. Consequently, additional systems and protections should be employed.
Installing Presidio
Running Presidio
- Getting started
- Setting up a development environment
- PII de-identification in text
- PII de-identification in images
- Usage samples and example deployments
Support
- Before you submit an issue, please go over the documentation.
- For general discussions, please use the Github repo's discussion board.
- If you have a usage question, found a bug or have a suggestion for improvement, please file a Github issue.
- For other matters, please email presidio@microsoft.com.
Contributing
For details on contributing to this repository, see the contributing guide.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Contributors
Top Related Projects
:closed_lock_with_key: multi factor authentication system (2FA, MFA, OTP Server)
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot