ApiLogicServer 15.0.52__py3-none-any.whl → 15.0.55__py3-none-any.whl

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.
Files changed (34) hide show
  1. api_logic_server_cli/api_logic_server.py +6 -3
  2. api_logic_server_cli/api_logic_server_info.yaml +3 -3
  3. api_logic_server_cli/create_from_model/api_logic_server_utils.py +9 -0
  4. api_logic_server_cli/prototypes/base/.github/.copilot-instructions.md +49 -21
  5. api_logic_server_cli/prototypes/base/database/alembic/alembic_run.py +98 -0
  6. api_logic_server_cli/prototypes/base/database/alembic/readme_alembic.md +36 -0
  7. api_logic_server_cli/prototypes/base/docs/training/admin_app_1_context.prompt.md +40 -0
  8. api_logic_server_cli/prototypes/base/integration/mcp/mcp_client_executor.py +4 -4
  9. api_logic_server_cli/prototypes/base/readme.md +11 -13
  10. api_logic_server_cli/prototypes/base/security/readme_security.md +0 -1
  11. api_logic_server_cli/prototypes/basic_demo/README.md +267 -272
  12. api_logic_server_cli/prototypes/basic_demo/_config.yml +8 -0
  13. api_logic_server_cli/prototypes/basic_demo/_layouts/redirect.html +15 -0
  14. api_logic_server_cli/prototypes/basic_demo/docs/system-creation-vibe.md +158 -0
  15. api_logic_server_cli/prototypes/basic_demo/logic/declarative-vs-procedural-comparison.html +110 -0
  16. api_logic_server_cli/prototypes/basic_demo/logic/procedural/declarative-vs-procedural-comparison.md +295 -0
  17. api_logic_server_cli/prototypes/manager/samples/prompts/add_email.prompt +8 -0
  18. api_logic_server_cli/prototypes/manager/samples/prompts/elections.prompt +3 -0
  19. api_logic_server_cli/prototypes/manager/samples/prompts/emp_dept.prompt +4 -0
  20. api_logic_server_cli/prototypes/manager/samples/prompts/genai_demo.prompt +13 -0
  21. api_logic_server_cli/prototypes/manager/samples/readme_samples.md +3 -1
  22. api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-Resource-Learning-Prompt.md +1 -1
  23. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/package.json +1 -0
  24. api_logic_server_cli/sqlacodegen_wrapper/sqlacodegen_wrapper.py +5 -2
  25. {apilogicserver-15.0.52.dist-info → apilogicserver-15.0.55.dist-info}/METADATA +1 -1
  26. {apilogicserver-15.0.52.dist-info → apilogicserver-15.0.55.dist-info}/RECORD +30 -23
  27. api_logic_server_cli/prototypes/base/.devcontainer-option/.copilot-instructions.md +0 -178
  28. api_logic_server_cli/prototypes/base/database/alembic/readme.md +0 -18
  29. api_logic_server_cli/prototypes/base/database/system/SAFRSBaseX.pyZ +0 -73
  30. api_logic_server_cli/prototypes/basic_demo/customizations/database/system/SAFRSBaseX.py +0 -139
  31. {apilogicserver-15.0.52.dist-info → apilogicserver-15.0.55.dist-info}/WHEEL +0 -0
  32. {apilogicserver-15.0.52.dist-info → apilogicserver-15.0.55.dist-info}/entry_points.txt +0 -0
  33. {apilogicserver-15.0.52.dist-info → apilogicserver-15.0.55.dist-info}/licenses/LICENSE +0 -0
  34. {apilogicserver-15.0.52.dist-info → apilogicserver-15.0.55.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,8 @@
1
+ # GitHub Pages / Jekyll Configuration
2
+ # Enable processing of markdown files
3
+ markdown: kramdown
4
+ highlighter: rouge
5
+
6
+ # Include the _layouts directory
7
+ include:
8
+ - _layouts
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta http-equiv="refresh" content="1;url={{ page.redirect }}" />
6
+ <link rel="canonical" href="{{ page.redirect }}" />
7
+ <script type="text/javascript">
8
+ window.location.href = "{{ page.redirect }}"
9
+ </script>
10
+ <title>Page Redirection</title>
11
+ </head>
12
+ <body>
13
+ If you are not redirected automatically, follow <a href='{{ page.redirect }}'>this link</a>.
14
+ </body>
15
+ </html>
@@ -0,0 +1,158 @@
1
+ ---
2
+ title: Vibe MCP / Microservice
3
+ do_process_code_block_titles: True
4
+ version: 0.23 from docsite 7/11/2025
5
+ ---
6
+ <style>
7
+ .md-typeset h1,
8
+ .md-content__button {
9
+ display: none;
10
+ }
11
+ </style>
12
+
13
+ << Under Construction >>
14
+
15
+ # Vibe an MCP Microservice
16
+
17
+ See the Readme for detailed walk through.
18
+
19
+ Scenario: we have an existing database (customers, order, items and product), and we require:
20
+
21
+ * An MCP-enabled API, for integration
22
+ * MCP client support to send emails for overdue orders
23
+ * Business Logic to check credit by rolling up Items and Orders.
24
+
25
+ This is a record of how we created the system using CoPilot Chat (*Vibe*).
26
+
27
+ <br>
28
+
29
+ ## Initialize CoPilot
30
+
31
+ ```
32
+ Please find and read `.github/.copilot-instructions.md`.
33
+ ```
34
+
35
+ <br>
36
+
37
+ ## Create the System
38
+
39
+ ```bash title="Create a project from an existing database"
40
+ # in the GenAI-Logic Manager:
41
+ Create a database project from samples/dbs/basic_demo.sqlite
42
+ ```
43
+
44
+ <br>
45
+
46
+ ## Verify the API and Admin App
47
+
48
+ The project should automatically open a new window in VSCode. Again, open CoPilot and bootstrap it with: <br>
49
+
50
+ ```bash title="Initialize CoPilot"
51
+ Please find and read `.github/.copilot-instructions.md`**.
52
+ ```
53
+
54
+ Verify it as follows:
55
+
56
+ * **Click F5** to start server, open app at http://localhost:5656/
57
+ * **Verify API:** filtering, sorting, pagination, optimistic locking and related data access - see the Swagger
58
+ * **Verify Admin App:** multi-page, multi-table, automatic joins, lookups, cascade add - collaboration-ready
59
+
60
+ <br>
61
+
62
+ ## Create a Custom React App
63
+
64
+ ```bash title="Create a custom react app"
65
+ Create a react app.
66
+ ```
67
+
68
+ <br>
69
+
70
+ ```txt title='Customize using Natural Language - Add Cards'
71
+ In the ui/react app, update the Product list to provide users an option to see results in a list,
72
+ or in cards.
73
+ ```
74
+ <br>
75
+
76
+ todo - diagram
77
+
78
+ **Test: verify option for cards on `http://localhost:3000`**
79
+
80
+ <br>
81
+
82
+ ## MCP Client - Overdue Orders
83
+
84
+ **Stop the Server**
85
+
86
+ <br>
87
+
88
+ ``` bash title="Add a Table to Track Sent Emails"
89
+ Create a table SysEmail in `database/db.sqlite` as a child of customer,
90
+ with columns id, message, subject, customer_id and CreatedOn.
91
+ ```
92
+ Follow the suggestions to update the admin app.
93
+
94
+ <br>
95
+
96
+ <br>
97
+
98
+ ``` bash title="Create MCP Executor: process request - invokes the LLM to obtain a series of API calls to run, and runs them"
99
+ Create the mcp client executor
100
+ ```
101
+
102
+ <br>
103
+
104
+ ``` bash title="Create the email service using SysEmail as a Request Table"
105
+ Add an after_flush event on SysEmail to produce a log message "email sent",
106
+ unless the customer has opted out.
107
+ ```
108
+
109
+ <br>
110
+
111
+ ```bash title="Business Logic to Honor Email Opt-out"
112
+ Add an after_flush event on SysEmail to produce a log message "email sent",
113
+ unless the customer has opted out.
114
+ ```
115
+
116
+ <br>
117
+
118
+ ```text title="Test the MCP Client: Click SysMCP >> Create New, and enter"
119
+ List the orders date_shipped is null and CreatedOn before 2023-07-14,
120
+ and send a discount email (subject: 'Discount Offer') to the customer for each one.
121
+ ```
122
+
123
+ <br>
124
+ todo - diagram
125
+
126
+ **Use the Admin App to Verify the first customer has an email**
127
+
128
+ <br>
129
+
130
+ ## Check Credit Business Logic
131
+
132
+ **1. Stop the Server** (Red Stop button, or Shift-F5 -- see Appendix)
133
+
134
+ **2. Add Business Logic**
135
+
136
+ ```bash title="Check Credit Logic (instead of 220 lines of code)"
137
+ Use case: Check Credit
138
+ 1. The Customer's balance is less than the credit limit
139
+ 2. The Customer's balance is the sum of the Order amount_total where date_shipped is null
140
+ 3. The Order's amount_total is the sum of the Item amount
141
+ 4. The Item amount is the quantity * unit_price
142
+ 5. The Item unit_price is copied from the Product unit_price
143
+
144
+ Use case: App Integration
145
+ 1. Send the Order to Kafka topic 'order_shipping' if the date_shipped is not None.
146
+ ```
147
+
148
+ To test the logic:
149
+
150
+ **1. Use the Admin App to access the first order for `Customer Alice`**
151
+
152
+ **2. Edit its first item to a very high quantity**
153
+
154
+ todo - diagram
155
+
156
+ The update is properly rejected because it exceeds the credit limit. Observe the rules firing in the console log - see Logic In Action, below.
157
+
158
+ <br>
@@ -0,0 +1,110 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Page Moved - Declarative vs Procedural Comparison</title>
6
+ <meta http-equiv="refresh" content="3; url=https://apilogicserver.github.io/basic_demo/logic/procedural/declarative-vs-procedural-comparison.html">
7
+ <link rel="canonical" href="https://apilogicserver.github.io/basic_demo/logic/procedural/declarative-vs-procedural-comparison.html">
8
+ <style>
9
+ body {
10
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
11
+ max-width: 600px;
12
+ margin: 50px auto;
13
+ padding: 20px;
14
+ line-height: 1.6;
15
+ }
16
+ .redirect-box {
17
+ border: 2px solid #007acc;
18
+ padding: 30px;
19
+ border-radius: 8px;
20
+ background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
21
+ box-shadow: 0 4px 6px rgba(0,0,0,0.1);
22
+ }
23
+ .countdown {
24
+ font-weight: bold;
25
+ color: #007acc;
26
+ font-size: 1.2em;
27
+ }
28
+ .manual-link {
29
+ display: inline-block;
30
+ background: #007acc;
31
+ color: white;
32
+ padding: 12px 24px;
33
+ text-decoration: none;
34
+ border-radius: 5px;
35
+ margin: 10px 0;
36
+ font-weight: bold;
37
+ }
38
+ .manual-link:hover {
39
+ background: #005c99;
40
+ }
41
+ h1 { color: #333; margin-top: 0; }
42
+ .progress-bar {
43
+ width: 100%;
44
+ height: 6px;
45
+ background: #ddd;
46
+ border-radius: 3px;
47
+ margin: 15px 0;
48
+ overflow: hidden;
49
+ }
50
+ .progress-fill {
51
+ height: 100%;
52
+ background: #007acc;
53
+ width: 100%;
54
+ transition: width 1s linear;
55
+ }
56
+ </style>
57
+ <script>
58
+ let seconds = 3;
59
+ function redirect() {
60
+ window.location.href = "https://apilogicserver.github.io/basic_demo/logic/procedural/declarative-vs-procedural-comparison.html";
61
+ }
62
+ function updateCountdown() {
63
+ const countdownElement = document.getElementById('countdown');
64
+ const progressElement = document.getElementById('progress-fill');
65
+
66
+ if (countdownElement) {
67
+ countdownElement.textContent = seconds;
68
+ }
69
+ if (progressElement) {
70
+ progressElement.style.width = ((3-seconds)/3 * 100) + '%';
71
+ }
72
+
73
+ if (seconds <= 0) {
74
+ redirect();
75
+ } else {
76
+ seconds--;
77
+ setTimeout(updateCountdown, 1000);
78
+ }
79
+ }
80
+ window.onload = function() {
81
+ updateCountdown();
82
+ // Fallback redirect in case JavaScript fails
83
+ setTimeout(redirect, 3100);
84
+ }
85
+ </script>
86
+ </head>
87
+ <body>
88
+ <div class="redirect-box">
89
+ <h1>📄 Page Moved</h1>
90
+ <p>The <strong>Declarative vs Procedural Logic Comparison</strong> has moved to a new location.</p>
91
+
92
+ <div class="progress-bar">
93
+ <div id="progress-fill" class="progress-fill" style="width: 0%;"></div>
94
+ </div>
95
+
96
+ <p>Redirecting automatically in <span id="countdown" class="countdown">3</span> seconds...</p>
97
+
98
+ <p><strong>If you are not redirected automatically:</strong></p>
99
+ <a href="https://apilogicserver.github.io/basic_demo/logic/procedural/declarative-vs-procedural-comparison.html" class="manual-link">
100
+ 👉 Go to New Location
101
+ </a>
102
+
103
+ <hr style="margin: 25px 0; border: none; border-top: 1px solid #ddd;">
104
+ <p><small>
105
+ <strong>New URL:</strong><br>
106
+ <code>https://apilogicserver.github.io/basic_demo/logic/procedural/declarative-vs-procedural-comparison.html</code>
107
+ </small></p>
108
+ </div>
109
+ </body>
110
+ </html>
@@ -0,0 +1,295 @@
1
+ # Declarative vs. Procedural Business Logic: A Comprehensive Comparison
2
+
3
+ <br>
4
+
5
+ ## Foreword
6
+
7
+ This document presents a real-world A/B comparison of two approaches to implementing the **same business logic requirements.** We asked AI to generate both a **procedural** implementation using conventional code, and a **declarative** implementation using the LogicBank rules engine.
8
+
9
+ This experiment highlights fundamental differences between the two approaches, and what they mean for building reliable, maintainable systems. It's important, because business logic typically represents *nearly half the effort* in database projects.
10
+
11
+ When asked to produce logic, AI (by itself) defaults to procedural code — because that’s all it knows. This study uncovered two critical problems with that approach:
12
+ 1. **Quality:** The AI-generated procedural code contained subtle but serious bugs, even for just five rules—falling far short of basic reliability.
13
+ 2. **Maintainability:** The procedural implementation exploded to over 200 lines — more than 40X the size of its declarative equivalent — creating “Franken-Code” that is brittle, opaque, and costly to maintain.
14
+
15
+ By contrast, the declarative approach was error free, and 5 Python statements.
16
+
17
+ The answer isn’t to reject AI. Its speed and simplicity are transformative. The key is to **teach AI about declarative rules** so it can produce concise, expressive rules instead of hundreds of lines of brittle procedural code. These rules are then executed by an **automated runtime engine** (like LogicBank), ensuring correctness, scalability, and maintainability — while preserving the velocity that makes AI so valuable.
18
+
19
+ By combining AI with declarative automation, GenAI-Logic delivers the best of both worlds: rapid development and enterprise-grade governance.
20
+
21
+ ![visually](declarative-vs-procedural-comparison.png)
22
+
23
+ <br>
24
+
25
+ ### Deeper Dive
26
+
27
+ [GenAI-Logic](https://www.genai-logic.com) is free and open source, so you can install it to explore declarative logic - [click here](https://apilogicserver.github.io/Docs/Install-Express/). This project is available in github - [click here](https://github.com/ApiLogicServer/basic_demo/blob/main/logic/declarative-vs-procedural-comparison.md).
28
+
29
+ <br>
30
+
31
+ ### How this Document Was Created
32
+
33
+ We created this document from the following scenario:
34
+
35
+ 1. Built the `basic_demo` project [as described here](https://apilogicserver.github.io/Docs/Sample-Basic-Demo/).
36
+ 2. We asked CoPilot to **rebuild the logic *using a procedural approach*** - that is, without the LogicBank rule engine (part of GenAI-Logic).
37
+ * Resulting Procedural Logic: `logic/procedural_logic.py`
38
+ * Declarative logic: `logic/declare_logic.py` (*with LogicBank,* [below](#business-requirements))
39
+ 3. We asked Copilot: **what would happen if the orders' customer-id were changed?**
40
+ * Copilot accepted this as a serious error, and made the bug fix.
41
+ 4. We then asked Copilot: *what if the items' product-id were changed?*
42
+ * Copilot became agitated at finding yet another serious bug...
43
+ * It fixed it, and - ***unprompted* - provided the following analysis** of *Declarative vs Procedural Business Logic.*
44
+
45
+ <br>
46
+
47
+ > Here's the Copilot analysis, in its own words.
48
+
49
+ <br>
50
+
51
+
52
+ ## TL;DR
53
+
54
+ **LogicBank declarative rules provide a 44X reduction in code complexity** compared to traditional procedural implementations:
55
+
56
+ | Aspect | LogicBank Declarative | Procedural Code |
57
+ |--------|----------------------|-----------------|
58
+ | **Lines of Code** | 5 lines | 220+ lines |
59
+ | **Complexity** | Simple rule declarations | Complex event handling |
60
+ | **Maintenance** | Self-documenting business logic | Implementation details obscure logic |
61
+ | **Performance** | Built-in optimization & pruning | Multiple queries, N+1 problems |
62
+ | **Error Handling** | Automatic cascading | Manual event management |
63
+ | **Business Alignment** | Rules match requirements | Code doesn't reflect business intent |
64
+
65
+ **Bottom Line**: Declarative business logic eliminates complexity while providing better performance, maintainability, and business alignment.
66
+
67
+ ---
68
+
69
+ ## Overview
70
+
71
+ This document compares two approaches to implementing business logic in enterprise applications:
72
+ - **Declarative Logic** using LogicBank rules
73
+ - **Traditional Procedural Logic** using event handlers
74
+
75
+ The comparison is based on implementing the same business requirements using both approaches in an order management system.
76
+
77
+ ## Business Requirements
78
+
79
+ Our test case implements these common business rules:
80
+
81
+ 1. **Copy unit_price from Product to Item**
82
+ 2. **Calculate Item amount = quantity × unit_price**
83
+ 3. **Calculate Order total = sum of Item amounts**
84
+ 4. **Update Customer balance = sum of unshipped Order totals**
85
+ 5. **Ensure Customer balance ≤ credit_limit**
86
+ 6. **Validate Item quantity > 0**
87
+ 7. **Log order events**
88
+
89
+ ## Code Comparison
90
+
91
+ ### LogicBank Declarative Rules (~5 lines)
92
+
93
+ ```python
94
+ # Business logic expressed as simple, readable rules
95
+ def declare_logic():
96
+ # Rule 1: Copy unit price from product to item
97
+ Rule.copy(derive=Item.unit_price, from_parent=Product.unit_price)
98
+
99
+ # Rule 2: Calculate item amount
100
+ Rule.formula(derive=Item.amount, as_expression=lambda row: row.quantity * row.unit_price)
101
+
102
+ # Rule 3: Calculate order total
103
+ Rule.sum(derive=Order.amount_total, as_sum_of=Item.amount)
104
+
105
+ # Rule 4: Update customer balance
106
+ Rule.sum(derive=Customer.balance, as_sum_of=Order.amount_total,
107
+ where=lambda row: row.date_shipped is None)
108
+
109
+ # Rule 5: Validate credit limit
110
+ Rule.constraint(validate=Customer,
111
+ as_condition=lambda row: row.balance <= row.credit_limit,
112
+ error_msg="Customer balance exceeds credit limit")
113
+ ```
114
+
115
+ ### Procedural Implementation (~220 lines)
116
+
117
+ ```python
118
+ # Complex event handling with manual cascading
119
+ def handle_item_update(mapper, connection, target: models.Item):
120
+ session = Session.object_session(target)
121
+
122
+ # Get OLD version to detect changes
123
+ old_item = session.query(models.Item).get(target.id)
124
+
125
+ # Validate quantity
126
+ ProceduralBusinessLogic.validate_item_quantity(target)
127
+
128
+ # Handle product changes (CRITICAL BUG FIX)
129
+ if old_item and old_item.product_id != target.product_id:
130
+ ProceduralBusinessLogic.copy_unit_price_from_product(target, session)
131
+
132
+ # Recalculate item amount
133
+ ProceduralBusinessLogic.calculate_item_amount(target)
134
+
135
+ # Handle order changes (another potential bug!)
136
+ if old_item and old_item.order_id != target.order_id:
137
+ # Update OLD order total
138
+ old_order = session.query(models.Order).get(old_item.order_id)
139
+ if old_order:
140
+ ProceduralBusinessLogic.calculate_order_total(old_order, session)
141
+ # Update old customer balance
142
+ old_customer = session.query(models.Customer).get(old_order.customer_id)
143
+ if old_customer:
144
+ ProceduralBusinessLogic.update_customer_balance(old_customer, session)
145
+ ProceduralBusinessLogic.validate_credit_limit(old_customer)
146
+
147
+ # Update NEW order total
148
+ if target.order_id:
149
+ order = session.query(models.Order).get(target.order_id)
150
+ if order:
151
+ ProceduralBusinessLogic.calculate_order_total(order, session)
152
+ customer = session.query(models.Customer).get(order.customer_id)
153
+ if customer:
154
+ ProceduralBusinessLogic.update_customer_balance(customer, session)
155
+ ProceduralBusinessLogic.validate_credit_limit(customer)
156
+ ```
157
+
158
+ ## Detailed Comparison
159
+
160
+ ### 1. **Code Volume**
161
+ | Aspect | LogicBank | Procedural |
162
+ |--------|-----------|------------|
163
+ | Lines of Code | ~5 | ~220 |
164
+ | Complexity | Simple rule declarations | Complex event handling |
165
+ | Ratio | **44X MORE CONCISE** | Baseline |
166
+
167
+ ### 2. **Maintainability**
168
+
169
+ **LogicBank:**
170
+ - ✅ Rules are self-documenting
171
+ - ✅ Business logic is immediately recognizable
172
+ - ✅ Changes are localized to specific rules
173
+ - ✅ Easy to add new rules without affecting existing ones
174
+
175
+ **Procedural:**
176
+ - ❌ Business logic buried in implementation details
177
+ - ❌ Hard to understand the complete business flow
178
+ - ❌ Changes require understanding entire event chain
179
+ - ❌ Risk of breaking existing functionality
180
+
181
+ ### 3. **Error Handling & Edge Cases**
182
+
183
+ **LogicBank:**
184
+ - ✅ Automatic handling of all change scenarios
185
+ - ✅ Built-in transaction rollback
186
+ - ✅ No need to manually track old/new values
187
+ - ✅ Automatic cascade management
188
+
189
+ **Procedural:**
190
+ - ❌ Manual handling of every edge case
191
+ - ❌ Comments like "CRITICAL BUG FIX" indicate complexity
192
+ - ❌ Must manually track old values for comparison
193
+ - ❌ Easy to miss scenarios (product changes, order moves, etc.)
194
+
195
+ ### 4. **Performance**
196
+
197
+ **LogicBank:**
198
+ - ✅ **Pruning**: Rules only fire when dependent attributes change
199
+ - ✅ **Optimization**: Uses SQL "adjustment" updates vs full recalculations
200
+ - ✅ **Minimal SQL**: Optimized query patterns
201
+ - ✅ **No N+1 problems**: Intelligent batching
202
+
203
+ **Procedural:**
204
+ - ❌ Multiple queries per operation
205
+ - ❌ Potential N+1 problems
206
+ - ❌ Full recalculations even for minor changes
207
+ - ❌ No automatic optimization
208
+
209
+ ### 5. **Debugging & Observability**
210
+
211
+ **LogicBank:**
212
+ - ✅ Clear rule execution logs
213
+ - ✅ Shows rule chains and dependencies
214
+ - ✅ Easy to trace business logic flow
215
+ - ✅ Built-in logging with row state changes
216
+
217
+ **Procedural:**
218
+ - ❌ Hard to trace through event handlers
219
+ - ❌ Must manually add logging
220
+ - ❌ Difficult to understand execution flow
221
+ - ❌ Error messages don't relate to business rules
222
+
223
+ ### 6. **Testing**
224
+
225
+ **LogicBank:**
226
+ - ✅ Test individual rules independently
227
+ - ✅ Clear rule execution reports
228
+ - ✅ Behave testing integration
229
+ - ✅ Rules map directly to test scenarios
230
+
231
+ **Procedural:**
232
+ - ❌ Must test entire event chain
233
+ - ❌ Hard to isolate specific logic
234
+ - ❌ Complex test setup required
235
+ - ❌ Brittle tests that break with changes
236
+
237
+ ### 7. **Business Alignment**
238
+
239
+ **LogicBank:**
240
+ - ✅ Rules read like business requirements
241
+ - ✅ Business users can understand the logic
242
+ - ✅ Direct mapping from requirements to code
243
+ - ✅ Self-documenting business policies
244
+
245
+ **Procedural:**
246
+ - ❌ Implementation details obscure business logic
247
+ - ❌ Business users cannot read the code
248
+ - ❌ No clear mapping from requirements
249
+ - ❌ Business logic scattered across handlers
250
+
251
+ ## Real-World Impact
252
+
253
+ ### Development Time
254
+ - **LogicBank**: Write rules once, they work everywhere
255
+ - **Procedural**: Must consider every possible scenario upfront
256
+
257
+ ### Risk Management
258
+ - **LogicBank**: Automatic handling reduces risk of bugs
259
+ - **Procedural**: High risk of missing edge cases
260
+
261
+ ### Team Productivity
262
+ - **LogicBank**: New team members can quickly understand rules
263
+ - **Procedural**: Requires deep understanding of event system
264
+
265
+ ### Business Agility
266
+ - **LogicBank**: Easy to modify rules as business changes
267
+ - **Procedural**: Changes require extensive testing and validation
268
+
269
+ ## Conclusion
270
+
271
+ The comparison demonstrates that **LogicBank provides a 44X reduction in code complexity** while delivering:
272
+
273
+ - **Better Maintainability**: Rules are self-documenting and easy to modify
274
+ - **Higher Quality**: Automatic handling eliminates common bugs
275
+ - **Better Performance**: Built-in optimizations and pruning
276
+ - **Business Alignment**: Rules directly express business requirements
277
+ - **Faster Development**: Write less code, get more functionality
278
+
279
+ ### The LogicBank Advantage
280
+
281
+ > **"Logic is declarative, not procedural"**
282
+
283
+ LogicBank represents a fundamental shift from asking **"How do I implement this?"** to **"What do I want to happen?"**
284
+
285
+ This declarative approach:
286
+ 1. **Eliminates the complexity** of manual event handling
287
+ 2. **Reduces maintenance burden** through automatic rule management
288
+ 3. **Improves business alignment** with readable, requirements-based rules
289
+ 4. **Accelerates development** with dramatically less code
290
+
291
+ The evidence is clear: **Declarative business logic is not just more concise—it's fundamentally superior for enterprise application development.**
292
+
293
+ ---
294
+
295
+ *This comparison is based on actual implementations in the API Logic Server project, demonstrating real-world benefits of declarative business logic.*
@@ -0,0 +1,8 @@
1
+ Create a table SysEmail in `database/db.sqlite` as a child of customer,
2
+ with columns id, message, subject, customer_id and CreatedOn.
3
+
4
+ Add an after_flush event on SysEmail to produce a log message "email sent",
5
+ unless the customer has opted out.
6
+
7
+ List the orders date_shipped is null and CreatedOn before 2023-07-14,
8
+ and send a discount email (subject: 'Discount Offer') to the customer for each one.
@@ -0,0 +1,3 @@
1
+ Create a Star wars themed presidential election app.
2
+
3
+ Create at least 15 tables.
@@ -0,0 +1,4 @@
1
+ System for Departments and Employees.
2
+
3
+ LogicBank:
4
+ 1. Sum of employee salaries cannot exceed department budget
@@ -0,0 +1,13 @@
1
+ Create a system with customers, orders, items and products.
2
+
3
+ Include a notes field for orders.
4
+
5
+ Use case: Check Credit
6
+ 1. The Customer's balance is less than the credit limit
7
+ 2. The Customer's balance is the sum of the Order amount_total where date_shipped is null
8
+ 3. The Order's amount_total is the sum of the Item amount
9
+ 4. The Item amount is the quantity * unit_price
10
+ 5. The Item unit_price is copied from the Product unit_price
11
+
12
+ Use case: App Integration
13
+ 1. Send the Order to Kafka topic 'order_shipping' if the date_shipped is not None.
@@ -8,10 +8,12 @@ The created `samples/nw_sample` illustrates important customization sample code
8
8
 
9
9
  The `samples/db` files are pre-installed sqlite databases. These allow you to explore creating projects from existing databases.
10
10
 
11
- For example, create Northwind like this:
11
+ For example, create Northwind and basic_demo like this:
12
12
 
13
13
  ```bash
14
14
  genai-logic create --project_name=nw --db_url=sqlite:///samples/dbs/nw.sqlite
15
+
16
+ genai-logic create --project_name=basic_demo --db_url=sqlite:///samples/dbs/basic_demo
15
17
  ```
16
18
 
17
19
  ## Database Connectivity
@@ -10,7 +10,7 @@ Sample code (follow these guidelines EXACTLY):
10
10
  ```
11
11
  <sample-code>
12
12
  // begin MANDATORY imports (always generated EXACTLY)
13
- import React from 'react';
13
+ import React, { useState } from 'react';
14
14
  import { List, FunctionField, Datagrid, TextField, EmailField, DateField, NumberField } from 'react-admin';
15
15
  import { ReferenceField, ReferenceManyField } from 'react-admin';
16
16
  import { TabbedShowLayout, Tab, SimpleShowLayout, TextInput, NumberInput, DateTimeInput } from 'react-admin';
@@ -11,6 +11,7 @@
11
11
  "@testing-library/react": "^16.3.0",
12
12
  "@testing-library/user-event": "^13.5.0",
13
13
  "compare-versions": "^6.1.1",
14
+ "js-yaml": "^4.1.0",
14
15
  "keycloak-js": "^26.2.0",
15
16
  "react": "^19.1.0",
16
17
  "react-admin": "^5.8.3",
@@ -60,9 +60,12 @@ import os, sys
60
60
  from pathlib import Path
61
61
  from os.path import abspath
62
62
  from api_logic_server_cli.cli_args_project import Project
63
- import oracledb
64
-
65
63
  log = logging.getLogger(__name__)
64
+ try:
65
+ import oracledb
66
+ except ImportError:
67
+ log.error("oracledb dll not found, Oracle support disabled")
68
+ oracledb = None
66
69
 
67
70
  MODEL_DIR = tempfile.mkdtemp() # directory where the generated models.py will be saved
68
71
  on_import = False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ApiLogicServer
3
- Version: 15.0.52
3
+ Version: 15.0.55
4
4
  Author-email: Val Huber <apilogicserver@gmail.com>
5
5
  License-Expression: BSD-3-Clause
6
6
  Project-URL: Homepage, https://www.genai-logic.com