Demo Emp Types: what the system knows

The things this system keeps track of, the kinds of each, and the business rules that keep the data true. The rules are enforced automatically on every change, whether it comes from a screen, an API or a message. This page is generated from the system itself.

1. The things this system knows about

Department

Each Department has many Employee records.

FieldKind of valueNotes
Nametextrequired
Budgetamountrequired
Total salaryamountcomputed the total of its Employee salary

Labor Union

Each Labor Union has many Employee records.

FieldKind of valueNotes
Nametextrequired
Dues ratenumberrequired

System settings (global rates and limits)

FieldKind of valueNotes
Nametextrequired
Discount ratenumber
Tax ratenumber
Notestext
Max hourly weekly salaryamount
Military stipend per yearamount

Employee

Each Employee may belong to one Department.

Each Employee has many Order records.

FieldKind of valueNotes
Typeone of: salaried, hourly, commissionedrequired
Nametextrequired
Salaryamountcomputed hourly = hours worked * hourly rate; commissioned = base salary + commission total; salaried = as entered
Commission totalamountcomputed the total of its Order amount
Militarytext
Total compensationamountcomputed calculated by a formula

Order

Each Order belongs to one Employee.

FieldKind of valueNotes
Amountamountrequired
Customer nametextrequired

2. Kinds of Employee

They are classified in independent ways. Each record is exactly one kind on each way that is exclusive, and may also be a kind from the others.

By type

Exactly one of these:

Salaried Employee type = salaried

No additional fields.

Hourly Employee type = hourly

May have one Labor Union. No other kind of employee can.

FieldKind of valueNotes
Hours workednumber
Hourly ratenumber
Union duesamountcomputed hours worked * union dues rate for hourly employees (0 if no union, or not hourly)

Commissioned Employee type = commissioned

FieldKind of valueNotes
Base salaryamount
Order countwhole numbercomputed the number of its Order records

By military

Independent of the other classifications:

Military Employee military = yes

FieldKind of valueNotes
Branchone of: Army, Navy, Air Force, Marines, Coast Guard
Ranktext
Service yearswhole number
Military stipendamountcomputed service years * SysConfig military stipend per year for military employees, 0 otherwise

3. Business rules

Each rule traces to the requirement that asked for it. added by AI marks rules the requirement did not state, so a person should confirm them (the judgment calls are listed in ad-libs.md).

Commissioned Employees

RuleTypeRequirement
Employee commission total: the total of its Order amountTotalCommissioned employees are employees who can have Orders; only Commissioned employees may have Orders. Each Order has an amount and a customer name. Commissioned employees: commission_total = sum of Order.amount.
Employee order count: the number of its Order records
added by AI
Count(not stated in the requirement)
Only commissioned employees may have OrdersCheckCommissioned employees are employees who can have Orders; only Commissioned employees may have Orders. Each Order has an amount and a customer name. Commissioned employees: commission_total = sum of Order.amount.
Applies to: Commissioned Employee
If violated: Only commissioned employees may have Orders
Base salary applies only to commissioned employeesCheckCommissioned employees are employees who can have Orders; only Commissioned employees may have Orders. Each Order has an amount and a customer name. Commissioned employees: commission_total = sum of Order.amount.
Applies to: Commissioned Employee
If violated: base salary applies only to commissioned employees

Department Budget

RuleTypeRequirement
Department total salary: the total of its Employee salaryTotalDepartments have a name and a budget. Department.total_salary = sum of Employee.salary (all types). Department.total_salary must not exceed Department.budget. A user with the manager role may exceed the budget; other users may not.
Total salary must not exceed budget, unless the user has the manager roleCheckDepartments have a name and a budget. Department.total_salary = sum of Employee.salary (all types). Department.total_salary must not exceed Department.budget. A user with the manager role may exceed the budget; other users may not.
If violated: Department total salary ([total salary]) exceeds budget ([budget])

Employee Types

RuleTypeRequirement
Employee salary: hourly = hours worked * hourly rate; commissioned = base salary + commission total; salaried = as enteredCalculationHourly employees: salary = hours_worked * hourly_rate. / Commissioned employees: salary = base_salary + commission_total.
Employee type must be salaried, hourly or commissionedCheckEmployees have a name, dept, and salary. Employees have a type that is one of: 'salaried', 'hourly', or 'commissioned'.
If violated: Employee type ([type]) must be salaried, hourly or commissioned

Hourly Employees

RuleTypeRequirement
Employee union dues: hours worked * union dues rate for hourly employees (0 if no union, or not hourly)CalculationHourly employees are employees with hours_worked (REAL) and hourly_rate (REAL). Hourly employees: salary must not exceed 5000 per week. Hourly employees may be assigned to a Union (optional); only Hourly employees may have a union_id. Unions have a name and a dues_rate (REAL). Hourly employees: union_dues = hours_worked * union.dues_rate (0 if no union assigned).
An hourly employee's weekly salary must not exceed SysConfig max hourly weekly salaryCheckHourly employees are employees with hours_worked (REAL) and hourly_rate (REAL). Hourly employees: salary must not exceed 5000 per week. Hourly employees may be assigned to a Union (optional); only Hourly employees may have a union_id. Unions have a name and a dues_rate (REAL). Hourly employees: union_dues = hours_worked * union.dues_rate (0 if no union assigned).
If violated: Hourly salary ([salary]) exceeds the weekly maximum
Only hourly employees may have a union idCheckHourly employees are employees with hours_worked (REAL) and hourly_rate (REAL). Hourly employees: salary must not exceed 5000 per week. Hourly employees may be assigned to a Union (optional); only Hourly employees may have a union_id. Unions have a name and a dues_rate (REAL). Hourly employees: union_dues = hours_worked * union.dues_rate (0 if no union assigned).
Applies to: Hourly Employee
If violated: Only hourly employees may have a union id
Hours worked and hourly rate apply only to hourly employeesCheckHourly employees are employees with hours_worked (REAL) and hourly_rate (REAL). Hourly employees: salary must not exceed 5000 per week. Hourly employees may be assigned to a Union (optional); only Hourly employees may have a union_id. Unions have a name and a dues_rate (REAL). Hourly employees: union_dues = hours_worked * union.dues_rate (0 if no union assigned).
Applies to: Hourly Employee
If violated: hours worked and hourly rate apply only to hourly employees

Military Employees

RuleTypeRequirement
Employee military stipend: service years * SysConfig military stipend per year for military employees, 0 otherwiseCalculationEmployees may also have a military classification, independent of employment type. Military employees have a branch (TEXT: 'Army', 'Navy', 'Air Force', 'Marines', 'Coast Guard'), a rank (TEXT), and service_years (INTEGER). Military employees receive a military_stipend (REAL) = service_years * 100. Total compensation for military employees = salary + military_stipend. Total compensation for non-military employees = salary.
Employee total compensation: calculated by a formulaCalculationEmployees may also have a military classification, independent of employment type. Military employees have a branch (TEXT: 'Army', 'Navy', 'Air Force', 'Marines', 'Coast Guard'), a rank (TEXT), and service_years (INTEGER). Military employees receive a military_stipend (REAL) = service_years * 100. Total compensation for military employees = salary + military_stipend. Total compensation for non-military employees = salary.
Applies to: Military Employee
The military classification must be yes or noCheckEmployees may also have a military classification, independent of employment type. Military employees have a branch (TEXT: 'Army', 'Navy', 'Air Force', 'Marines', 'Coast Guard'), a rank (TEXT), and service_years (INTEGER). Military employees receive a military_stipend (REAL) = service_years * 100. Total compensation for military employees = salary + military_stipend. Total compensation for non-military employees = salary.
If violated: military must be yes or no
Branch must be Army, Navy, Air Force, Marines or Coast GuardCheckEmployees may also have a military classification, independent of employment type. Military employees have a branch (TEXT: 'Army', 'Navy', 'Air Force', 'Marines', 'Coast Guard'), a rank (TEXT), and service_years (INTEGER). Military employees receive a military_stipend (REAL) = service_years * 100. Total compensation for military employees = salary + military_stipend. Total compensation for non-military employees = salary.
If violated: branch ([branch]) must be Army, Navy, Air Force, Marines or Coast Guard
Branch, rank and service years apply only to military employeesCheckEmployees may also have a military classification, independent of employment type. Military employees have a branch (TEXT: 'Army', 'Navy', 'Air Force', 'Marines', 'Coast Guard'), a rank (TEXT), and service_years (INTEGER). Military employees receive a military_stipend (REAL) = service_years * 100. Total compensation for military employees = salary + military_stipend. Total compensation for non-military employees = salary.
Applies to: Military Employee
If violated: branch, rank and service years apply only to military employees

4. What feeds what

Where each calculated value comes from, and what a change ripples to. The same information is in lineage.csv and lineage.json for catalog tools.

This valueis calculated from
Employee commission totalOrder amount
Employee order countOrder records
Department total salaryEmployee salary
Employee salaryEmployee type, Employee hours worked, Employee hourly rate, Employee base salary, Employee commission total
Employee union duesEmployee type, Employee hours worked, Labor union dues rate
Employee military stipendEmployee military, Employee service years, Sys config military stipend per year
Employee total compensationEmployee salary, Employee military, Employee military stipend
If this changesthese are recalculated
Order amountEmployee commission total, Employee salary, Department total salary, Employee total compensation
Order recordsEmployee order count
Employee typeEmployee salary, Employee union dues, Department total salary, Employee total compensation
Employee hours workedEmployee salary, Employee union dues, Department total salary, Employee total compensation
Employee hourly rateEmployee salary, Department total salary, Employee total compensation
Employee base salaryEmployee salary, Department total salary, Employee total compensation
Labor union dues rateEmployee union dues
Employee militaryEmployee military stipend, Employee total compensation
Employee service yearsEmployee military stipend, Employee total compensation
Sys config military stipend per yearEmployee military stipend, Employee total compensation

5. Check of the current data

rdflib is not installed: files were written but not parsed or validated

Technical files in this folder: demo_emp_types.ttl, demo_emp_types.shapes.ttl, genai-logic.ttl, lineage.csv, lineage.json.