Skip to content

PII Anonymizer service based on python with FastAPI

Notifications You must be signed in to change notification settings

omers/pii-anonymizer-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI PII Data Anonymization Service

FastAPI Logo

This repository contains a FastAPI service that utilizes the presidio_anonymizer package to remove Personally Identifiable Information (PII) data from JSON input. This is particularly useful for anonymizing sensitive information in text data before storage or analysis.

Installation

To set up and run this FastAPI service, follow these steps:

  1. Clone this repository to your local machine:

    git clone https://github.com/omers/pii-anonymizer-api.git
  2. Navigate to the project directory:

    cd pii-anonymizer-api
  3. Create a virtual environment (recommended) and activate it:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  4. Install the required dependencies:

    pip install -r requirements.txt

Usage

  1. Start the FastAPI service:

    uvicorn main:app --host 0.0.0.0 --port 8000

    The service will start and listen on http://localhost:8000.

  2. Make a POST request to the /anonymize endpoint with JSON data containing the text to be anonymized:

    {
        "text": "John Doe's email is [email protected] and his phone number is 555-1234."
    }

    You can use tools like curl or Postman to send POST requests to the endpoint.

  3. The service will respond with the anonymized text:

    {
        "text": "[PII_EMAIL] email is [PII_EMAIL] and his phone number is [PII_PHONE_US]."
    }

Configuration

You can modify the behavior of the anonymization process by editing the config.json file. The available configuration options can be found in the presidio_anonymizer documentation.

Contributing

Contributions to this project are welcome! If you encounter issues or have suggestions for improvements, please feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License.


Note: This readme is a template and may need to be customized based on your project's actual structure and requirements. Make sure to replace placeholders (e.g., [PII_EMAIL], [PII_PHONE_US], your-username, etc.) with actual values and information specific to your project.

About

PII Anonymizer service based on python with FastAPI

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published