Add guardrails dynamodb table #55
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
From the request:
DynamoDB Table Creation Request: Guardrails System
Request Summary
We need a new DynamoDB table created to support the configurable guardrails system for ChatGPT integration in the CMZ chatbot platform. The guardrails system is fully implemented and tested (13/17 tests passing), but requires this table for persistent storage.
Table Specifications
Basic Configuration
quest-dev-guardrailsus-west-2Primary Key Structure
guardrailIdguardrail_XXXXXXXXXX(e.g.,guardrail_1234567890)Attributes Schema
{ "guardrailId": "String (PK)", "name": "String", "description": "String", "category": "String (content|safety|educational|behavioral)", "type": "String (ALWAYS|NEVER|ENCOURAGE|DISCOURAGE)", "rule": "String", "priority": "Number (0-100)", "isActive": "Boolean", "isGlobal": "Boolean", "animalIds": "List<String>", "created": { "at": "String (ISO 8601)", "by": "String" }, "modified": { "at": "String (ISO 8601)", "by": "String" }, "softDelete": "Boolean" }Global Secondary Indexes (GSIs)
GSI 1: By Category
category-indexcategory(String)priority(Number)GSI 2: By Active Status
isActive-indexisActive(Boolean)priority(Number)GSI 3: By Global Status
isGlobal-indexisGlobal(Boolean)priority(Number)Sample Data for Initial Testing
{ "guardrailId": "guardrail_global_001", "name": "Family Friendly Language", "description": "Ensures all responses use age-appropriate language", "category": "content", "type": "ALWAYS", "rule": "Always use language appropriate for all ages", "priority": 100, "isActive": true, "isGlobal": true, "animalIds": [], "created": { "at": "2025-10-09T11:00:00Z", "by": "system" }, "modified": { "at": "2025-10-09T11:00:00Z", "by": "system" }, "softDelete": false }IAM Permissions Required
The application service role needs these permissions:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "dynamodb:GetItem", "dynamodb:PutItem", "dynamodb:UpdateItem", "dynamodb:DeleteItem", "dynamodb:Query", "dynamodb:Scan" ], "Resource": [ "arn:aws:dynamodb:us-west-2:195275676211:table/quest-dev-guardrails", "arn:aws:dynamodb:us-west-2:195275676211:table/quest-dev-guardrails/index/*" ] } ] }Environment Variables to Set
Business Context
The guardrails system provides configurable safety rules for AI-generated content in the zoo's educational chatbot platform. It supports:
Current Status
Testing Validation
Once the table is created, you can validate it's working by:
Timeline
This is blocking the completion of ticket PR003946-178 (Guardrails Validation). Once the table is created, the remaining 4 E2E tests should pass, bringing us to 100% test coverage.
Questions/Contact
For any questions about the table schema or requirements, please reach out. The implementation code is in:
backend/api/src/main/python/openapi_server/impl/guardrails.pybackend/api/src/main/python/tests/integration/test_chatgpt_integration_epic.pyProduction Considerations
When moving to production:
quest-prod-guardrailsPriority: High - Blocking feature completion
Requested by: Keith Charles Stegbauer
Date: 2025-10-09
Ticket Reference: PR003946-178