Allo Dept/GL ReadMe
Allocate Project Payments to configured Departments/Accounts
Audience: Technical GenAI-Logic evaluators
Project: Allocate Project Payments to configured Departments/Accounts
Run Instructions: at end
Creation Prompts
Requires 16.03.01, windows or mac.
Please load `.github/.copilot-instructions.md`
With Fuzzy Lookup Logic
This finds the Project from Contractor information:
Departments own a series of General Ledger Accounts.
Departments also own Department Charge Definitions — each defines what percent
of an allocated cost flows to each of the Department's GL Accounts.
An active Department Charge Definition must cover exactly 100% (derived:
total_percent = sum of lines; is_active = 1 when total_percent == 100).
Project Funding Definitions define which Departments fund a designated percent
of a Project's costs, and which Department Charge Definition each Department
applies. An active Project Funding Definition must cover exactly 100% (derived:
total_percent = sum of lines; is_active = 1 when total_percent == 100).
Projects are assigned to a Project Funding Definition.
When a Charge is received against a Project, cascade-allocate it in two levels:
Level 1 — allocate the Charge amount to each Department per their
Project Funding Line percent → creates ChargeDeptAllocation rows
Level 2 — allocate each ChargeDeptAllocation amount to that Department's
GL Accounts per their Charge Definition line percents
→ creates ChargeGlAllocation rows
Constraint: a Charge may only be posted if the Project's
Project Funding Definition is active.
Charges can be placed by contractors. They may supply only a minimal project description to identify the Project - use AI Rules to find an Active Project based on a fuzzy match to project name, and past charges from the contractor. For example, you might observe that a contractor works on roads vs construction.
Total the charges into the Project and GL Account.
No Fuzzy Logic
Departments own a series of General Ledger Accounts.
Departments also own Department Charge Definitions — each defines what percent
of an allocated cost flows to each of the Department's GL Accounts.
An active Department Charge Definition must cover exactly 100% (derived:
total_percent = sum of lines; is_active = 1 when total_percent == 100).
Project Funding Definitions define which Departments fund a designated percent
of a Project's costs, and which Department Charge Definition each Department
applies. An active Project Funding Definition must cover exactly 100% (derived:
total_percent = sum of lines; is_active = 1 when total_percent == 100).
Projects are assigned to a Project Funding Definition.
When a Charge is received against a Project, cascade-allocate it in two levels:
Level 1 — allocate the Charge amount to each Department per their
Project Funding Line percent → creates ChargeDeptAllocation rows
Level 2 — allocate each ChargeDeptAllocation amount to that Department's
GL Accounts per their Charge Definition line percents
→ creates ChargeGlAllocation rows
Constraint: a Charge may only be posted if the Project's
Project Funding Definition is active.
Total the charges into the Project and GL Account.
Admin App Fixup
You may need to remind Copilot to update the Admin App. Often, you can rename admin-merge.yml to admin.yml.
How it Works
This is a sophisticated system, requiring a multi-year efforts using traditional technology. With AI and GenAI-Logic, the overall process is described below.
Authoring
The project creation process starts with the prompt above; Copilot processes it as follows:
-
Invokes AI, which, under the guidance of Context Engineering (see
docs/training), computes the data model and builds a sqlite database (seedocs/allo_dept_gl_db.png) -
Invokes
genai-logic create --project-name=allo_dept_gl --db-url=<created database>- This creates a scaffold (mainly empty) project, wired up to start the runtime engines
- Reads the database schema to create the
database/models.py(this drives the SQLAlchemy ORM) - At this point, the project is runnable, including the API (with swagger), and the Admin App - but no logic
-
Copilot then, again under the guidance of Context Engineering:
- Translates NL into Rules DSL (see `logic/logic_discovery', not FrankenCode)
- test data (with data initialized per rules)
- and runs tests
Execution
AI is used for the Allocation Plan fuzzy lookup (if requested). The rest of the execution uses deterministic runtime engines (ORM, API, Logic), installed with GenAI-Logic.
Results
