Skip to main content

Regulatory Simulation CLI for Indian Backend Systems

Project description

RegSim-IN

Regulatory Simulation & Failure Memory CLI for Indian Backend Systems


What is RegSim-IN?

RegSim-IN is a developer-first CLI that simulates Indian regulatory rules (TDS, GST, RBI-style constraints) against backend data flows before production.

It helps backend teams detect, explain, and remember regulatory failures early — during development, testing, and CI — instead of discovering them during audits or incidents.

RegSim-IN treats regulation as executable rules, not PDFs.


What Problem Does This Solve?

Backend teams frequently:

  • Ship compliant-looking code that fails under real regulatory edge cases
  • Discover issues late (audits, settlements, reversals)
  • Repeat the same regulatory mistakes across services and teams

RegSim-IN exists to:

  • Shift regulatory failures left
  • Make rules explicit and testable
  • Prevent repeat regulatory incidents

What RegSim-IN v1 Does

Version 1 focuses on deterministic rule simulation.

RegSim-IN v1 can:

  • Load regulatory rules defined in JSON
  • Run those rules against input payloads (also JSON)
  • Evaluate pass/fail conditions
  • Emit machine-readable JSON output
  • Explain why a rule failed

This makes RegSim-IN suitable for:

  • Local development checks
  • CI/CD gates
  • Backend design validation
  • Regulatory edge-case exploration

Example: Detecting a Missed TDS Deduction

Consider a backend payout flow where a contractor payment is executed without deducting TDS.

Input payload:

{
  "payment": {
    "id": "pay_1029",
    "amount": 45000,
    "vendor_type": "contractor",
    "tds_deducted": false
  }
}

Simulation result:

{
  "status": "FAIL",
  "violations": [
    {
      "rule_id": "TDS_194C_THRESHOLD",
      "severity": "HIGH",
      "message": "TDS must be deducted under section 194C"
    }
  ]
}

This allows teams to catch deduction timing and threshold violations before payouts reach production systems.


What RegSim-IN Explicitly Does NOT Do

To avoid misuse or false confidence, RegSim-IN v1 does not:

  • Provide legal, tax, or regulatory advice
  • File or generate GST / TDS / RBI reports
  • Integrate with government, bank, or tax APIs
  • Automatically update rules from circulars
  • Fully simulate async systems (queues, retries, persistent state)

This is a simulation tool, not a compliance authority.


Supported Languages

  • Python (v1)

The CLI is language-agnostic, but rule evaluation currently targets Python-style backend data models.


Rule Format

Rules are defined in JSON.

Design goals:

  • Explicit structure
  • Deterministic evaluation
  • Easy diffing & review
  • CI/CD friendliness

Example Rule

{
  "rule_id": "TDS_194C_THRESHOLD",
  "rule_version": "1.0",
  "effective_from": "2024-04-01",
  "description": "TDS applies if contractor payment exceeds threshold",
  "condition": {
    "field": "payment.amount",
    "operator": ">",
    "value": 30000
  },
  "action": {
    "type": "FAIL",
    "message": "TDS must be deducted under section 194C"
  },
  "source_reference": "Income Tax Act - Section 194C"
}

Input Format

Inputs represent backend payloads or traces, also in JSON.


Output Format

All outputs are JSON only.

Example failure output:

{
  "status": "FAIL",
  "violations": [
    {
      "rule_id": "TDS_194C_THRESHOLD",
      "severity": "HIGH",
      "message": "TDS must be deducted under section 194C"
    }
  ],
  "metadata": {
    "engine": "regsim-in",
    "engine_version": "0.1.0",
    "rule_snapshot": "2024-04-01",
    "applied_rules": [
      {
        "rule_id": "TDS_194C_THRESHOLD",
        "rule_version": "1.0",
        "effective_from": "2024-04-01",
        "source_reference": "Income Tax Act - Section 194C"
      }
    ]
  }
}

This makes RegSim-IN suitable for automation and tooling.


Error Output

Errors are always returned as JSON and never include a Python traceback:

{
  "status": "ERROR",
  "message": "Rule validation failed: missing field 'action'"
}

Installation (Early Prototype)

pip install regsim-in

RegSim-IN is under active development.


Usage (v1)

regsim-in simulate \
  --rules rules/ \
  --input input.json

Current v1 behavior:

  • CLI initializes correctly
  • Rules are parsed and validated
  • Simulation runs deterministically
  • JSON output is emitted

Project Layout (Current)

regsim/
  cli.py
  commands/
    simulate.py
  core/
    evaluator.py
    fields.py
    simulation.py
    validators.py
  schemas/

The CLI stays thin, while core rule evaluation lives under regsim/core/.


Rule Versioning & Regulatory Drift

RegSim-IN v1 supports explicit rule versioning:

  • Rules declare:

    • rule_version
    • effective_from
    • source_reference
  • No rule updates happen implicitly

  • Simulations are always tied to a known regulatory snapshot

This ensures:

  • Reproducibility
  • Reviewability
  • Trust

CI/CD Usage Example

regsim-in simulate --rules rules/ --input payload.json || exit 1

A failing rule causes a non-zero exit code.


Roadmap (Explicit, Not Promised)

Planned future directions include:

  • Regulatory failure memory & correlation
  • Safer rule authoring workflows
  • Async system modeling hooks
  • Community-contributed rule sets

These are not part of v1.


Philosophy

  • Simulation over certification
  • Explicit rules over implicit assumptions
  • Deterministic behavior over magic
  • Memory over repetition

Disclaimer

RegSim-IN is a developer simulation tool. It does not guarantee legal or regulatory compliance.

Always consult qualified professionals for real-world compliance decisions


Exact Commands

Run against JSON payload

regsim-in simulate --rules rules/ --input payload.json

Run against Python service

regsim-in simulate --rules rules/ --input src/

CI usage

regsim-in simulate --rules rules/ --input src/ --snapshot-date 2024-04-01

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

regsim_in-0.1.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

regsim_in-0.1.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file regsim_in-0.1.0.tar.gz.

File metadata

  • Download URL: regsim_in-0.1.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for regsim_in-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c05e574e57e23a7c67b33b9492767075dc63edcc31a995b50bd8e3edc3953629
MD5 c38c32e2613384de4255d7ed9ed041eb
BLAKE2b-256 e7e17e8a170a1297befb9457a28f34f4cc8fa2600d4ae8b1d5473a9195194dad

See more details on using hashes here.

File details

Details for the file regsim_in-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: regsim_in-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for regsim_in-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1346369e499f72b694af2a0823ed0b54fd50386d58c2b6afdfb6e64d13dccccc
MD5 d3cdf6a532e5c65b17e852ec271d9af5
BLAKE2b-256 340a28bc21688712a60484cf329adc5bdab870d22a10d613df0a1195f2b326a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page