decision_agent 0.3.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +272 -7
- data/lib/decision_agent/agent.rb +72 -1
- data/lib/decision_agent/context.rb +1 -0
- data/lib/decision_agent/data_enrichment/cache/memory_adapter.rb +86 -0
- data/lib/decision_agent/data_enrichment/cache_adapter.rb +49 -0
- data/lib/decision_agent/data_enrichment/circuit_breaker.rb +135 -0
- data/lib/decision_agent/data_enrichment/client.rb +220 -0
- data/lib/decision_agent/data_enrichment/config.rb +78 -0
- data/lib/decision_agent/data_enrichment/errors.rb +36 -0
- data/lib/decision_agent/decision.rb +102 -2
- data/lib/decision_agent/dmn/feel/evaluator.rb +28 -6
- data/lib/decision_agent/dsl/condition_evaluator.rb +982 -839
- data/lib/decision_agent/dsl/schema_validator.rb +51 -13
- data/lib/decision_agent/evaluators/dmn_evaluator.rb +106 -19
- data/lib/decision_agent/evaluators/json_rule_evaluator.rb +69 -9
- data/lib/decision_agent/explainability/condition_trace.rb +83 -0
- data/lib/decision_agent/explainability/explainability_result.rb +52 -0
- data/lib/decision_agent/explainability/rule_trace.rb +39 -0
- data/lib/decision_agent/explainability/trace_collector.rb +24 -0
- data/lib/decision_agent/monitoring/alert_manager.rb +5 -1
- data/lib/decision_agent/simulation/errors.rb +18 -0
- data/lib/decision_agent/simulation/impact_analyzer.rb +498 -0
- data/lib/decision_agent/simulation/monte_carlo_simulator.rb +635 -0
- data/lib/decision_agent/simulation/replay_engine.rb +486 -0
- data/lib/decision_agent/simulation/scenario_engine.rb +318 -0
- data/lib/decision_agent/simulation/scenario_library.rb +163 -0
- data/lib/decision_agent/simulation/shadow_test_engine.rb +287 -0
- data/lib/decision_agent/simulation/what_if_analyzer.rb +1002 -0
- data/lib/decision_agent/simulation.rb +17 -0
- data/lib/decision_agent/version.rb +1 -1
- data/lib/decision_agent/versioning/activerecord_adapter.rb +23 -8
- data/lib/decision_agent/web/public/app.js +119 -0
- data/lib/decision_agent/web/public/index.html +49 -0
- data/lib/decision_agent/web/public/simulation.html +130 -0
- data/lib/decision_agent/web/public/simulation_impact.html +478 -0
- data/lib/decision_agent/web/public/simulation_replay.html +551 -0
- data/lib/decision_agent/web/public/simulation_shadow.html +546 -0
- data/lib/decision_agent/web/public/simulation_whatif.html +532 -0
- data/lib/decision_agent/web/public/styles.css +65 -0
- data/lib/decision_agent/web/server.rb +594 -23
- data/lib/decision_agent.rb +60 -2
- metadata +53 -73
- data/spec/ab_testing/ab_test_assignment_spec.rb +0 -253
- data/spec/ab_testing/ab_test_manager_spec.rb +0 -612
- data/spec/ab_testing/ab_test_spec.rb +0 -270
- data/spec/ab_testing/ab_testing_agent_spec.rb +0 -655
- data/spec/ab_testing/storage/adapter_spec.rb +0 -64
- data/spec/ab_testing/storage/memory_adapter_spec.rb +0 -485
- data/spec/activerecord_thread_safety_spec.rb +0 -553
- data/spec/advanced_operators_spec.rb +0 -3150
- data/spec/agent_spec.rb +0 -289
- data/spec/api_contract_spec.rb +0 -430
- data/spec/audit_adapters_spec.rb +0 -92
- data/spec/auth/access_audit_logger_spec.rb +0 -394
- data/spec/auth/authenticator_spec.rb +0 -112
- data/spec/auth/password_reset_spec.rb +0 -294
- data/spec/auth/permission_checker_spec.rb +0 -207
- data/spec/auth/permission_spec.rb +0 -73
- data/spec/auth/rbac_adapter_spec.rb +0 -778
- data/spec/auth/rbac_config_spec.rb +0 -82
- data/spec/auth/role_spec.rb +0 -51
- data/spec/auth/session_manager_spec.rb +0 -172
- data/spec/auth/session_spec.rb +0 -112
- data/spec/auth/user_spec.rb +0 -130
- data/spec/comprehensive_edge_cases_spec.rb +0 -1777
- data/spec/context_spec.rb +0 -127
- data/spec/decision_agent_spec.rb +0 -96
- data/spec/decision_spec.rb +0 -423
- data/spec/dmn/decision_graph_spec.rb +0 -282
- data/spec/dmn/decision_tree_spec.rb +0 -203
- data/spec/dmn/feel/errors_spec.rb +0 -18
- data/spec/dmn/feel/functions_spec.rb +0 -400
- data/spec/dmn/feel/simple_parser_spec.rb +0 -274
- data/spec/dmn/feel/types_spec.rb +0 -176
- data/spec/dmn/feel_parser_spec.rb +0 -489
- data/spec/dmn/hit_policy_spec.rb +0 -202
- data/spec/dmn/integration_spec.rb +0 -226
- data/spec/dsl/condition_evaluator_spec.rb +0 -774
- data/spec/dsl_validation_spec.rb +0 -648
- data/spec/edge_cases_spec.rb +0 -353
- data/spec/evaluation_spec.rb +0 -364
- data/spec/evaluation_validator_spec.rb +0 -165
- data/spec/examples/feedback_aware_evaluator_spec.rb +0 -460
- data/spec/examples.txt +0 -1909
- data/spec/fixtures/dmn/complex_decision.dmn +0 -81
- data/spec/fixtures/dmn/invalid_structure.dmn +0 -31
- data/spec/fixtures/dmn/simple_decision.dmn +0 -40
- data/spec/issue_verification_spec.rb +0 -759
- data/spec/json_rule_evaluator_spec.rb +0 -587
- data/spec/monitoring/alert_manager_spec.rb +0 -378
- data/spec/monitoring/metrics_collector_spec.rb +0 -501
- data/spec/monitoring/monitored_agent_spec.rb +0 -225
- data/spec/monitoring/prometheus_exporter_spec.rb +0 -242
- data/spec/monitoring/storage/activerecord_adapter_spec.rb +0 -498
- data/spec/monitoring/storage/base_adapter_spec.rb +0 -61
- data/spec/monitoring/storage/memory_adapter_spec.rb +0 -247
- data/spec/performance_optimizations_spec.rb +0 -493
- data/spec/replay_edge_cases_spec.rb +0 -699
- data/spec/replay_spec.rb +0 -210
- data/spec/rfc8785_canonicalization_spec.rb +0 -215
- data/spec/scoring_spec.rb +0 -225
- data/spec/spec_helper.rb +0 -60
- data/spec/testing/batch_test_importer_spec.rb +0 -693
- data/spec/testing/batch_test_runner_spec.rb +0 -307
- data/spec/testing/test_coverage_analyzer_spec.rb +0 -292
- data/spec/testing/test_result_comparator_spec.rb +0 -392
- data/spec/testing/test_scenario_spec.rb +0 -113
- data/spec/thread_safety_spec.rb +0 -490
- data/spec/thread_safety_spec.rb.broken +0 -878
- data/spec/versioning/adapter_spec.rb +0 -156
- data/spec/versioning_spec.rb +0 -1030
- data/spec/web/middleware/auth_middleware_spec.rb +0 -133
- data/spec/web/middleware/permission_middleware_spec.rb +0 -247
- data/spec/web_ui_rack_spec.rb +0 -2134
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<definitions xmlns="https://www.omg.org/spec/DMN/20191111/MODEL/"
|
|
3
|
-
xmlns:dmndi="https://www.omg.org/spec/DMN/20191111/DMNDI/"
|
|
4
|
-
xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/"
|
|
5
|
-
id="definitions_complex"
|
|
6
|
-
name="Complex Loan Decision"
|
|
7
|
-
namespace="http://decision_agent.local">
|
|
8
|
-
|
|
9
|
-
<decision id="loan_approval" name="Loan Approval Decision">
|
|
10
|
-
<description>Multi-criteria loan approval decision</description>
|
|
11
|
-
<decisionTable id="loan_approval_table" hitPolicy="FIRST">
|
|
12
|
-
<input id="input_credit_score" label="Credit Score">
|
|
13
|
-
<inputExpression typeRef="number">
|
|
14
|
-
<text>credit_score</text>
|
|
15
|
-
</inputExpression>
|
|
16
|
-
</input>
|
|
17
|
-
|
|
18
|
-
<input id="input_income" label="Annual Income">
|
|
19
|
-
<inputExpression typeRef="number">
|
|
20
|
-
<text>income</text>
|
|
21
|
-
</inputExpression>
|
|
22
|
-
</input>
|
|
23
|
-
|
|
24
|
-
<input id="input_loan_amount" label="Loan Amount">
|
|
25
|
-
<inputExpression typeRef="number">
|
|
26
|
-
<text>loan_amount</text>
|
|
27
|
-
</inputExpression>
|
|
28
|
-
</input>
|
|
29
|
-
|
|
30
|
-
<output id="output_decision" label="Decision" name="decision" typeRef="string"/>
|
|
31
|
-
|
|
32
|
-
<rule id="rule_excellent">
|
|
33
|
-
<description>Excellent credit and high income</description>
|
|
34
|
-
<inputEntry id="entry_excellent_credit">
|
|
35
|
-
<text>>= 750</text>
|
|
36
|
-
</inputEntry>
|
|
37
|
-
<inputEntry id="entry_excellent_income">
|
|
38
|
-
<text>>= 50000</text>
|
|
39
|
-
</inputEntry>
|
|
40
|
-
<inputEntry id="entry_excellent_loan">
|
|
41
|
-
<text>< 200000</text>
|
|
42
|
-
</inputEntry>
|
|
43
|
-
<outputEntry id="output_excellent">
|
|
44
|
-
<text>"approve"</text>
|
|
45
|
-
</outputEntry>
|
|
46
|
-
</rule>
|
|
47
|
-
|
|
48
|
-
<rule id="rule_good">
|
|
49
|
-
<description>Good credit and moderate income</description>
|
|
50
|
-
<inputEntry id="entry_good_credit">
|
|
51
|
-
<text>>= 650</text>
|
|
52
|
-
</inputEntry>
|
|
53
|
-
<inputEntry id="entry_good_income">
|
|
54
|
-
<text>>= 40000</text>
|
|
55
|
-
</inputEntry>
|
|
56
|
-
<inputEntry id="entry_good_loan">
|
|
57
|
-
<text>< 150000</text>
|
|
58
|
-
</inputEntry>
|
|
59
|
-
<outputEntry id="output_good">
|
|
60
|
-
<text>"conditional_approve"</text>
|
|
61
|
-
</outputEntry>
|
|
62
|
-
</rule>
|
|
63
|
-
|
|
64
|
-
<rule id="rule_default">
|
|
65
|
-
<description>Default rejection for all other cases</description>
|
|
66
|
-
<inputEntry id="entry_default_credit">
|
|
67
|
-
<text>-</text>
|
|
68
|
-
</inputEntry>
|
|
69
|
-
<inputEntry id="entry_default_income">
|
|
70
|
-
<text>-</text>
|
|
71
|
-
</inputEntry>
|
|
72
|
-
<inputEntry id="entry_default_loan">
|
|
73
|
-
<text>-</text>
|
|
74
|
-
</inputEntry>
|
|
75
|
-
<outputEntry id="output_default">
|
|
76
|
-
<text>"reject"</text>
|
|
77
|
-
</outputEntry>
|
|
78
|
-
</rule>
|
|
79
|
-
</decisionTable>
|
|
80
|
-
</decision>
|
|
81
|
-
</definitions>
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<definitions xmlns="https://www.omg.org/spec/DMN/20191111/MODEL/"
|
|
3
|
-
id="definitions_invalid"
|
|
4
|
-
name="Invalid Decision"
|
|
5
|
-
namespace="http://decision_agent.local">
|
|
6
|
-
|
|
7
|
-
<decision id="invalid_decision" name="Invalid Decision">
|
|
8
|
-
<decisionTable id="invalid_table" hitPolicy="FIRST">
|
|
9
|
-
<input id="input1" label="Input 1">
|
|
10
|
-
<inputExpression typeRef="string">
|
|
11
|
-
<text>field1</text>
|
|
12
|
-
</inputExpression>
|
|
13
|
-
</input>
|
|
14
|
-
|
|
15
|
-
<output id="output1" label="Output 1" name="output" typeRef="string"/>
|
|
16
|
-
|
|
17
|
-
<!-- This rule is invalid: has 1 input but 2 input entries -->
|
|
18
|
-
<rule id="bad_rule">
|
|
19
|
-
<inputEntry id="entry1">
|
|
20
|
-
<text>"value1"</text>
|
|
21
|
-
</inputEntry>
|
|
22
|
-
<inputEntry id="entry2">
|
|
23
|
-
<text>"value2"</text>
|
|
24
|
-
</inputEntry>
|
|
25
|
-
<outputEntry id="output_entry">
|
|
26
|
-
<text>"result"</text>
|
|
27
|
-
</outputEntry>
|
|
28
|
-
</rule>
|
|
29
|
-
</decisionTable>
|
|
30
|
-
</decision>
|
|
31
|
-
</definitions>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<definitions xmlns="https://www.omg.org/spec/DMN/20191111/MODEL/"
|
|
3
|
-
xmlns:dmndi="https://www.omg.org/spec/DMN/20191111/DMNDI/"
|
|
4
|
-
xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/"
|
|
5
|
-
id="definitions_simple"
|
|
6
|
-
name="Simple Decision"
|
|
7
|
-
namespace="http://decision_agent.local">
|
|
8
|
-
|
|
9
|
-
<decision id="age_check" name="Age Check Decision">
|
|
10
|
-
<decisionTable id="age_check_table" hitPolicy="FIRST">
|
|
11
|
-
<input id="input_age" label="Age">
|
|
12
|
-
<inputExpression typeRef="number">
|
|
13
|
-
<text>age</text>
|
|
14
|
-
</inputExpression>
|
|
15
|
-
</input>
|
|
16
|
-
|
|
17
|
-
<output id="output_decision" label="Decision" name="decision" typeRef="string"/>
|
|
18
|
-
|
|
19
|
-
<rule id="rule_1">
|
|
20
|
-
<description>Approve if age >= 18</description>
|
|
21
|
-
<inputEntry id="entry_1_age">
|
|
22
|
-
<text>>= 18</text>
|
|
23
|
-
</inputEntry>
|
|
24
|
-
<outputEntry id="output_1">
|
|
25
|
-
<text>"approve"</text>
|
|
26
|
-
</outputEntry>
|
|
27
|
-
</rule>
|
|
28
|
-
|
|
29
|
-
<rule id="rule_2">
|
|
30
|
-
<description>Reject if age < 18</description>
|
|
31
|
-
<inputEntry id="entry_2_age">
|
|
32
|
-
<text>< 18</text>
|
|
33
|
-
</inputEntry>
|
|
34
|
-
<outputEntry id="output_2">
|
|
35
|
-
<text>"reject"</text>
|
|
36
|
-
</outputEntry>
|
|
37
|
-
</rule>
|
|
38
|
-
</decisionTable>
|
|
39
|
-
</decision>
|
|
40
|
-
</definitions>
|