PromptBase
Upgrade
Close icon
General
Home
Marketplace
Create
Hire
Login
Chat
Sell
Explore

Prompt Details

Model
Chat - (gpt-6-luna)
Token size
1,757
Example input
[ENTERPRISE_DATA_DOMAIN_AND_CORPUS]: 250,000 Electronic Health Record (EHR) physician clinical progress notes, laboratory diagnostics, and billing records containing unstructured patient narratives [REGULATORY_FRAMEWORK_AND_PII_TYPES]: HIPAA Privacy Rule Safe Harbor 18 identifiers, including patient names, SSNs, dates of admission/birth, medical record numbers, and 5-digit postal ZIP codes [ANONYMIZATION_ENGINE_AND_PIPELINE_STACK]: Microsoft Presidio with spaCy transformer en_core_web_trf, AES-FF1 format-preserving encryption via pyffx, k-anonymity gate (min k=5), and Faker synthetic replacement
Example output
# Enterprise Data Privacy & PII De-Identification OS ==================================================================== MODULE 1: DATA CLASSIFICATION, PII TAXONOMY & REGULATORY BOUNDARIES ==================================================================== - Enterprise Data Ingestion & Boundary Analysis: * Corpus: 250,000 unstructured Electronic Health Record (EHR) physician clinical notes and billing claim records. * Regulations: HIPAA Privacy Rule Safe Harbor (45 CFR § 164.514(b)(2)) requiring the elimination of 18 specific personal identifiers. * Data Sensitivity Tiering Matrix: | Attribute Name | Identifier Category | Detection Strategy | Transformation Policy | | :--- | :--- | :--- | :--- | | Patient Full Name | Direct Identifier | Presidio Spacy NER + Title Context | Synthetic Replacement (Faker) | | Social Security (SSN) | Direct Identifier | Regex Pattern + Luhn Verification | Irreversible Cryptographic Redaction | | Medical Record No (MRN)| Direct Identifier | Custom Regex + Context Words | AES-FF1 Format-Preserving Encryption | | Date of Birth / Visit | Quasi-Identifier | Presidio DateTime Recognizer | Uniform Date Shifting (-60 to +60 days) | | 5-Digit Postal ZIP Code | Quasi-Identifier | Regex + Census Density Lookup | 3-Digit Aggregation (000 if pop < 20,000)| | Diagnosis (ICD-10 Code)| Sensitive Attribute | Dictionary Mapping | Retained Intact for Model Training Utility | ==================================================================== MODULE 2: PRESIDIO ANALYZER ENGINE & CUSTOM ENTITY RECOGNIZERS ==================================================================== - Complete Compilable Detection Engine (`src/presidio_engine.py`): ```python import re from typing import List from presidio_analyzer import ( AnalyzerEngine, PatternRecognizer, Pattern, RecognizerRegistry, RecognizerResult ) from presidio_analyzer.nlp_engine import NlpEngineProvider def build_custom_privacy_analyzer() -> AnalyzerEngine: # Pinned configuration using spacy en_core_web_trf nlp_configuration = { "nlp_engine_name": "spacy", "models": [{"lang_code": "en", "model_name": "en_core_web_trf"}] } provider = NlpEngineProvider(nlp_configuration=nlp_configuration) nlp_engine = provider.create_engine() registry = RecognizerRegistry() registry.load_predefined_recognizers(nlp_engine=nlp_engine) # Custom Medical Record Number (MRN) Pattern: "MRN-" followed by 8 digits mrn_pattern = Pattern( name="mrn_pattern", regex=r"\b(?:MRN|RECORD|PATIENT\s*ID)[:\s#-]*([0-9]{8})\b", score=0.85 ) mrn_recognizer = PatternRecognizer( supported_entity="MEDICAL_RECORD_NUMBER", patterns=[mrn_pattern], context=["mrn", "patient", "admitted", "clinic", "hospital"] ) registry.add_recognizer(mrn_recognizer) return AnalyzerEngine(nlp_engine=nlp_engine, registry=registry) if __name__ == "__main__": analyzer = build_custom_privacy_analyzer() text_sample = "Patient John Doe, MRN: 98412849, admitted on 2026-04-12 with acute hypertension." results = analyzer.analyze(text=text_sample, language="en") for res in results: print(f"Detected: {res.entity_type} ({res.start}:{res.end}) - Confidence: {res.score:.2f}") import pyffx import hmac import hashlib class FPETokenizer: def __init__(self, encryption_key: bytes, hmac_salt: bytes): self.encryption_key = encryption_key self.hmac_salt = hmac_salt # FF1 cipher configured for 8-digit numeric strings (radix 10) self.numeric_cipher_8 = pyffx.Integer(self.encryption_key, length=8) def encrypt_mrn(self, mrn_str: str) -> str: clean_digits = re.sub(r"\D", "", mrn_str) if len(clean_digits) != 8: raise ValueError("MRN must be exactly 8 digits for AES-FF1 formatting.") val = int(clean_digits) encrypted_int = self.numeric_cipher_8.encrypt(val) return f"{encrypted_int:08d}" def decrypt_mrn(self, encrypted_mrn_str: str) -> str: val = int(encrypted_mrn_str) decrypted_int = self.numeric_cipher_8.decrypt(val) return f"{decrypted_int:08d}" def hash_ssn_irreversible(self, ssn_str: str) -> str: clean_ssn = re.sub(r"\D", "", ssn_str) return hmac.new(self.hmac_salt, clean_ssn.encode("utf-8"), hashlib.sha256).hexdigest() CREATE TABLE IF NOT EXISTS tokenization_audit_vault ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), token_hash VARCHAR(64) NOT NULL UNIQUE, entity_type VARCHAR(32) NOT NULL, created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), access_count INTEGER NOT NULL DEFAULT 0, last_accessed_at TIMESTAMPTZ ); CREATE INDEX idx_vault_token_hash ON tokenization_audit_vault(token_hash); import pandas as pd from typing import List, Tuple def evaluate_k_anonymity(df: pd.DataFrame, quasi_identifiers: List[str], min_k: int = 5) -> Tuple[bool, int, float]: # Group by quasi-identifiers to identify equivalence classes grouped = df.groupby(quasi_identifiers).size().reset_index(name="class_size") lowest_k = int(grouped["class_size"].min()) violating_classes = grouped[grouped["class_size"] < min_k] violation_ratio = float(len(violating_classes) / len(grouped)) is_passed = (lowest_k >= min_k) print(f"(PRIVACY_GATE) Smallest Equivalence Class k={lowest_k} | Target k={min_k}") print(f"(PRIVACY_GATE) Violating Equivalence Classes: {len(violating_classes)} ({violation_ratio:.2%})") return is_passed, lowest_k, violation_ratio if __name__ == "__main__": sample_data = pd.DataFrame({ "zip_code": ["902", "902", "902", "902", "902", "100", "100"], "age_band": ["40-49", "40-49", "40-49", "40-49", "40-49", "60-69", "60-69"], "gender": ["M", "M", "M", "M", "M", "F", "F"] }) passed, actual_k, ratio = evaluate_k_anonymity(sample_data, ["zip_code", "age_band", "gender"], min_k=5) assert not passed, "Test correctly detected failing k-anonymity on postal cluster 100!" import random from datetime import timedelta from faker import Faker from presidio_anonymizer import AnonymizerEngine from presidio_anonymizer.entities import OperatorConfig fake = Faker() anonymizer = AnonymizerEngine() def anonymize_clinical_record(raw_text: str, analyzer_results, date_offset_days: int) -> str: # Custom substitution operators replacing PII with synthetically valid names operators = { "PERSON": OperatorConfig("custom", {"lambda": lambda _: fake.name()}), "PHONE_NUMBER": OperatorConfig("custom", {"lambda": lambda _: fake.phone_number()}), "EMAIL_ADDRESS": OperatorConfig("custom", {"lambda": lambda _: fake.email()}), "MEDICAL_RECORD_NUMBER": OperatorConfig("replace", {"new_value": "<MRN_ENCRYPTED_FF1>"}), } anonymized_result = anonymizer.anonymize( text=raw_text, analyzer_results=analyzer_results, operators=operators ) return anonymized_result.text { "audit_manifest_version": "1.0.0", "timestamp": "2026-09-29T10:15:00Z", "regulatory_framework": "HIPAA Safe Harbor 45 CFR 164.514(b)", "dataset_metrics": { "raw_record_count": 250000, "anonymized_record_count": 250000, "input_corpus_sha256": "3a8f1b2c5d8e9f0a1b2c3d4e5f6a7b8c", "output_clean_room_sha256": "9f8e7d6c5b4a3210fedcba9876543210" }, "privacy_guarantees": { "achieved_k_anonymity": 5, "direct_identifiers_removed": 18, "format_preserving_encryption": "AES-FF1 (NIST SP 800-38G)", "re_identification_risk_score": 0.012 }, "compliance_officer_approval": { "status": "APPROVED_FOR_MODEL_TRAINING", "dpo_signature": "CERT_VALIDATED_HEALTHCARE_DPO_9941" } }
GPT

Hello Unfortunately Your Autonomous Br

Add to Cart
PromptBase Select
Get this prompt + 9 more with SelectFrom $14/mo · Cancel anytimeFrom $14/mo · Cancel anytime
View Select
Instant accessInstant access
Usage rightsCommercial use
Money-back guaranteeMoney‑back
By purchasing this prompt, you agree to our terms of service
GPT-6-LUNA
Tested icon
Guide icon
4 examples icon
Free credits icon
An enterprise synthetic data privacy & PII de-identification operating system. Generates Microsoft Presidio custom recognizers, AES-FF1 Format-Preserving Encryption (FPE), k-anonymity risk scorers, synthetic replacement pipelines, and audit-ready HIPAA/GDPR compliance logs in one pass.
...more
Added 1 week ago
Report
Browse Marketplace