Skip to content

sumsub/agent-skills / skills/sumsub-supported-id-documents

sumsub-supported-id-documents

Verified

Query AND edit Sumsub's supported identity documents. READ the built-in catalogue (documentsByCountries) — which document types are supported per country, whether they're double-sided, which OCR fields are default vs. available. EDIT a client's own supported-document overrides (idDocSettings.countryMappings) via the global-settings API. TRIGGER when the user asks "which countries / document types support field X", "what fields can I collect for a passport in DEU", "is the ID card double-sided in France", OR wants to change supported documents / toggle a document type / edit collected fields for a country. SKIP for creating levels or questionnaires (use the dedicated skills).

FileKindSize
SKILL.mdskill md28.3 KB
references/fields-glossary.mdmarkdown17.0 KB
scripts/build_country_mappings.pyexecutablescript14.7 KB
scripts/diff_country_mappings.pyexecutablescript3.6 KB
scripts/get_entitlements.shexecutablescript2.3 KB
scripts/get_extension_rules.shexecutablescript1.9 KB
scripts/get_global_settings.shexecutablescript1.7 KB
scripts/get_supported_docs.shexecutablescript1.8 KB
scripts/put_country_mappings.shexecutablescript2.2 KB
scripts/query_supported_docs.pyexecutablescript9.0 KB
scripts/recognition_status.pyexecutablescript6.1 KB
scripts/remove_country_mapping.pyexecutablescript2.9 KB

scripts/recognition_status.py

View on GitHub
#!/usr/bin/env python3
"""
Show the EFFECTIVE recognition status of every OCR field for a given country and
document type — i.e. what is actually recognised for THIS client right now, not
just what the catalogue allows.

It combines three inputs:
  1. the client's current settings  (--current-file, from get_global_settings.sh)
  2. the default catalogue          (--catalog-file, from get_supported_docs.sh)
  3. whether ADVANCED_OCR is enabled (--advanced-ocr, from get_entitlements.sh)

Why all three: a field is only really recognised if (a) it's checked in the
client's effective settings AND (b) — for Extra Fields — the client has the
ADVANCED_OCR entitlement (otherwise the backend drops it silently).

Usage:
    recognition_status.py BRA PASSPORT \
        --current-file /tmp/current.json \
        --catalog-file /tmp/catalogue.json \
        --advanced-ocr true|false

Output (stdout, JSON): per-field status grouped into recognised / not recognised.
A human-readable summary is printed to stderr.
"""
import argparse
import json
import sys


def _die(msg, code=2):
    print(f"error: {msg}", file=sys.stderr)
    sys.exit(code)


def _read_json(path):
    try:
        with open(path, encoding="utf-8") as f:
            return json.load(f)
    except OSError as e:
        _die(f"cannot read {path}: {e}", code=3)
    except json.JSONDecodeError as e:
        _die(f"{path} is not valid JSON: {e}", code=3)


def _country_mappings(doc, source):
    if isinstance(doc.get("countryMappings"), dict):
        return doc["countryMappings"]
    id_doc = doc.get("idDocSettings")
    if isinstance(id_doc, dict) and isinstance(id_doc.get("countryMappings"), dict):
        return id_doc["countryMappings"]
    _die(f"{source} has no countryMappings")


def status(country, doc_type, current, catalogue, advanced_ocr):
    cat = catalogue.get(country, {}).get(doc_type)
    if not cat:
        _die(f"{country}/{doc_type} is not in the catalogue")
    cat_default = cat.get("defaultFields", [])
    cat_available = cat.get("availableFields", [])

    # Effective config, resolved per column to match the backend:
    #   Default column — the catalogue defaults stay recognised unless the client's
    #     override supplies a NON-EMPTY defaultFields list. An empty/absent list does
    #     NOT disable the column (see OcrFieldsInfoModel#enrichWithClientCountryDocument),
    #     so a sparse scalar-only override must fall back to the catalogue here.
    #   Extra column — base is empty; the client's availableFields only ADD extras.
    override = current.get(country, {}).get(doc_type)
    configured = override is not None
    override_default = (override or {}).get("defaultFields")
    on_default = set(override_default) if override_default else set(cat_default)
    on_available = set((override or {}).get("availableFields") or [])

    recognised, not_recognised = [], []

    for field in cat_default:
        if field in on_default:
            recognised.append({"field": field, "column": "default", "paid": False})
        else:
            not_recognised.append({"field": field, "column": "default",
                                   "reason": "turned off (default field unchecked)"})

    for field in cat_available:
        if field in on_available and advanced_ocr:
            recognised.append({"field": field, "column": "extra", "paid": True})
        elif field in on_available and not advanced_ocr:
            not_recognised.append({"field": field, "column": "extra",
                                   "reason": "enabled but ADVANCED_OCR is OFF — backend drops it"})
        else:
            not_recognised.append({"field": field, "column": "extra",
                                   "reason": "extra field, not enabled"})

    return {
        "country": country,
        "docType": doc_type,
        "advancedOcr": advanced_ocr,
        "source": "client override" if configured else "catalogue default (client has no override)",
        "recognised": recognised,
        "notRecognised": not_recognised,
    }


def _print_summary(result):
    print(f"Recognised fields for {result['country']} / {result['docType']} "
          f"(source: {result['source']}):", file=sys.stderr)
    if result["recognised"]:
        for f in result["recognised"]:
            tag = "PAID — ADVANCED_OCR" if f["paid"] else "free"
            print(f"  ✅ {f['field']} ({tag})", file=sys.stderr)
    else:
        print("  (none)", file=sys.stderr)
    print("Not recognised:", file=sys.stderr)
    if result["notRecognised"]:
        for f in result["notRecognised"]:
            print(f"  ⬜ {f['field']} — {f['reason']}", file=sys.stderr)
    else:
        print("  (none)", file=sys.stderr)


def main():
    ap = argparse.ArgumentParser(description="Effective OCR recognition status for a country/doc type.")
    ap.add_argument("country", help="ISO-3 country code, e.g. BRA")
    ap.add_argument("docType", nargs="?",
                    help="document type, e.g. PASSPORT. Omit to report ALL doc types for the country.")
    ap.add_argument("--current-file", required=True, help="client's global settings JSON")
    ap.add_argument("--catalog-file", required=True, help="default catalogue JSON")
    ap.add_argument("--advanced-ocr", required=True, choices=["true", "false"],
                    help="whether the client has the ADVANCED_OCR entitlement")
    args = ap.parse_args()

    current = _country_mappings(_read_json(args.current_file), "--current-file")
    catalogue = _country_mappings(_read_json(args.catalog_file), "--catalog-file")
    advanced_ocr = args.advanced_ocr == "true"

    if args.docType:
        doc_types = [args.docType]
    else:
        doc_types = sorted(catalogue.get(args.country, {}).keys())
        if not doc_types:
            _die(f"{args.country} is not in the catalogue")

    results = []
    for dt in doc_types:
        result = status(args.country, dt, current, catalogue, advanced_ocr)
        _print_summary(result)
        results.append(result)

    out = results[0] if args.docType else {"country": args.country, "docTypes": results}
    json.dump(out, sys.stdout, indent=2, ensure_ascii=False)
    sys.stdout.write("\n")


if __name__ == "__main__":
    main()
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall