This script automates the retrieval of governance compliance scores for all Use Cases in your ModelOp Center inventory. It produces a simple CSV file showing the pass/fail rates for every model.
Before running the script, you must configure your environment to access the private ModelOp SDK.
The modelop-sdk is hosted on ModelOp's private PyPi server. You must configure your local pip to access it before installation.
Step 1: Upgrade Pip Run this command in your terminal:
python3 -m pip install --upgrade pip
Step 2: Create Configuration File
-
Mac/Linux: Run these commands to create the
~/.pip/pip.conffile:mkdir -p ~/.pip cat << 'EOF' > ~/.pip/pip.conf [global] extra-index-url = https://modelop:opendatagroup@pypi.modelop.center/modelop/staging https://modelop:opendatagroup@pypi.modelop.center/modelop/stable EOF
-
Windows: Create a file named
pip.iniin your user's AppData folder (e.g.,C:\Users\YourName\AppData\Roaming\pip\pip.ini) with the following content:[global] extra-index-url = [https://modelop:opendatagroup@pypi.modelop.center/modelop/staging](https://modelop:opendatagroup@pypi.modelop.center/modelop/staging) [https://modelop:opendatagroup@pypi.modelop.center/modelop/stable](https://modelop:opendatagroup@pypi.modelop.center/modelop/stable)
- Install Public Dependencies:
Once the SDK is configured, install the remaining libraries:
pip install pandas requests modelop-sdk
-
Open the Script: Open
moc_governance_scores.pyin any text editor (Notepad, VS Code, etc.). -
Configuration: Update the
MOC_INSTANCE_URLvariable with your specific ModelOp Center environment URL (e.g.,https://your-company.modelop.center).Authentication:
- Obtain Token: Obtain a valid Access Token for your environment using your organization's standard method (e.g., SSO, LDAP, or your internal API gateway). You may already be familiar with this process - for assistance, reach out to your organization's ModelOp Center System Admin for assistance.
- Update Script: Modify the
authenticate()function to accept your token directly. The script requires a valid session to proceed.
-
Run the Script: Open your terminal or command prompt and run:
python moc_governance_scores.py
A file named use_case_governance_scores.csv will be created in the same folder.
Example Output:
| UUID | Use Case Name | Governance Score |
|---|---|---|
| 18bd00b1... | Probability of Default | 87.5% (7/8) |
| 20385b24... | LLM Chatbot | 100.0% (5/5) |