Case file 02 Rules as evidence
Hujja
An open-source rules-as-code project for Shariah stock screening, designed to preserve per-standard verdicts, source references, and visible uncertainty.
View repositoryOverview
A verdict should expose the rule that produced it.
Hujja is being developed around a narrow problem: stock-screening standards differ in thresholds, denominators, averaging windows, and activity rules. Collapsing them into one opaque answer hides those differences.
The project instead models rules as versioned, auditable definitions and targets one verdict per standard, with the relevant facts, rule identifiers, review status, and source evidence kept alongside the outcome.
Model
Separate standards. Explicit uncertainty.
- Compliant
- Non-compliant
- Doubtful
DOUBTFUL is modeled as a first-class status for ambiguous or mixed cases that require qualified human review—not as a hidden failure.
Published state
The contract layer comes first.
The current repository is pre-alpha. It publishes a versioned DJIM rule definition, JSON Schema, fact modeling, and validation. The loader and screening execution engine are not yet implemented.
Definitions and contracts
Schema, rule structure, fact model, validation, and evidence-oriented output design.
Loader and execution
The repository does not yet provide a working end-to-end stock-screening engine.
Design principles
Auditability is a data-model concern.
- 01
One verdict per standard
Different methodologies remain separate rather than being merged into a single answer.
- 02
Rules carry provenance
Definitions are versioned and linked to the official source material they encode.
- 03
Review status stays visible
Unreviewed rules remain labeled as such in the target output.
- 04
Public-domain inputs
The project’s stated data policy centers on SEC EDGAR/XBRL and excludes licensed market-data feeds from the repository.
Boundaries
Important Informational software
Not a fatwa. Not investment advice.
Hujja is presented for informational and educational purposes. It does not issue religious rulings and does not provide investment, legal, accounting, or tax advice. It does not make personalized recommendations.
Any screening result depends on the encoded methodology and the accuracy and timeliness of public filings. Decisions require qualified professional guidance.
Current tools
Technologies in the pre-alpha repository.
- PythonCore language
- JSON SchemaRule contracts
- DataclassesFact modeling
- Validation suiteContract checks
- Versioned JSONRule definitions
- Apache-2.0License