# Synthetic-stage user guide

## Before opening a file

- Use only synthetic test documents in version 0.2.
- Close applications that automatically sync the selected folder.
- Confirm that Tesseract Russian/English models and barcode detection are available with `mika-deid doctor`.
- Review copyright, AGPL, and source information with `mika-deid license` or the GUI button "О программе и лицензии".

## Review workflow

1. Select a PDF or photograph.
2. Wait for local analysis. The interface shows the current stage, page number, percentage, elapsed time, and an estimated remaining time after the first page. Use the cancel button if the wrong file was selected.
3. Review red and yellow regions on page 1. Red regions are selected for removal. Yellow clinical dates are preserved by default so the chronology of analyses, operations, hospitalization, and treatment remains readable; select a yellow region and explicitly enable removal only when that particular date should be excluded. Use **Zoom in**, **Zoom out**, or **Fit to window** above the page. A zoomed page can be moved with the scrollbars, mouse wheel, or trackpad.
4. Click a region to select it, then use **Remove / do not remove selected region**. The selected region has a blue outline.
5. Drag over any missed identifier to add a manual mask. If the drag was accidental, click **Undo last** or press `Command-Z` / `Ctrl-Z`. A selected manual region can also be removed with **Delete manual region**, `Delete`, or `Backspace`.
6. Read page warnings.
7. Confirm the page.
8. Repeat for every page.
9. Use **Choose folder and copy name** to select an explicit destination. Use a neutral filename without a name, diagnosis, or date of birth. If no path was selected in advance, the application asks for one when **Create and verify copy** is pressed.
10. After a successful final verification, use **Open copy** or **Show in folder**. These buttons remain usable after the application is restarted: if no copy was created in the current session, choose a previously created PDF when prompted. The application deliberately does not persist a document path between sessions because a path or filename may itself contain identifying information. Inspect the resulting PDF once more in a separate viewer; it is a document for additional human checking, not an anonymity certificate.

## Residual findings during final verification

Final verification repeats local OCR and direct-identifier detection on the candidate raster PDF. Masking other regions can change OCR segmentation, so this pass can occasionally detect a candidate that was not detected during the initial full-page OCR.

If that happens, the candidate PDF is not released. The application maps every residual region back to the source-page view, adds it as a selected red region, lists the category and affected page without displaying detected source text, and removes confirmation only from affected pages. Review those regions, confirm the affected pages again, and use "Create and verify copy again". The previously selected output path is retained for this retry.

After a successful retry, the completion notice and privacy-safe verification report state how many final-verification redactions were confirmed and removed by category. The application never silently publishes a copy containing newly detected regions, and it does not silently remove extra clinical text without another page review.

## Failure behavior

The application blocks output when Russian OCR or barcode detection is missing, a page is unconfirmed, the output path already exists, the source changes during processing, or the new PDF fails structural/residual checks.

ZIP archives are not input documents. Extract an archive first and select one supported PDF or image. If loading or analysis fails, the interface must display the error and return to the file-selection state instead of remaining indefinitely busy.

Do not bypass a block for patient use. Improve the input photograph, install the required local component, or escalate the page for manual handling under an approved process.
