|
| 1 | +# π Policy Gap Mapper |
| 2 | + |
| 3 | +A Streamlit-based compliance application that uses **Oracle Document Understanding (DU)** and **Generative AI** to analyze regulatory documents and internal policies, then highlight **coverage gaps**. |
| 4 | + |
| 5 | +Upload regulation PDFs/images and your internal policy documents, and the app will: |
| 6 | +- Extract text via **OCI Document Understanding** |
| 7 | +- Use an **LLM** to break regulations into atomic obligations |
| 8 | +- Extract control statements from your policies |
| 9 | +- Map obligations to controls and score coverage |
| 10 | +- Generate an interactive **gap report** and downloadable **CSV** |
| 11 | + |
| 12 | +**Author:** Ali Ottoman |
| 13 | +**Reviewed date:** 05.12.2025 |
| 14 | + |
| 15 | +--- |
| 16 | + |
| 17 | +## π§ Features |
| 18 | + |
| 19 | +### End-to-End DU + LLM Pipeline |
| 20 | +- Upload multiple **regulation** documents and **internal policy** documents (PDF, JPG, PNG). |
| 21 | +- Text is extracted using **OCI Document Understanding** (general text extraction). |
| 22 | +- All downstream reasoning is performed with an **LLM** hosted on OCI Generative AI. |
| 23 | + |
| 24 | +### Obligation Extraction from Regulations |
| 25 | +- Splits regulatory text into manageable chunks. |
| 26 | +- LLM extracts **atomic, testable obligations**, each enriched with: |
| 27 | + - `obligation_text` |
| 28 | + - `article_reference` |
| 29 | + - `category` |
| 30 | + - `criticality` |
| 31 | + - `keywords` |
| 32 | + |
| 33 | +### Control Extraction from Internal Policies |
| 34 | +- LLM identifies **control statements**, each with: |
| 35 | + - `control_text` |
| 36 | + - `control_type` |
| 37 | + - `owner_department` |
| 38 | + - `keywords` |
| 39 | + |
| 40 | +--- |
| 41 | + |
| 42 | +## ποΈ Files & Structure |
| 43 | + |
| 44 | +``` |
| 45 | +. |
| 46 | +βββ files |
| 47 | + βββ policy_gap_mapper.py # Main Streamlit app |
| 48 | + βββ config.py # OCI config & model IDs |
| 49 | +βββ requirements.txt # Dependencies |
| 50 | +βββ README.md # This file |
| 51 | +``` |
| 52 | + |
| 53 | +--- |
| 54 | + |
| 55 | +## βοΈ Setup & Installation |
| 56 | + |
| 57 | +```bash |
| 58 | +git clone https://github.com/your-username/your-repo.git |
| 59 | +cd your-repo |
| 60 | +pip install -r requirements.txt |
| 61 | +``` |
| 62 | + |
| 63 | +Configure `~/.oci/config` and edit: |
| 64 | + |
| 65 | +```python |
| 66 | +COMPARTMENT_ID = "<your-compartment-ocid>" |
| 67 | +MODEL_ID = ["meta.llama-4-maverick-17b-128e-instruct-fp8"] |
| 68 | +``` |
| 69 | + |
| 70 | +--- |
| 71 | + |
| 72 | +## π Run the App |
| 73 | + |
| 74 | +```bash |
| 75 | +streamlit run policy_gap_mapper.py |
| 76 | +``` |
| 77 | + |
| 78 | +--- |
| 79 | + |
| 80 | +## π How to Use |
| 81 | + |
| 82 | +1. Upload regulation & policy documents. |
| 83 | +2. Click **Analyze**. |
| 84 | +3. Review extracted obligations & controls. |
| 85 | +4. Inspect mapping results. |
| 86 | +5. Download the CSV gap report. |
| 87 | + |
| 88 | +--- |
| 89 | + |
| 90 | +## π§ OCI Services Used |
| 91 | + |
| 92 | +- **OCI Document Understanding**: [Link](https://docs.oracle.com/en-us/iaas/Content/document-understanding/using/home.htm) |
| 93 | +- **OCI Generative AI β ChatOCIGenAI**: [Link](https://www.oracle.com/ae/artificial-intelligence/generative-ai/generative-ai-service/) |
| 94 | + |
| 95 | +--- |
| 96 | + |
| 97 | +## π License |
| 98 | + |
| 99 | +MIT License β see `LICENSE` for details. |
0 commit comments