ApiLogicServer 14.2.2__py3-none-any.whl → 14.3.0__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 (75) hide show
  1. {ApiLogicServer-14.2.2.dist-info → ApiLogicServer-14.3.0.dist-info}/METADATA +2 -2
  2. {ApiLogicServer-14.2.2.dist-info → ApiLogicServer-14.3.0.dist-info}/RECORD +73 -54
  3. api_logic_server_cli/api_logic_server.py +47 -10
  4. api_logic_server_cli/api_logic_server_info.yaml +3 -3
  5. api_logic_server_cli/cli.py +9 -3
  6. api_logic_server_cli/create_from_model/__pycache__/api_logic_server_utils.cpython-312.pyc +0 -0
  7. api_logic_server_cli/create_from_model/__pycache__/ont_build.cpython-312.pyc +0 -0
  8. api_logic_server_cli/create_from_model/__pycache__/ont_create.cpython-312.pyc +0 -0
  9. api_logic_server_cli/create_from_model/api_logic_server_utils.py +4 -0
  10. api_logic_server_cli/create_from_model/ont_build.py +53 -19
  11. api_logic_server_cli/create_from_model/ont_create.py +14 -5
  12. api_logic_server_cli/fragments/declare_logic.py +72 -0
  13. api_logic_server_cli/{prototypes/manager/system/genai/create_db_models_inserts/logic_discovery_prefix.py → fragments/declare_logic_begin.py} +2 -1
  14. api_logic_server_cli/fragments/declare_logic_end.py +52 -0
  15. api_logic_server_cli/genai/client.py +24 -0
  16. api_logic_server_cli/genai/genai.py +37 -17
  17. api_logic_server_cli/genai/genai_logic_builder.py +21 -35
  18. api_logic_server_cli/genai/genai_svcs.py +109 -13
  19. api_logic_server_cli/genai/genai_utils.py +0 -1
  20. api_logic_server_cli/model_migrator/model_migrator_start.py +1 -1
  21. api_logic_server_cli/model_migrator/reposreader.py +9 -1
  22. api_logic_server_cli/model_migrator/rule_obj.py +24 -6
  23. api_logic_server_cli/prototypes/base/api/api_discovery/ontimize_api.py +4 -1
  24. api_logic_server_cli/prototypes/base/config/activate_logicbank.py +8 -4
  25. api_logic_server_cli/prototypes/base/config/config.py +10 -6
  26. api_logic_server_cli/prototypes/base/database/bind_dbs.py +2 -1
  27. api_logic_server_cli/prototypes/base/database/test_data/readme.md +5 -5
  28. api_logic_server_cli/prototypes/base/logic/declare_logic.py +8 -3
  29. api_logic_server_cli/prototypes/base/logic/load_verify_rules.py +216 -0
  30. api_logic_server_cli/prototypes/base/logic/logic_discovery/auto_discovery.py +23 -11
  31. api_logic_server_cli/prototypes/genai_demo/database/models.py +11 -55
  32. api_logic_server_cli/prototypes/genai_demo/logic/declare_logic.py +29 -21
  33. api_logic_server_cli/prototypes/manager/.vscode/launch.json +3 -3
  34. api_logic_server_cli/prototypes/manager/README.md +25 -10
  35. api_logic_server_cli/prototypes/manager/system/genai/create_db_models_inserts/create_db_models_imports.py +1 -0
  36. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo.response_example +19 -18
  37. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_iteration_discount/.DS_Store +0 -0
  38. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_iteration_discount/000_you_are.prompt +1 -0
  39. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_iteration_discount/001_logic_training.prompt +314 -0
  40. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_iteration_discount/002_create_db_models.prompt +150 -0
  41. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_iteration_discount/003_create_db_models.response +134 -0
  42. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_iteration_discount/004_iteratio_logic.prompt +131 -0
  43. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_iteration_discount/005_create_db_models.response-example +141 -0
  44. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_iteration_discount/create_db_models.py +105 -0
  45. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_iteration_discount/db.dbml +70 -0
  46. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_iteration_discount/readme.md +6 -0
  47. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_iteration_discount/response.json +178 -0
  48. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/wg_dev_merge/base_genai_demo_no_logic/logic/declare_logic.py +0 -1
  49. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/wg_dev_merge/dev_demo_no_logic_fixed/logic/declare_logic.py +0 -1
  50. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/wg_dev_merge/wg_demo_no_logic_fixed/genai/examples/genai_demo/wg_dev_merge/base_genai_demo_no_logic/logic/declare_logic.py +0 -1
  51. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/wg_dev_merge/wg_demo_no_logic_fixed/genai/examples/genai_demo/wg_dev_merge/dev_demo_no_logic_fixed/logic/declare_logic.py +0 -1
  52. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/wg_dev_merge/wg_demo_no_logic_fixed/genai/examples/genai_demo/wg_dev_merge/wg_genai_demo_no_logic_fixed_from_CLI/logic/declare_logic.py +0 -1
  53. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/wg_dev_merge/wg_demo_no_logic_fixed/logic/declare_logic.py +0 -1
  54. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/wg_dev_merge/wg_demo_no_logic_fixed/system/genai/examples/genai_demo/wg_dev_merge/base_genai_demo_no_logic/logic/declare_logic.py +0 -1
  55. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/wg_dev_merge/wg_demo_no_logic_fixed/system/genai/examples/genai_demo/wg_dev_merge/dev_demo_no_logic_fixed/logic/declare_logic.py +0 -1
  56. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/wg_dev_merge/wg_demo_no_logic_fixed/system/genai/examples/genai_demo/wg_dev_merge/wg_genai_demo_no_logic_fixed_from_CLI/logic/declare_logic.py +0 -1
  57. api_logic_server_cli/prototypes/manager/system/genai/examples/time_tracking_billing/002_create_db_models.prompt +194 -0
  58. api_logic_server_cli/prototypes/manager/system/genai/examples/time_tracking_billing/003_create_db_models.response +298 -0
  59. api_logic_server_cli/prototypes/manager/system/genai/examples/time_tracking_billing/db.sqlite +0 -0
  60. api_logic_server_cli/prototypes/manager/system/genai/examples/time_tracking_billing/readme.md +8 -0
  61. api_logic_server_cli/prototypes/manager/system/genai/learning_requests/logic_bank_api.prompt +14 -10
  62. api_logic_server_cli/prototypes/manager/system/genai/prompt_inserts/iteration.prompt +2 -1
  63. api_logic_server_cli/prototypes/nw_no_cust/venv_setup/system_note.txt +1 -1
  64. api_logic_server_cli/prototypes/ont_app/templates/home_tree_template.html +9 -0
  65. api_logic_server_cli/prototypes/ont_app/templates/tree_routing.jinja +32 -0
  66. api_logic_server_cli/sqlacodegen_wrapper/sqlacodegen/sqlacodegen/__pycache__/codegen.cpython-312.pyc +0 -0
  67. api_logic_server_cli/sqlacodegen_wrapper/sqlacodegen/sqlacodegen/codegen.py +2 -1
  68. api_logic_server_cli/tools/mini_skel/logic/load_verify_rules.py +1 -1
  69. api_logic_server_cli/tools/mini_skel/run.py +1 -0
  70. api_logic_server_cli/model_migrator/system/custom_endpoint.py +0 -545
  71. api_logic_server_cli/prototypes/base/database/test_data/z_test_data_rows.py +0 -98
  72. {ApiLogicServer-14.2.2.dist-info → ApiLogicServer-14.3.0.dist-info}/LICENSE +0 -0
  73. {ApiLogicServer-14.2.2.dist-info → ApiLogicServer-14.3.0.dist-info}/WHEEL +0 -0
  74. {ApiLogicServer-14.2.2.dist-info → ApiLogicServer-14.3.0.dist-info}/entry_points.txt +0 -0
  75. {ApiLogicServer-14.2.2.dist-info → ApiLogicServer-14.3.0.dist-info}/top_level.txt +0 -0
@@ -3,7 +3,6 @@ from decimal import Decimal
3
3
  from logic_bank.exec_row_logic.logic_row import LogicRow
4
4
  from logic_bank.extensions.rule_extensions import RuleExtension
5
5
  from logic_bank.logic_bank import Rule
6
- from logic_bank.logic_bank import DeclareRule
7
6
  import database.models as models
8
7
  from database.models import *
9
8
  import api.system.opt_locking.opt_locking as opt_locking
@@ -3,7 +3,6 @@ from decimal import Decimal
3
3
  from logic_bank.exec_row_logic.logic_row import LogicRow
4
4
  from logic_bank.extensions.rule_extensions import RuleExtension
5
5
  from logic_bank.logic_bank import Rule
6
- from logic_bank.logic_bank import DeclareRule
7
6
  import database.models as models
8
7
  from database.models import *
9
8
  import api.system.opt_locking.opt_locking as opt_locking
@@ -3,7 +3,6 @@ from decimal import Decimal
3
3
  from logic_bank.exec_row_logic.logic_row import LogicRow
4
4
  from logic_bank.extensions.rule_extensions import RuleExtension
5
5
  from logic_bank.logic_bank import Rule
6
- from logic_bank.logic_bank import DeclareRule
7
6
  import database.models as models
8
7
  from database.models import *
9
8
  import api.system.opt_locking.opt_locking as opt_locking
@@ -3,7 +3,6 @@ from decimal import Decimal
3
3
  from logic_bank.exec_row_logic.logic_row import LogicRow
4
4
  from logic_bank.extensions.rule_extensions import RuleExtension
5
5
  from logic_bank.logic_bank import Rule
6
- from logic_bank.logic_bank import DeclareRule
7
6
  import database.models as models
8
7
  from database.models import *
9
8
  import api.system.opt_locking.opt_locking as opt_locking
@@ -3,7 +3,6 @@ from decimal import Decimal
3
3
  from logic_bank.exec_row_logic.logic_row import LogicRow
4
4
  from logic_bank.extensions.rule_extensions import RuleExtension
5
5
  from logic_bank.logic_bank import Rule
6
- from logic_bank.logic_bank import DeclareRule
7
6
  import database.models as models
8
7
  from database.models import *
9
8
  import api.system.opt_locking.opt_locking as opt_locking
@@ -3,7 +3,6 @@ from decimal import Decimal
3
3
  from logic_bank.exec_row_logic.logic_row import LogicRow
4
4
  from logic_bank.extensions.rule_extensions import RuleExtension
5
5
  from logic_bank.logic_bank import Rule
6
- from logic_bank.logic_bank import DeclareRule
7
6
  import database.models as models
8
7
  from database.models import *
9
8
  import api.system.opt_locking.opt_locking as opt_locking
@@ -3,7 +3,6 @@ from decimal import Decimal
3
3
  from logic_bank.exec_row_logic.logic_row import LogicRow
4
4
  from logic_bank.extensions.rule_extensions import RuleExtension
5
5
  from logic_bank.logic_bank import Rule
6
- from logic_bank.logic_bank import DeclareRule
7
6
  import database.models as models
8
7
  from database.models import *
9
8
  import api.system.opt_locking.opt_locking as opt_locking
@@ -0,0 +1,194 @@
1
+ Use SQLAlchemy to create a sqlite database named system/genai/temp/create_db_models.sqlite for the following requirements. These requirements are very important!
2
+ Requirements:
3
+ <Requirements>
4
+ Generate a project time tracking and invoice application
5
+
6
+ Use these names for tables and attributes:
7
+ * Client (id, name, email, phone, total_hours, total_amount, budget_amount, is_over_budget)
8
+ * Project ( id, client_id, name, total_project_hours, total_project_amount, project_budget_amount, is_over_budget, is_active)
9
+ * Invoice: (id, invoice_date, project_id, invoice_amount, payment_total, invoice_balance, is_paid, is_ready,task_count,completed_task_count)
10
+ * InvoiceItem(id, invoice_id, task_id, task_amount, is_completed)
11
+ * Task (id, project_id, name, description, total_task_hours_worked, total_task_amount_billed, task_budget_hours, is_over_budget,is_completed)
12
+ * Person (id, client_id, name, email, phone, billing_rate, total_hours_entered, total_amount_billed)
13
+ * Timesheet (id,task_id, person_id, date_worked, hours_worked, billing_rate, total_amount_billed, is_billable)
14
+ * Payment (id, invoice_id, amount, payment_date, notes)
15
+
16
+ Use decimal(10,2) for: hours_worked, total_hours, hours_entered, total_amount, billing_rate, total_task_amount_billed, project_budget_amount, total_project_amount, total_project_hours
17
+ Default hours_worked, total_hours, hours_entered, total_amount, billing_rate, total_task_amount_billed, project_budget_amount, total_project_amount, total_project_hours to zero
18
+ Create relationships between all tables
19
+
20
+ Use LogicBank to enforce business logic.
21
+
22
+ Use case: Person
23
+ Total Hours entered is sum of timesheet hours worked
24
+ Total amount billed is total hours entered times billing rate
25
+ Billing rate must be greater than 0 and less than 200
26
+
27
+ Use case: Timesheet
28
+ Copy billing rate from Person billing rate
29
+ The total amount billed is the billing rate times hours worked
30
+ Hours worked must be greater than 0 and less than 15
31
+
32
+
33
+ Use Case: Task
34
+ Total task hours worked is the sum of the Timesheet hours worked
35
+ Total task amount billed is the sum of the Timesheet total amount billed
36
+ Formula: is Over Budget when total task hours worked exceeds task budget hours
37
+
38
+ Use Case: Project
39
+ Total project hours is the sum of Task total task hours worked
40
+ Total project amount is the sum of Task total amount billed
41
+ Formula: is Over Budget when total project amount exceeds project budget amount
42
+
43
+ Use Case: Client
44
+ Total hours is the sum of Project total project hours
45
+ Total amount is the sum of Project total project amount
46
+ Formula: is Over Budget equals true when total amount exceeds budget amount
47
+
48
+ Use Case: Invoice
49
+ Invoice Amount is the sum of InvoiceItem task amount
50
+ Payment total is the sum of Payment amount
51
+ Invoice balance is invoice amount less payment total
52
+ Formula: is_paid when invoice balance is than or equal to zero
53
+ Task Count is count of InvoiceItem
54
+ Task completed count is count of InvoiceItem where is_completed is True
55
+ Formula: is ready when Task Count is equal to Task Completed Count
56
+
57
+
58
+ Use Case: InvoiceItem
59
+ InvoiceItem task amount is copied from Task total task amount billed
60
+ InvoiceItem is_completed is sum of Task is_completed when True
61
+
62
+
63
+
64
+ .
65
+ Create at least 8 tables (models)
66
+ .
67
+ </Requirements>
68
+
69
+ Hints: use autonum keys (for all tables - including for link/join/junction/intersection tables), allow nulls, foreign keys, no check constraints.
70
+
71
+ Be sure to create classes, never tables.
72
+ Class names are singular, and first letter is capitalized.
73
+
74
+ If you create sum, count or formula Logic Bank rules, then you MUST create a corresponding column in the data model.
75
+
76
+ Remember that SQLite DateTime type only accepts Python datetime and date objects as input,
77
+ this means you can not enter string attributes where a date or datetime object is expected.
78
+
79
+ Don't install additional packages.
80
+ Don't use the faker pip package.
81
+
82
+ When creating SQLAlchemy data model classes, follow these guidelines carefully:
83
+ * Use foreign key columns instead of relationship names for the data.
84
+ * Do not specify nullable unless explicitly specified.
85
+ * Do not use unique unless explicitly specified.
86
+ * Do not use Float unless explicitly specified.
87
+ * Generate the classes ONLY.
88
+ * Do NOT generate imports.
89
+ * Do NOT generate connect statements.
90
+ * Do NOT generate engines.
91
+
92
+ Create 4 rows of test data for each table, and follow these guidelines carefully:
93
+ * Create separate objects for each test data row, not in arrays.
94
+ * Be sure to initialize derived attributes for test data rows - including all sums and counts, but do not rely on Logic Bank,
95
+ and do not generate db.execute statements.
96
+ * Do not create arrays of test data.
97
+ * Do not create a function to load test data.
98
+ * Do not print the test data.
99
+ * Use double quotes " for strings.
100
+ * For test data, format dates as date(year, month, day).
101
+
102
+ <responseFormat>
103
+ class Rule(BaseModel):
104
+ name: str
105
+ description: str
106
+ use_case: str # specified use case or requirement name (use 'General' if missing)
107
+ entity: str # the entity being constrained or derived
108
+ code: str # logicbank rule code
109
+
110
+ class Model(BaseModel):
111
+ classname: str
112
+ code: str # sqlalchemy model code
113
+ sqlite_create: str # sqlite create table statement
114
+ description: str
115
+ name: str
116
+
117
+ class TestDataRow(BaseModel):
118
+ test_data_row_variable: str # the Python test data row variable
119
+ code: str # Python code to create a test data row instance
120
+
121
+ class WGResult(BaseModel): # must match system/genai/prompt_inserts/response_format.prompt
122
+ # response: str # result
123
+ models : List[Model] # list of sqlalchemy classes in the response
124
+ rules : List[Rule] # list rule declarations
125
+ test_data: str
126
+ test_data_rows: List[TestDataRow] # list of test data rows
127
+ test_data_sqlite: str # test data as sqlite INSERT statements
128
+ name: str # suggest a short name for the project
129
+
130
+ Format the response as a WGResult.
131
+
132
+ </responseFormat>
133
+
134
+ <responseFormat>
135
+
136
+ class Rule(BaseModel):
137
+
138
+ name: str
139
+
140
+ description: str
141
+
142
+ use_case: str # specified use case or requirement name (use 'General' if missing)
143
+
144
+ entity: str # the entity being constrained or derived
145
+
146
+ code: str # logicbank rule code
147
+
148
+
149
+
150
+ class Model(BaseModel):
151
+
152
+ classname: str
153
+
154
+ code: str # sqlalchemy model code
155
+
156
+ sqlite_create: str # sqlite create table statement
157
+
158
+ description: str
159
+
160
+ name: str
161
+
162
+
163
+
164
+ class TestDataRow(BaseModel):
165
+
166
+ test_data_row_variable: str # the Python test data row variable
167
+
168
+ code: str # Python code to create a test data row instance
169
+
170
+
171
+
172
+ class WGResult(BaseModel): # must match system/genai/prompt_inserts/response_format.prompt
173
+
174
+ # response: str # result
175
+
176
+ models : List[Model] # list of sqlalchemy classes in the response
177
+
178
+ rules : List[Rule] # list rule declarations
179
+
180
+ test_data: str
181
+
182
+ test_data_rows: List[TestDataRow] # list of test data rows
183
+
184
+ test_data_sqlite: str # test data as sqlite INSERT statements
185
+
186
+ name: str # suggest a short name for the project
187
+
188
+
189
+
190
+ Format the response as a WGResult.
191
+
192
+
193
+
194
+ </responseFormat>
@@ -0,0 +1,298 @@
1
+ {
2
+ "models": [
3
+ {
4
+ "classname": "Client",
5
+ "code": "class Client(Base):\n __tablename__ = 'client'\n\n id = Column(Integer, primary_key=True)\n name = Column(String, nullable=False)\n email = Column(String, nullable=False)\n phone = Column(String, nullable=False)\n total_hours = Column(DECIMAL(10, 2), default=0)\n total_amount = Column(DECIMAL(10, 2), default=0)\n budget_amount = Column(DECIMAL(10, 2), default=0)\n is_over_budget = Column(Boolean, default=False)",
6
+ "description": "Model representing clients for billing.",
7
+ "name": "Client"
8
+ },
9
+ {
10
+ "classname": "Project",
11
+ "code": "class Project(Base):\n __tablename__ = 'project'\n\n id = Column(Integer, primary_key=True)\n client_id = Column(Integer, ForeignKey('client.id'))\n name = Column(String, nullable=False)\n total_project_hours = Column(DECIMAL(10, 2), default=0)\n total_project_amount = Column(DECIMAL(10, 2), default=0)\n project_budget_amount = Column(DECIMAL(10, 2), default=0)\n is_over_budget = Column(Boolean, default=False)",
12
+ "description": "Model representing projects under a client.",
13
+ "name": "Project"
14
+ },
15
+ {
16
+ "classname": "Invoice",
17
+ "code": "class Invoice(Base):\n __tablename__ = 'invoice'\n\n id = Column(Integer, primary_key=True)\n invoice_date = Column(DateTime, nullable=False)\n project_id = Column(Integer, ForeignKey('project.id'))\n invoice_amount = Column(DECIMAL(10, 2), default=0)\n payment_total = Column(DECIMAL(10, 2), default=0)\n invoice_balance = Column(DECIMAL(10, 2), default=0)\n is_paid = Column(Boolean, default=False)",
18
+ "description": "Model representing invoices for projects.",
19
+ "name": "Invoice"
20
+ },
21
+ {
22
+ "classname": "Task",
23
+ "code": "class Task(Base):\n __tablename__ = 'task'\n\n id = Column(Integer, primary_key=True)\n project_id = Column(Integer, ForeignKey('project.id'))\n name = Column(String, nullable=False)\n description = Column(String, nullable=True)\n total_task_hours_worked = Column(DECIMAL(10, 2), default=0)\n total_task_amount_billed = Column(DECIMAL(10, 2), default=0)\n task_budget_hours = Column(DECIMAL(10, 2), default=0)\n is_over_budget = Column(Boolean, default=False)\n invoice_id = Column(Integer, ForeignKey('invoice.id'))",
24
+ "description": "Model representing tasks under a project.",
25
+ "name": "Task"
26
+ },
27
+ {
28
+ "classname": "Person",
29
+ "code": "class Person(Base):\n __tablename__ = 'person'\n\n id = Column(Integer, primary_key=True)\n client_id = Column(Integer, ForeignKey('client.id'))\n name = Column(String, nullable=False)\n email = Column(String, nullable=False)\n phone = Column(String, nullable=False)\n billing_rate = Column(DECIMAL(10, 2), default=0)\n total_hours_entered = Column(DECIMAL(10, 2), default=0)\n total_amount_billed = Column(DECIMAL(10, 2), default=0)",
30
+ "description": "Model representing personnel working with clients.",
31
+ "name": "Person"
32
+ },
33
+ {
34
+ "classname": "Timesheet",
35
+ "code": "class Timesheet(Base):\n __tablename__ = 'timesheet'\n\n id = Column(Integer, primary_key=True)\n task_id = Column(Integer, ForeignKey('task.id'))\n person_id = Column(Integer, ForeignKey('person.id'))\n date_worked = Column(DateTime, nullable=False)\n hours_worked = Column(DECIMAL(10, 2), default=0)\n month = Column(Integer)\n year = Column(Integer)\n billing_rate = Column(DECIMAL(10, 2), default=0)\n total_amount_billed = Column(DECIMAL(10, 2), default=0)",
36
+ "description": "Model representing timesheets for tasks.",
37
+ "name": "Timesheet"
38
+ },
39
+ {
40
+ "classname": "Payment",
41
+ "code": "class Payment(Base):\n __tablename__ = 'payment'\n\n id = Column(Integer, primary_key=True)\n invoice_id = Column(Integer, ForeignKey('invoice.id'))\n payment_amount = Column(DECIMAL(10, 2), default=0)\n payment_date = Column(Date, nullable=False)\n notes = Column(String, nullable=True)",
42
+ "description": "Model representing payments made against invoices.",
43
+ "name": "Payment"
44
+ }
45
+ ],
46
+ "rules": [
47
+ {
48
+ "name": "Sum Client Total Hours",
49
+ "description": "Total Hours is the sum of Project total project hours",
50
+ "use_case": "Client",
51
+ "entity": "Client",
52
+ "code": "Rule.sum(derive=Client.total_hours, as_sum_of=Project.total_project_hours)"
53
+ },
54
+ {
55
+ "name": "Sum Client Total Amount",
56
+ "description": "Total Amount is the sum of Project total amount",
57
+ "use_case": "Client",
58
+ "entity": "Client",
59
+ "code": "Rule.sum(derive=Client.total_amount, as_sum_of=Project.total_project_amount)"
60
+ },
61
+ {
62
+ "name": "Formula: Client Is Over Budget",
63
+ "description": "Is Over Budget is true when total amount exceeds budget amount",
64
+ "use_case": "Client",
65
+ "entity": "Client",
66
+ "code": "Rule.formula(derive=Client.is_over_budget, as_expression=lambda row: row.total_amount > row.budget_amount)"
67
+ },
68
+ {
69
+ "name": "Sum Project Total Project Hours",
70
+ "description": "Total project hours is the sum of Task total task hours worked",
71
+ "use_case": "Project",
72
+ "entity": "Project",
73
+ "code": "Rule.sum(derive=Project.total_project_hours, as_sum_of=Task.total_task_hours_worked)"
74
+ },
75
+ {
76
+ "name": "Sum Project Total Project Amount",
77
+ "description": "Total project amount is the sum of Task total amount billed",
78
+ "use_case": "Project",
79
+ "entity": "Project",
80
+ "code": "Rule.sum(derive=Project.total_project_amount, as_sum_of=Task.total_task_amount_billed)"
81
+ },
82
+ {
83
+ "name": "Formula: Project Is Over Budget",
84
+ "description": "Is Over Budget when total project amount exceeds project budget amount",
85
+ "use_case": "Project",
86
+ "entity": "Project",
87
+ "code": "Rule.formula(derive=Project.is_over_budget, as_expression=lambda row: row.total_project_amount > row.project_budget_amount)"
88
+ },
89
+ {
90
+ "name": "Sum Task Total Task Hours Worked",
91
+ "description": "Total task hours worked is the sum of the Timesheet hours worked",
92
+ "use_case": "Task",
93
+ "entity": "Task",
94
+ "code": "Rule.sum(derive=Task.total_task_hours_worked, as_sum_of=Timesheet.hours_worked)"
95
+ },
96
+ {
97
+ "name": "Sum Task Total Task Amount Billed",
98
+ "description": "Total task amount billed is the sum of the Timesheet total amount billed",
99
+ "use_case": "Task",
100
+ "entity": "Task",
101
+ "code": "Rule.sum(derive=Task.total_task_amount_billed, as_sum_of=Timesheet.total_amount_billed)"
102
+ },
103
+ {
104
+ "name": "Formula: Task Is Over Budget",
105
+ "description": "Formula: is Over Budget when total task hours worked exceeds task budget hours",
106
+ "use_case": "Task",
107
+ "entity": "Task",
108
+ "code": "Rule.formula(derive=Task.is_over_budget, as_expression=lambda row: row.total_task_hours_worked > row.task_budget_hours)"
109
+ },
110
+ {
111
+ "name": "Copy Timesheet Billing Rate",
112
+ "description": "Copy billing rate from Person billing rate",
113
+ "use_case": "Timesheet",
114
+ "entity": "Timesheet",
115
+ "code": "Rule.copy(derive=Timesheet.billing_rate, from_parent=Person.billing_rate)"
116
+ },
117
+ {
118
+ "name": "Formula Timesheet Total Amount Billed",
119
+ "description": "The total amount billed is the Person billing rate times hours worked",
120
+ "use_case": "Timesheet",
121
+ "entity": "Timesheet",
122
+ "code": "Rule.formula(derive=Timesheet.total_amount_billed, as_expression=lambda row: row.billing_rate * row.hours_worked)"
123
+ },
124
+ {
125
+ "name": "Timesheet Hours Constraint",
126
+ "description": "Hours worked must be greater than 0 and less than 15",
127
+ "use_case": "Timesheet",
128
+ "entity": "Timesheet",
129
+ "code": "Rule.constraint(validate=Timesheet, as_condition=lambda row: 0 < row.hours_worked < 15, error_msg='Hours worked must be > 0 and < 15')"
130
+ },
131
+ {
132
+ "name": "Sum Person Total Hours Entered",
133
+ "description": "Total Hours entered is sum of timesheet hours worked",
134
+ "use_case": "Person",
135
+ "entity": "Person",
136
+ "code": "Rule.sum(derive=Person.total_hours_entered, as_sum_of=Timesheet.hours_worked)"
137
+ },
138
+ {
139
+ "name": "Formula Person Total Amount Billed",
140
+ "description": "Total amount billed is total hours entered times billing rate",
141
+ "use_case": "Person",
142
+ "entity": "Person",
143
+ "code": "Rule.formula(derive=Person.total_amount_billed, as_expression=lambda row: row.total_hours_entered * row.billing_rate)"
144
+ },
145
+ {
146
+ "name": "Person Billing Rate Constraint",
147
+ "description": "Billing rate must be greater than 0 and less than 200",
148
+ "use_case": "Person",
149
+ "entity": "Person",
150
+ "code": "Rule.constraint(validate=Person, as_condition=lambda row: 0 < row.billing_rate < 200, error_msg='Billing rate must be > 0 and < 200')"
151
+ },
152
+ {
153
+ "name": "Sum Invoice Invoice Amount",
154
+ "description": "Invoice Amount is the sum of Task total amount billed",
155
+ "use_case": "Invoice",
156
+ "entity": "Invoice",
157
+ "code": "Rule.sum(derive=Invoice.invoice_amount, as_sum_of=Task.total_task_amount_billed)"
158
+ },
159
+ {
160
+ "name": "Sum Invoice Payment Total",
161
+ "description": "Payment total is the sum of Payment",
162
+ "use_case": "Invoice",
163
+ "entity": "Invoice",
164
+ "code": "Rule.sum(derive=Invoice.payment_total, as_sum_of=Payment.payment_amount)"
165
+ },
166
+ {
167
+ "name": "Formula Invoice Balance",
168
+ "description": "Invoice balance is invoice amount less payment total",
169
+ "use_case": "Invoice",
170
+ "entity": "Invoice",
171
+ "code": "Rule.formula(derive=Invoice.invoice_balance, as_expression=lambda row: row.invoice_amount - row.payment_total)"
172
+ },
173
+ {
174
+ "name": "Formula Invoice Is Paid",
175
+ "description": "Invoice is paid when invoice balance is zero",
176
+ "use_case": "Invoice",
177
+ "entity": "Invoice",
178
+ "code": "Rule.formula(derive=Invoice.is_paid, as_expression=lambda row: row.invoice_balance == 0)"
179
+ }
180
+ ],
181
+ "test_data": "# Test data for Client\nclient1 = Client(id=1, name=\"Acme Corp\", email=\"acme@acme.com\", phone=\"123-456-7890\", total_hours=20, total_amount=5000, budget_amount=10000)\nclient2 = Client(id=2, name=\"Beta LLC\", email=\"beta@beta.com\", phone=\"987-654-3210\", total_hours=15, total_amount=3000, budget_amount=5000)\nclient3 = Client(id=3, name=\"Gamma Industries\", email=\"gamma@gamma.com\", phone=\"456-123-6789\", total_hours=30, total_amount=12000, budget_amount=15000)\nclient4 = Client(id=4, name=\"Delta Services\", email=\"delta@delta.com\", phone=\"789-321-6540\", total_hours=45, total_amount=9000, budget_amount=20000)\n\n# Test data for Project\nproject1 = Project(id=1, client_id=1, name=\"Project X\", total_project_hours=50, total_project_amount=8000, project_budget_amount=10000)\nproject2 = Project(id=2, client_id=1, name=\"Project Y\", total_project_hours=25, total_project_amount=4000, project_budget_amount=7000)\nproject3 = Project(id=3, client_id=2, name=\"Project Z\", total_project_hours=30, total_project_amount=3000, project_budget_amount=4000)\nproject4 = Project(id=4, client_id=3, name=\"Project Alpha\", total_project_hours=60, total_project_amount=15000, project_budget_amount=20000)\n\n# Test data for Invoice\ninvoice1 = Invoice(id=1, project_id=1, invoice_date=date(2023, 2, 15), invoice_amount=5000, payment_total=3000, invoice_balance=2000)\ninvoice2 = Invoice(id=2, project_id=2, invoice_date=date(2023, 3, 20), invoice_amount=1000, payment_total=1000, invoice_balance=0)\ninvoice3 = Invoice(id=3, project_id=3, invoice_date=date(2023, 4, 11), invoice_amount=2000, payment_total=1500, invoice_balance=500)\ninvoice4 = Invoice(id=4, project_id=4, invoice_date=date(2023, 5, 9), invoice_amount=7000, payment_total=5000, invoice_balance=2000)\n\n# Test data for Task\ntask1 = Task(id=1, project_id=1, name=\"Design Phase\", description=\"Initial design work\", total_task_hours_worked=15, total_task_amount_billed=1500, task_budget_hours=20)\ntask2 = Task(id=2, project_id=2, name=\"Development Phase\", description=\"Coding and implementation\", total_task_hours_worked=30, total_task_amount_billed=3000, task_budget_hours=40)\ntask3 = Task(id=3, project_id=3, name=\"Testing Phase\", description=\"QA and testing\", total_task_hours_worked=10, total_task_amount_billed=1000, task_budget_hours=15)\ntask4 = Task(id=4, project_id=4, name=\"Deployment Phase\", description=\"Deployment and support\", total_task_hours_worked=20, total_task_amount_billed=2000, task_budget_hours=25)\n\n# Test data for Person\nperson1 = Person(id=1, client_id=1, name=\"Alice Smith\", email=\"alice@example.com\", phone=\"111-222-3333\", billing_rate=50, total_hours_entered=10, total_amount_billed=500)\nperson2 = Person(id=2, client_id=2, name=\"Bob Brown\", email=\"bob@example.com\", phone=\"444-555-6666\", billing_rate=75, total_hours_entered=8, total_amount_billed=600)\nperson3 = Person(id=3, client_id=3, name=\"Charlie Johnson\", email=\"charlie@example.com\", phone=\"777-888-9999\", billing_rate=60, total_hours_entered=12, total_amount_billed=720)\nperson4 = Person(id=4, client_id=4, name=\"Dana White\", email=\"dana@example.com\", phone=\"123-987-6543\", billing_rate=85, total_hours_entered=15, total_amount_billed=1275)\n\n# Test data for Timesheet\ntimesheet1 = Timesheet(id=1, task_id=1, person_id=1, date_worked=date(2023, 1, 10), hours_worked=5, month=1, year=2023, billing_rate=50, total_amount_billed=250)\ntimesheet2 = Timesheet(id=2, task_id=1, person_id=2, date_worked=date(2023, 1, 12), hours_worked=4, month=1, year=2023, billing_rate=75, total_amount_billed=300)\ntimesheet3 = Timesheet(id=3, task_id=2, person_id=3, date_worked=date(2023, 2, 15), hours_worked=8, month=2, year=2023, billing_rate=60, total_amount_billed=480)\ntimesheet4 = Timesheet(id=4, task_id=3, person_id=4, date_worked=date(2023, 3, 20), hours_worked=7, month=3, year=2023, billing_rate=85, total_amount_billed=595)\n\n# Test data for Payment\npayment1 = Payment(id=1, invoice_id=1, payment_amount=1000, payment_date=date(2023, 4, 1), notes=\"First payment\")\npayment2 = Payment(id=2, invoice_id=2, payment_amount=1000, payment_date=date(2023, 4, 5), notes=\"Full settlement\")\npayment3 = Payment(id=3, invoice_id=3, payment_amount=500, payment_date=date(2023, 4, 10), notes=\"Partial payment\")\npayment4 = Payment(id=4, invoice_id=4, payment_amount=2000, payment_date=date(2023, 4, 15), notes=\"Advance payment\")",
182
+ "test_data_rows": [
183
+ {
184
+ "test_data_row_variable": "client1",
185
+ "code": "client1 = Client(id=1, name=\"Acme Corp\", email=\"acme@acme.com\", phone=\"123-456-7890\", total_hours=20, total_amount=5000, budget_amount=10000)"
186
+ },
187
+ {
188
+ "test_data_row_variable": "client2",
189
+ "code": "client2 = Client(id=2, name=\"Beta LLC\", email=\"beta@beta.com\", phone=\"987-654-3210\", total_hours=15, total_amount=3000, budget_amount=5000)"
190
+ },
191
+ {
192
+ "test_data_row_variable": "client3",
193
+ "code": "client3 = Client(id=3, name=\"Gamma Industries\", email=\"gamma@gamma.com\", phone=\"456-123-6789\", total_hours=30, total_amount=12000, budget_amount=15000)"
194
+ },
195
+ {
196
+ "test_data_row_variable": "client4",
197
+ "code": "client4 = Client(id=4, name=\"Delta Services\", email=\"delta@delta.com\", phone=\"789-321-6540\", total_hours=45, total_amount=9000, budget_amount=20000)"
198
+ },
199
+ {
200
+ "test_data_row_variable": "project1",
201
+ "code": "project1 = Project(id=1, client_id=1, name=\"Project X\", total_project_hours=50, total_project_amount=8000, project_budget_amount=10000)"
202
+ },
203
+ {
204
+ "test_data_row_variable": "project2",
205
+ "code": "project2 = Project(id=2, client_id=1, name=\"Project Y\", total_project_hours=25, total_project_amount=4000, project_budget_amount=7000)"
206
+ },
207
+ {
208
+ "test_data_row_variable": "project3",
209
+ "code": "project3 = Project(id=3, client_id=2, name=\"Project Z\", total_project_hours=30, total_project_amount=3000, project_budget_amount=4000)"
210
+ },
211
+ {
212
+ "test_data_row_variable": "project4",
213
+ "code": "project4 = Project(id=4, client_id=3, name=\"Project Alpha\", total_project_hours=60, total_project_amount=15000, project_budget_amount=20000)"
214
+ },
215
+ {
216
+ "test_data_row_variable": "invoice1",
217
+ "code": "invoice1 = Invoice(id=1, project_id=1, invoice_date=date(2023, 2, 15), invoice_amount=5000, payment_total=3000, invoice_balance=2000)"
218
+ },
219
+ {
220
+ "test_data_row_variable": "invoice2",
221
+ "code": "invoice2 = Invoice(id=2, project_id=2, invoice_date=date(2023, 3, 20), invoice_amount=1000, payment_total=1000, invoice_balance=0)"
222
+ },
223
+ {
224
+ "test_data_row_variable": "invoice3",
225
+ "code": "invoice3 = Invoice(id=3, project_id=3, invoice_date=date(2023, 4, 11), invoice_amount=2000, payment_total=1500, invoice_balance=500)"
226
+ },
227
+ {
228
+ "test_data_row_variable": "invoice4",
229
+ "code": "invoice4 = Invoice(id=4, project_id=4, invoice_date=date(2023, 5, 9), invoice_amount=7000, payment_total=5000, invoice_balance=2000)"
230
+ },
231
+ {
232
+ "test_data_row_variable": "task1",
233
+ "code": "task1 = Task(id=1, project_id=1, name=\"Design Phase\", description=\"Initial design work\", total_task_hours_worked=15, total_task_amount_billed=1500, task_budget_hours=20)"
234
+ },
235
+ {
236
+ "test_data_row_variable": "task2",
237
+ "code": "task2 = Task(id=2, project_id=2, name=\"Development Phase\", description=\"Coding and implementation\", total_task_hours_worked=30, total_task_amount_billed=3000, task_budget_hours=40)"
238
+ },
239
+ {
240
+ "test_data_row_variable": "task3",
241
+ "code": "task3 = Task(id=3, project_id=3, name=\"Testing Phase\", description=\"QA and testing\", total_task_hours_worked=10, total_task_amount_billed=1000, task_budget_hours=15)"
242
+ },
243
+ {
244
+ "test_data_row_variable": "task4",
245
+ "code": "task4 = Task(id=4, project_id=4, name=\"Deployment Phase\", description=\"Deployment and support\", total_task_hours_worked=20, total_task_amount_billed=2000, task_budget_hours=25)"
246
+ },
247
+ {
248
+ "test_data_row_variable": "person1",
249
+ "code": "person1 = Person(id=1, client_id=1, name=\"Alice Smith\", email=\"alice@example.com\", phone=\"111-222-3333\", billing_rate=50, total_hours_entered=10, total_amount_billed=500)"
250
+ },
251
+ {
252
+ "test_data_row_variable": "person2",
253
+ "code": "person2 = Person(id=2, client_id=2, name=\"Bob Brown\", email=\"bob@example.com\", phone=\"444-555-6666\", billing_rate=75, total_hours_entered=8, total_amount_billed=600)"
254
+ },
255
+ {
256
+ "test_data_row_variable": "person3",
257
+ "code": "person3 = Person(id=3, client_id=3, name=\"Charlie Johnson\", email=\"charlie@example.com\", phone=\"777-888-9999\", billing_rate=60, total_hours_entered=12, total_amount_billed=720)"
258
+ },
259
+ {
260
+ "test_data_row_variable": "person4",
261
+ "code": "person4 = Person(id=4, client_id=4, name=\"Dana White\", email=\"dana@example.com\", phone=\"123-987-6543\", billing_rate=85, total_hours_entered=15, total_amount_billed=1275)"
262
+ },
263
+ {
264
+ "test_data_row_variable": "timesheet1",
265
+ "code": "timesheet1 = Timesheet(id=1, task_id=1, person_id=1, date_worked=date(2023, 1, 10), hours_worked=5, month=1, year=2023, billing_rate=50, total_amount_billed=250)"
266
+ },
267
+ {
268
+ "test_data_row_variable": "timesheet2",
269
+ "code": "timesheet2 = Timesheet(id=2, task_id=1, person_id=2, date_worked=date(2023, 1, 12), hours_worked=4, month=1, year=2023, billing_rate=75, total_amount_billed=300)"
270
+ },
271
+ {
272
+ "test_data_row_variable": "timesheet3",
273
+ "code": "timesheet3 = Timesheet(id=3, task_id=2, person_id=3, date_worked=date(2023, 2, 15), hours_worked=8, month=2, year=2023, billing_rate=60, total_amount_billed=480)"
274
+ },
275
+ {
276
+ "test_data_row_variable": "timesheet4",
277
+ "code": "timesheet4 = Timesheet(id=4, task_id=3, person_id=4, date_worked=date(2023, 3, 20), hours_worked=7, month=3, year=2023, billing_rate=85, total_amount_billed=595)"
278
+ },
279
+ {
280
+ "test_data_row_variable": "payment1",
281
+ "code": "payment1 = Payment(id=1, invoice_id=1, payment_amount=1000, payment_date=date(2023, 4, 1), notes=\"First payment\")"
282
+ },
283
+ {
284
+ "test_data_row_variable": "payment2",
285
+ "code": "payment2 = Payment(id=2, invoice_id=2, payment_amount=1000, payment_date=date(2023, 4, 5), notes=\"Full settlement\")"
286
+ },
287
+ {
288
+ "test_data_row_variable": "payment3",
289
+ "code": "payment3 = Payment(id=3, invoice_id=3, payment_amount=500, payment_date=date(2023, 4, 10), notes=\"Partial payment\")"
290
+ },
291
+ {
292
+ "test_data_row_variable": "payment4",
293
+ "code": "payment4 = Payment(id=4, invoice_id=4, payment_amount=2000, payment_date=date(2023, 4, 15), notes=\"Advance payment\")"
294
+ }
295
+ ],
296
+ "test_data_sqlite": "CREATE TABLE client (\n id INTEGER PRIMARY KEY,\n name TEXT NOT NULL,\n email TEXT NOT NULL,\n phone TEXT NOT NULL,\n total_hours DECIMAL(10,2) DEFAULT 0,\n total_amount DECIMAL(10,2) DEFAULT 0,\n budget_amount DECIMAL(10,2) DEFAULT 0,\n is_over_budget BOOLEAN DEFAULT FALSE\n);\n\nINSERT INTO client (id, name, email, phone, total_hours, total_amount, budget_amount, is_over_budget)\nVALUES (1, 'Acme Corp', 'acme@acme.com', '123-456-7890', 20, 5000, 10000, 0),\n (2, 'Beta LLC', 'beta@beta.com', '987-654-3210', 15, 3000, 5000, 0),\n (3, 'Gamma Industries', 'gamma@gamma.com', '456-123-6789', 30, 12000, 15000, 0),\n (4, 'Delta Services', 'delta@delta.com', '789-321-6540', 45, 9000, 20000, 0);\n\nCREATE TABLE project (\n id INTEGER PRIMARY KEY,\n client_id INTEGER,\n name TEXT NOT NULL,\n total_project_hours DECIMAL(10,2) DEFAULT 0,\n total_project_amount DECIMAL(10,2) DEFAULT 0,\n project_budget_amount DECIMAL(10,2) DEFAULT 0,\n is_over_budget BOOLEAN DEFAULT FALSE,\n FOREIGN KEY(client_id) REFERENCES client(id)\n);\n\nINSERT INTO project (id, client_id, name, total_project_hours, total_project_amount, project_budget_amount, is_over_budget)\nVALUES (1, 1, 'Project X', 50, 8000, 10000, 0),\n (2, 1, 'Project Y', 25, 4000, 7000, 0),\n (3, 2, 'Project Z', 30, 3000, 4000, 0),\n (4, 3, 'Project Alpha', 60, 15000, 20000, 0);\n\nCREATE TABLE invoice (\n id INTEGER PRIMARY KEY,\n project_id INTEGER,\n invoice_date DATE NOT NULL,\n invoice_amount DECIMAL(10,2) DEFAULT 0,\n payment_total DECIMAL(10,2) DEFAULT 0,\n invoice_balance DECIMAL(10,2) DEFAULT 0,\n is_paid BOOLEAN DEFAULT FALSE,\n FOREIGN KEY(project_id) REFERENCES project(id)\n);\n\nINSERT INTO invoice (id, project_id, invoice_date, invoice_amount, payment_total, invoice_balance, is_paid)\nVALUES (1, 1, '2023-02-15', 5000, 3000, 2000, 0),\n (2, 2, '2023-03-20', 1000, 1000, 0, 1),\n (3, 3, '2023-04-11', 2000, 1500, 500, 0),\n (4, 4, '2023-05-09', 7000, 5000, 2000, 0);\n\nCREATE TABLE task (\n id INTEGER PRIMARY KEY,\n project_id INTEGER,\n name TEXT NOT NULL,\n description TEXT,\n total_task_hours_worked DECIMAL(10,2) DEFAULT 0,\n total_task_amount_billed DECIMAL(10,2) DEFAULT 0,\n task_budget_hours DECIMAL(10,2) DEFAULT 0,\n is_over_budget BOOLEAN DEFAULT FALSE,\n invoice_id INTEGER,\n FOREIGN KEY(project_id) REFERENCES project(id),\n FOREIGN KEY(invoice_id) REFERENCES invoice(id)\n);\n\nINSERT INTO task (id, project_id, name, description, total_task_hours_worked, total_task_amount_billed, task_budget_hours, is_over_budget, invoice_id)\nVALUES (1, 1, 'Design Phase', 'Initial design work', 15, 1500, 20, 0, NULL),\n (2, 2, 'Development Phase', 'Coding and implementation', 30, 3000, 40, 0, NULL),\n (3, 3, 'Testing Phase', 'QA and testing', 10, 1000, 15, 0, NULL),\n (4, 4, 'Deployment Phase', 'Deployment and support', 20, 2000, 25, 0, NULL);\n\nCREATE TABLE person (\n id INTEGER PRIMARY KEY,\n client_id INTEGER,\n name TEXT NOT NULL,\n email TEXT NOT NULL,\n phone TEXT NOT NULL,\n billing_rate DECIMAL(10,2) DEFAULT 0,\n total_hours_entered DECIMAL(10,2) DEFAULT 0,\n total_amount_billed DECIMAL(10,2) DEFAULT 0,\n FOREIGN KEY(client_id) REFERENCES client(id)\n);\n\nINSERT INTO person (id, client_id, name, email, phone, billing_rate, total_hours_entered, total_amount_billed)\nVALUES (1, 1, 'Alice Smith', 'alice@example.com', '111-222-3333', 50, 10, 500),\n (2, 2, 'Bob Brown', 'bob@example.com', '444-555-6666', 75, 8, 600),\n (3, 3, 'Charlie Johnson', 'charlie@example.com', '777-888-9999', 60, 12, 720),\n (4, 4, 'Dana White', 'dana@example.com', '123-987-6543', 85, 15, 1275);\n\nCREATE TABLE timesheet (\n id INTEGER PRIMARY KEY,\n task_id INTEGER,\n person_id INTEGER,\n date_worked DATE NOT NULL,\n hours_worked DECIMAL(10,2) DEFAULT 0,\n month INTEGER,\n year INTEGER,\n billing_rate DECIMAL(10,2) DEFAULT 0,\n total_amount_billed DECIMAL(10,2) DEFAULT 0,\n FOREIGN KEY(task_id) REFERENCES task(id),\n FOREIGN KEY(person_id) REFERENCES person(id)\n);\n\nINSERT INTO timesheet (id, task_id, person_id, date_worked, hours_worked, month, year, billing_rate, total_amount_billed)\nVALUES (1, 1, 1, '2023-01-10', 5, 1, 2023, 50, 250),\n (2, 1, 2, '2023-01-12', 4, 1, 2023, 75, 300),\n (3, 2, 3, '2023-02-15', 8, 2, 2023, 60, 480),\n (4, 3, 4, '2023-03-20', 7, 3, 2023, 85, 595);\n\nCREATE TABLE payment (\n id INTEGER PRIMARY KEY,\n invoice_id INTEGER,\n payment_amount DECIMAL(10,2) DEFAULT 0,\n payment_date DATE NOT NULL,\n notes TEXT,\n FOREIGN KEY(invoice_id) REFERENCES invoice(id)\n);\n\nINSERT INTO payment (id, invoice_id, payment_amount, payment_date, notes)\nVALUES (1, 1, 1000, '2023-04-01', 'First payment'),\n (2, 2, 1000, '2023-04-05', 'Full settlement'),\n (3, 3, 500, '2023-04-10', 'Partial payment'),\n (4, 4, 2000, '2023-04-15', 'Advance payment');",
297
+ "name": "Time_Tracker_and_Billing_System"
298
+ }
@@ -0,0 +1,8 @@
1
+ This example illustrates that it's often a good idea to be more specific in the prompt,
2
+ for example to specify exact table and column names. Here, we create a time-tracking system, being specific about tables and columns in the [002_create_db_models.prompt](./).
3
+
4
+ To create this system:
5
+ ```bash
6
+ # create the time_tracking system
7
+ als genai --project-name=track --using=system/genai/examples/time_tracking_billing/002_create_db_models.prompt
8
+ ```