alt-format-codes 0.1.0
Automates extraction and conversion of accessible PDFs to CSV, Word, and Large Print.
License: MIT
Requires Python: >=3.7

﻿# Alt-Format-Codes

## ✨ Welcome to the Alt Format Document Extraction and Automation System ✨

### Overview
This system automates the creation of accessible large print (LP) documents in two main steps:

- ✅ **STEP 1** – Extract content from original PDFs and save it to a CSV file.
- ✅ **STEP 2** – Use the CSV and a Word template to generate Word and (optionally) PDF documents in large print format.

[Deprecated] ~~📄 For detailed guidance, refer to the [Alt Format Codes User Guide](https://docs.google.com/document/d/1khxSU-FhR3tyZBL8cdg_LYHDKCAn25bDEaEmhjs_AyU/edit?usp=sharing).~~

---

### ⚙️ Setup

#### 🐍 Creating a Virtual Environment

To create the virtual environment, run:

```bash
python -m venv .venv
```

---

### 🛠️ Activating the Virtual Environment

Before running any scripts, activate the virtual environment so all dependencies are available:

| Terminal           | Activation Command                                               |
|--------------------|------------------------------------------------------------------|
| **PowerShell**     | `.venv\Scripts\Activate.ps1` or `. .venv\Scripts\Activate.ps1` |
| **Command Prompt** | `.venv\Scripts\activate.bat`                                   |
| **Git Bash**       | `source .venv/Scripts/activate`                                  |

---

#### 🔍 How to Confirm the Virtual Environment Is Active

If you don’t see `(.venv)` in the terminal prompt, use these checks to confirm the virtual environment is active:

- **Check Python environment path**
  ```powershell
  python -c "import sys; print(sys.prefix)"
  ```
  This should return a path ending in `.venv`.

- **Check virtual environment environment variable**
  ```powershell
  $env:VIRTUAL_ENV
  ```
  This should return the full path to the active virtual environment.

- **Check VS Code status bar**
  The bottom-left of VS Code should display something like:
  `Python 3.x.x  (.venv)`

---

#### 🧩 PowerShell Execution Policy (if you see a security error)

If PowerShell blocks the activation script, you’ll see an error like:

> "running scripts is disabled on this system..."

To fix it:

1. Open PowerShell **as Administrator**
2. Run this command:

```powershell
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
```

3. Type `Y` to confirm.

This allows safe local scripts (like your virtual environment activator) to run.

---

### 📦 Installing Dependencies

Install required Python dependencies:

```bash
pip install -r requirements.txt
```


#### ✅ **Optional but recommended:**

Upgrade `pip` to the latest version before installing requirements:

```bash
python -m pip install --upgrade pip
```

> **Note:** For EOB document support (as of 4/18), additional setup may be needed for `pytesseract` and related tools. Refer to the header in `extract_eob_wa.py` for details.

- 📄 [requirements.txt](./requirements.txt) — List of all required Python dependencies  
- 📊 [Reference Spreadsheet: Template/PDF Info](https://accessingenuityllc.sharepoint.com/:x:/g/EayDnOyP5pdDpvJ0k4_3IKUBBuCLtzkSi8ecxdihlIA1EA?e=0a6Y8N)

---

### 🧪 Execution (First-Time Setup in VS Code)

1. Open the **Run and Debug** sidebar.
2. From the dropdown, select **Run current file with root CWD**.
3. Click the **Run** button (▶️).
4. Going forward, you can run scripts using the standard run button (now with a bug icon).

---

#### 📦 Standalone Execution (Generate a Windows executable that runs without Python)

To create a standalone .exe file that doesn’t require Python installed on the target machine, run:  
```bash
pyinstaller pyinstaller_build\alt_format_generator.spec `
  --distpath pyinstaller_dist `
  --workpath pyinstaller_build `
  --clean
```

This will produce the executable here:  
```bash
dist/alt_format_generator.exe
```

---

### 👥 Authors

- Arsh Kaur (arshkauxr@gmail.com)  
- Alex Reed  
- Sebastian Wcislo (sebastianw@accessingenuity.com)  
- Wesley Coburn (wgcoburn@gmail.com)  

---

**Last Updated:**  
Wesley Coburn — 2025-06-04