Memory Service¶
Decision memory management, rule extraction, hard stops, and batch analysis.
Functions¶
set_data(rows)
¶
Replace the in-memory cache (called after CSV upload).
get_all_rules(filters)
¶
Return filtered rules with available filter values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filters
|
dict[str, str]
|
dict of role_name -> value to filter on. |
required |
Source code in backend/app/plugins/memory/services/memory_service.py
get_summary()
¶
get_decision_quality()
¶
Split rules by quality role using configured quality_values.
Source code in backend/app/plugins/memory/services/memory_service.py
get_soft_thresholds()
¶
Return rules with soft thresholds.
Source code in backend/app/plugins/memory/services/memory_service.py
get_hard_stops()
¶
Return hard stops based on config: action matches action_value AND mitigants empty.
Source code in backend/app/plugins/memory/services/memory_service.py
get_batches()
¶
Group rules by batch role.
Source code in backend/app/plugins/memory/services/memory_service.py
get_trace(rule_id)
¶
Build a trace path from a single rule's fields.
Source code in backend/app/plugins/memory/services/memory_service.py
get_conflicts()
¶
Find risk factors with contradictory actions.
Source code in backend/app/plugins/memory/services/memory_service.py
get_status_counts()
¶
Count rules by status role.
process_uploaded_csv(csv_content)
¶
Process uploaded CSV content into structured role-keyed rule records.
Maps CSV column names -> role names using field_roles config at import time.
Source code in backend/app/plugins/memory/services/memory_service.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | |
create_rule(data)
¶
Create a new rule in the in-memory cache (mock — swap for DB write later).
Accepts role-keyed data directly. Validates required roles.
Source code in backend/app/plugins/memory/services/memory_service.py
delete_rule(rule_id)
¶
Delete a rule from the in-memory cache (mock — swap for DB delete later).
Source code in backend/app/plugins/memory/services/memory_service.py
update_rule(rule_id, updates)
¶
Update a rule in the in-memory cache (mock — swap for DB write later).
Accepts role-keyed updates directly.