Skip to content

Commit bf50e85

Browse files
committed
New asset (policy gap mapper)
1 parent 4acfcf9 commit bf50e85

File tree

5 files changed

+696
-0
lines changed

5 files changed

+696
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Copyright (c) 2025 Oracle and/or its affiliates.
2+
3+
The Universal Permissive License (UPL), Version 1.0
4+
5+
Subject to the condition set forth below, permission is hereby granted to any
6+
person obtaining a copy of this software, associated documentation and/or data
7+
(collectively the "Software"), free of charge and under any and all copyright
8+
rights in the Software, and any and all patent rights owned or freely
9+
licensable by each licensor hereunder covering either (i) the unmodified
10+
Software as contributed to or provided by such licensor, or (ii) the Larger
11+
Works (as defined below), to deal in both
12+
13+
(a) the Software, and
14+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
15+
one is included with the Software (each a "Larger Work" to which the Software
16+
is contributed by such licensors),
17+
18+
without restriction, including without limitation the rights to copy, create
19+
derivative works of, display, perform, and distribute the Software and make,
20+
use, sell, offer for sale, import, export, have made, and have sold the
21+
Software and the Larger Work(s), and to sublicense the foregoing rights on
22+
either these or other terms.
23+
24+
This license is subject to the following condition:
25+
The above copyright notice and either this complete permission notice or at
26+
a minimum a reference to the UPL must be included in all copies or
27+
substantial portions of the Software.
28+
29+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35+
SOFTWARE.
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
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.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""
2+
config file
3+
4+
- Add the OCID of your compartment
5+
"""
6+
7+
COMPARTMENT_ID = ""
8+
9+
# You can select other models here as well
10+
MODEL_ID = "cohere.command-a-03-2025"

0 commit comments

Comments
Β (0)