# MIKA De-ID Local 0.2.1

MIKA De-ID Local is an open-source, offline, review-first product by NPO NT that creates a new PDF copy of a medical document with selected direct identifiers physically removed from rendered page pixels.

The project is currently **LOCAL / SYNTHETIC DATA ONLY**. It is not approved for real patient documents, is not a medical device, does not provide diagnosis or treatment advice, and does not certify that a document is anonymous.

## Open-source licence

Copyright (C) 2026 NPO NT.

The application is licensed under the GNU Affero General Public License version 3 only (`AGPL-3.0-only`). The full text is in `LICENSE`; the Corresponding Source commitment is in `SOURCE_OFFER.md`; component attributions are in `THIRD_PARTY_NOTICES.md`; the direct-development SBOM is in `sbom/`.

The software licence does not make patient documents or medical datasets public. Never place patient data, credentials, tokens, keys, or production configuration in the source repository.

Public source and immutable release materials are available at <https://npo-nt.ru/open-source/mika-deid/>. The public Git clone URL and SHA-256 values are published on that page. This source publication does not authorize a patient-facing binary: each future binary must still identify its exact matching source commit and archive.

## Safety properties in v0.2

- The original file is opened read-only and is never overwritten.
- PDF pages are rendered and the result is rebuilt as a new raster-only PDF.
- Original text layers, annotations, forms, attachments, JavaScript, and metadata are not copied.
- OCR and barcode detection are local; no cloud API is used.
- Findings are shown for page-by-page human confirmation.
- Clinical event dates are shown as yellow review candidates and are preserved by default; date of birth remains a red direct identifier selected for removal.
- The review canvas supports zoom, scrolling, selected-region highlighting, explicit removal toggling, deletion of manual regions, and one-step undo for manual masks.
- Local analysis reports its current stage, page count, percentage, elapsed time, and an estimated remaining time; it can be cancelled between processing stages.
- If final verification detects a residual direct-identifier candidate, the candidate is mapped back to the source-page view, preselected as a new redaction, and the affected page must be reviewed and confirmed again before another release attempt.
- The user chooses the output folder and filename. After successful verification, the cleaned PDF can be opened directly or revealed in the operating system's file manager. If the application has been restarted, these actions prompt for a previously created PDF instead of silently doing nothing; document paths are not persisted between sessions.
- The output is reopened and checked before it is released from a temporary location.
- Exported reports contain counts and categories, not detected source text or the original filename.

## Important limitations

- Automated detection cannot guarantee that every identifier will be found.
- Handwriting, low-quality scans, rare indirect identifiers, faces, signatures, and unusual page layouts require human review.
- The prototype does not yet encrypt its transient in-memory page images.
- DICOM is explicitly unsupported in v0.2.
- The output is a modified navigation copy and invalidates any signature on the source PDF.
- A document uploaded from an identified account remains linkable to that account even if identifiers are removed from the page.

## Supported input

- PDF
- JPEG/JPG
- PNG
- TIFF
- HEIC/HEIF when `pillow-heif` is installed

The default limits are 100 MiB and 200 pages. Encrypted PDFs are rejected.

## Local setup

```bash
python3 -m venv .venv
.venv/bin/python -m pip install -r requirements-lock.txt
.venv/bin/python -m pip install --no-deps -e .
```

Tesseract 5 must be installed locally. Russian and English language files can be placed in `models/tessdata/`. The application never downloads models at runtime.

Run dependency diagnostics:

```bash
.venv/bin/mika-deid doctor
```

Launch the review interface:

```bash
.venv/bin/mika-deid-gui
```

Analyze without emitting detected text:

```bash
.venv/bin/mika-deid analyze document.pdf
```

The CLI does not silently auto-approve a document. Use the GUI for page confirmation and manual redactions.

## Repository map

- `src/mika_deid/`: local processing engine and GUI
- `tests/`: unit and end-to-end safety tests
- `scripts/`: synthetic fixtures, privacy-safe corpus analysis, preannotation export, registry-value evaluation, and QA helpers
- `docs/`: product, security, validation, dataset, and release documentation
- `examples/`: synthetic-only input and output
- `models/tessdata/`: locally bundled OCR language data for development
- `sbom/`: direct-component CycloneDX inventory
- `third_party_licenses/`: bundled third-party licence texts

## Read before any pilot

See:

- `docs/PRODUCT_REQUIREMENTS.md`
- `docs/DEIDENTIFICATION_POLICY.md`
- `docs/THREAT_MODEL.md`
- `docs/VALIDATION_PLAN.md`
- `docs/SYNTHETIC_CORPUS_QA_2026-08-27.md`
- `docs/DATASET_CONTRACT.md`
- `docs/DEPENDENCY_REVIEW.md`
- `docs/OPEN_SOURCE_GOVERNANCE.md`
- `docs/RELEASE_GATES.md`
