Skip to content

Worked example: credit scoring

This page follows one system that is not a hiring tool: a model that scores loan applicants. Credit scoring is an Annex III high-risk use case (area 5, point 5(b)), so the check fails by design and the work is to read the gap list and close it. Every command was run against release 0.18.0.

If you have not used the tool before, read the Quick Start first; this page uses the same steps with a different system and shows what is specific to it.

The system

Two files in a new Git repository:

Python
# app.py
import openai
from sklearn.ensemble import GradientBoostingClassifier


def score_applicant(income, debt, history_months):
    """Credit score for a loan applicant."""
    features = [[income, debt, history_months]]
    return model.predict_proba(features)[0][1]


def decide(applicant):
    score = score_applicant(applicant["income"], applicant["debt"], applicant["history_months"])
    return "approve" if score > 0.6 else "refer"
Text Only
# requirements.txt
openai==1.40.0
scikit-learn==1.5.0

Install the plugin for areas 3 to 8

The default scan reads only biometric and critical-infrastructure signals (Annex III areas 1 and 2). Credit scoring is area 5, so install the optional plugin as well:

Bash
pip install opencomplai opencomplai-ai
PowerShell
pip install opencomplai opencomplai-ai

Annex III area leads for areas 3 to 8 (education, employment, essential services, law enforcement, migration, justice) appear only with opencomplai-ai installed, and the intent analysis scan --ai-intent needs it too. Without it, scan and check --scan print Annex III area leads (areas 3 to 8) need the optional plugin: pip install opencomplai-ai on stderr and carry on.

Look at the repo

Bash
opencomplai scan --quick
Text Only
Code Corroboration Scan
  severity:     none
  declared:     (none)
  detected:     (none)
  discrepancies: (none)
  evidence:
    - requirements.txt:1  token: "openai"  category: ai_sdk  confidence: 0.70
      openai==1.40.0
    - app.py:1  token: "openai"  category: ai_sdk  confidence: 0.75
      import openai
    - app.py:12  token: "score"  category: scoring_profiling  confidence: 0.85
      score = score_applicant(applicant["income"], applicant["debt"], ...
    - app.py:2  token: "sklearn"  category: ml_framework  confidence: 0.75
      from sklearn.ensemble import GradientBoostingClassifier
    ...

Annex III area leads (for a person to review, not findings)
  - app.py:8  predict_proba  5 Essential services  low  lowest confidence  (lead, not a finding)
  A lead is a pointer for a person to review: not a finding and not a classification. ...

Discovery only — not a compliance verdict. No manifest was loaded and no CI gate was evaluated.

Detected categories: (none)

No AI signals detected in this repo — `opencomplai init` when you have a system to declare.

The last line contradicts the evidence above it. It is a known limitation (0.17.0 and 0.18.0): the sentence is chosen from Detected categories, which lists only the two areas the default scan reaches, not from the evidence lines. Read the evidence lines and the lead: this repo touches AI and points at area 5. The first scan also writes an .ocignore (see what to commit).

To examine areas 3 to 8, run the intent analysis:

Bash
opencomplai scan --ai-intent
Text Only
  3. High-risk (Annex III) — 2 findings
     5 Essential services           2
     app.py:12  score_applicant  5 Essential services
       Art.6(2)+Annex III pt.5(a) | Art.9 risk mgmt | Art.10 data governance
     app.py:8  predict_proba  5 Essential services
       Art.6(2)+Annex III pt.5(a) | Art.9 risk mgmt | Art.10 data governance
     ...

Known limitation (0.17.0 and 0.18.0): the area is right, the labels are not

The scan puts this system in area 5, essential services, which is correct. Two labels are wrong for credit scoring:

  • The findings list cites Annex III 5(a) (a public authority assessing benefit eligibility) on both lines, and the flag rationale for score_applicant names that 5(a) title. Credit scoring is 5(b), creditworthiness assessment. Only the rationale for the predict_proba line cites 5(b).
  • The rule engine lists the category employment next to essential_services (matches Annex III categories: employment, essential_services), because the word applicants is in its employment vocabulary. This system does not decide on employment.

Neither changes the outcome. The classification that counts is the checker verdict, which you give below, and which names no area. When you write down the classification (for example in an acceptance statement), write 5(b), not employment and not 5(a).

Declare the system

Bash
opencomplai init --system-id loan-scorer --intended-purpose "credit scoring of loan applicants"

check classifies by matching words in intended_purpose, so use the plain words of the use case. Here credit scoring and applicants already match.

Say who you are

Credit scoring needs the applicability checker like any other Annex III system: it stores your role and the risk tier in the manifest, so check fails the high_risk_ai_system verdict whatever the purpose text says. Save answers.json as plain UTF-8 without a byte order mark:

JSON
{
  "answers": {
    "gate_is_ai_system": true,
    "e1_entity_type": "provider",
    "hr2_annex_iii": true,
    "hr7_profiling": true,
    "s1_in_scope": true
  }
}

What each answer says for this system:

Key Value Why
gate_is_ai_system true A trained model that scores applicants is an AI system (Art. 3(1)).
e1_entity_type provider You built it and put it into service under your name. A bank that only buys and uses a scoring service answers deployer.
hr2_annex_iii true The system falls within an Annex III use case. The key is one yes or no for all eight areas, not an employment question; see the key table.
hr7_profiling true Scoring a person's creditworthiness evaluates a natural person from personal data. With hr2_annex_iii also true, the system is high-risk and none of the Art. 6(3) exceptions can apply, so the four hr3 to hr6 answers are ignored and can be left out.
s1_in_scope true You place the system on the EU market or use its output in the EU.

Every other key is optional and falls back to a default. All of them are in checker.

Bash
opencomplai checker --answers answers.json --entity-type provider --write-manifest system-manifest.json

The checker prints High risk — Provider and Manifest written to system-manifest.json.

Run the check

Bash
opencomplai check --manifest system-manifest.json --scan --with-gaps --scan-mode ci
Text Only
Applicability checker: session f5a05bbb… (vchecker-2026-10-26, role=provider)
Evals: no eval sample set supplied (skipped)
Not applicable to this session: 6 article(s)
Artifact written to scan-report.json

Opencomplai Compliance Check
  system_id:    loan-scorer
  commit_ref:   abc1234
  result:       CONTROL_FAIL
  duration_ms:  0
  signed:       no (OSS unsigned)
  failed_controls: EU_AIA_ART6_HIGH_RISK, EU_AIA_ART6_PROFILING
  scan_severity:     none

  Regulatory timeline
    2025-02-02 - AI literacy, Art. 4 [...] (in force)
    ...
    2027-12-02 - High-risk obligations for Annex III systems [...] (upcoming)
    ...

  Artifact written to compliance-artifact.json

Annex III area leads (for a person to review, not findings)
  - app.py:8  predict_proba  5 Essential services  low  lowest confidence  (lead, not a finding)
  ...

The exit code is 1, and that is the right answer. Both controls are findings about the use case:

  • EU_AIA_ART6_HIGH_RISK: credit scoring is an Annex III use case, so the high-risk obligations apply.
  • EU_AIA_ART6_PROFILING fires here although nothing in the text is a hiring word. The rule is about profiling of natural persons, not about recruitment: the purpose says credit scoring (vocabulary from Annex III 5(b) and the other areas that score people) and applicants (a person cue). The words that matched are listed by opencomplai risk classify --system-id loan-scorer --intended-purpose "credit scoring of loan applicants": applicant, credit, credit scoring, scoring. Under Art. 6(3) a system that profiles people is always high-risk. Had the purpose described scoring a company or a portfolio, the rule would pass. It never clears for this system in 0.17.0 and 0.18.0: an acceptance record removes only EU_AIA_ART6_HIGH_RISK.

Read the gaps

gaps prints a six-column table; widen the terminal first (more than 150 columns), or set COLUMNS, or use -o json. See Read the table at 80 columns.

Bash
COLUMNS=200 opencomplai gaps
PowerShell
$env:COLUMNS = 200
opencomplai gaps

For a provider of a high-risk system, 18 rows: 12 MISSING (Art. 6, 9, 11, 12, 13, 14, 16, 17, 43, 49, 72, 73), 5 UNVERIFIED (Art. 4, 5, 10, 15, 20) and one MET:

Text Only
│ Art. 6  │ Clause 6.1 (Actions to address risks and opportunities) │ MISSING │ rule │ EU_AIA_ART6_HIGH_RISK │ Use case 'credit scoring of loan applicants' matches Annex III categories: employment, essential_services. │
│ Art. 9  │ Clause 6.1 / Clause 8.2-8.3                             │ MISSING │ artifact │ risk_register │ No conventional documentation/code probe matched for 'risk_register'. Add the expected file or construct, then re-run gaps. │
...
│ Art. 25 │ Clause 6.3 (Planning of changes)                        │ MET │ rule │ EU_AIA_ART25_MODIFICATION_TRAP │ No substantial modification declared in assessment answers. │

Two rows are easy to misread:

  • Art. 25 reads MET. The row passes because you declared no substantial modification (the checker answer e2_modifications is false, and no --change-context was passed). It records an absence of a declaration, not a review. If you retrain the model on new data or change its purpose, declare it: see Handle a modification halt.
  • Partial means a file exists, not that you are making progress. An empty or untouched scaffold already reads PARTIAL. Copy the Art. 9 template unchanged and the row says so: Found 'docs/risk-register.md' but it still contains 6 unfilled scaffold placeholder(s) ('_fill in_') — a scaffold is not a filled risk register. The same holds for the 13 files of qms generate --scaffold (Art. 17). A probe never reads MET; fill the file in, and for MET record an attestation.

Get the fixes and close a gap

Bash
opencomplai recommend

This writes 12 fill-in templates into fixes/. Do not leave fixes/ in the repository while you run gaps: the Art. 14 template contains the construct the oversight probe looks for, so that row would read PARTIAL from the template alone. Copy what you use, then delete the folder, as in the Quick Start.

Generate the technical documentation

Bash
opencomplai docs generate --system-id loan-scorer --manifest system-manifest.json

With the checker session in the manifest this prints schema: invalid, a warning that section2_complete=false, and exits 2. (Without a checker session and without --intended-purpose, docs generate does not treat the manifest as high-risk and exits 0 with placeholders, so run the checker first.) The dossier is still written (dossier_<id>.json), and Art. 11 moves to PARTIAL, but the exit code fails closed because a high-risk dossier cannot be complete while its provider sections are placeholders. Fill these manifest fields; the docs generate reference explains each:

JSON
{
  "training_data_description": "Consumer loan applications 2019-2024 with repayment outcomes, de-identified; approved and refused applications included.",
  "model_architecture": "Gradient-boosted decision trees producing a default probability from income, debt and credit history length.",
  "performance_metrics": {"auc": 0.81, "ks": 0.44},
  "known_limitations": ["Thin-file applicants (under 12 months of history) are scored less reliably."],
  "metrics_appropriateness_rationale": "AUC and KS measure ranking of defaulters; approval-rate parity is tracked separately.",
  "human_oversight_measures": ["A credit officer reviews every refusal and every score within 0.05 of the cut-off."],
  "monitoring_approach": "Monthly drift and approval-rate checks on live scores; alert on a 5 point shift.",
  "incident_response_procedure": "Incidents go to the risk desk, who can suspend scoring within one working day.",
  "change_log_reference": "docs/CHANGELOG-model.md",
  "alternative_solutions": "No harmonised standard is cited yet; the model follows internal model-risk policy MRM-3.",
  "eu_declaration_of_conformity_ref": "docs/eu-declaration-of-conformity.pdf",
  "post_market_monitoring_plan_ref": "docs/post-market-monitoring-plan.md"
}

Merge them into system-manifest.json with an editor that saves plain UTF-8. Use real statements and point the _ref fields at documents that exist: the tool records what you write and never opens the file. With all of them set the command prints schema: valid and exits 0. Filling only Section 2 (training_data_description and model_architecture) removes the section2_complete warning but the exit stays 2 until the other sections hold content.

Record the classification

If you agree with the classification, record that someone reviewed it. Name the right area:

Bash
opencomplai accept --accepted-by "Credit risk lead" \
  --statement "Reviewed: credit scoring is Annex III 5(b); we accept the high-risk classification."

Then check drops EU_AIA_ART6_HIGH_RISK and lists the open article rows. It still exits 1: EU_AIA_ART6_PROFILING stays while the purpose describes profiling of people. See Exit code 1 stays after accept.

Put it in CI

Commit the manifest, then run the same check on every pull request:

YAML
- uses: Opencomplai/opencomplai-action@v1
  with:
    manifest: system-manifest.json
    strict: "true"

On a high-risk system this exits 1 until every gap is closed, and EU_AIA_ART6_PROFILING never clears in 0.17.0 and 0.18.0, so while you close gaps you can add fail-on-error: "false" to report without failing the job. See GitHub Action.

Which files to commit

Commit Ignore
system-manifest.json, answers.json, .ocignore, .opencomplai/acceptances/, the documents you filled in (docs/risk-register.md and so on) compliance-artifact.json, scan-report.json, fixes/

The reasons are in what to commit.