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 salarynumber
Military stipend per service yearnumber

Employee

Each Employee belongs to one Department.

Each Employee has many Order records.

FieldKind of valueNotes
Nametextrequired
Typeone of: salaried, hourly, commissionedrequired
Salaryamountcomputed hourly = hours worked * hourly rate; commissioned = base salary + commission total; salaried = entered value
Militaryone of: yes, norequired
Total compensationamountcomputed salary + military stipend for military employees; salary for non-military

Order

Each Order belongs to one Employee.

FieldKind of valueNotes
Customer nametextrequired
Amountamountrequired

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 with a union, else 0

Commissioned Employee type = commissioned

FieldKind of valueNotes
Base salaryamount
Commission totalamountcomputed the total of its Order amount
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 * the system setting military stipend per service 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).

Department Budget

RuleTypeRequirement
Department total salary: the total of its Employee salaryTotalDepartment.total_salary = sum of Employee.salary (all types).
Total salary must not exceed budget, unless the committing user holds the manager roleCheckDepartment.total_salary must not exceed Department.budget.
If violated: Department total salary ([total salary]) exceeds budget ([budget]) - only the manager role may exceed the budget

Employee Pay

RuleTypeRequirement
Employee salary: hourly = hours worked * hourly rate; commissioned = base salary + commission total; salaried = entered valueCalculationHourly employees: salary = hours_worked * hourly_rate. / Commissioned employees: salary = base_salary + commission_total.
Employee union dues: hours worked * union dues rate for hourly employees with a union, else 0CalculationHourly employees: union_dues = hours_worked * union.dues_rate (0 if no union assigned).
Employee commission total: the total of its Order amountTotalCommissioned 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)
Employee type must be one of: salaried, hourly, commissionedCheckEmployees have a type that is one of: 'salaried', 'hourly', or 'commissioned'.
If violated: Employee type ([type]) must be one of: salaried, hourly, commissioned
An hourly employee's (weekly) salary must not exceed the system setting max hourly weekly salaryCheckHourly employees: salary must not exceed 5000 per week.
If violated: Hourly employee salary ([salary]) exceeds the weekly maximum (the system setting max hourly weekly salary)
Only hourly employees may have a union idCheckHourly employees may be assigned to a Union (optional); only Hourly employees may have a union_id.
Applies to: Hourly Employee
If violated: Only hourly employees may have a union id
Only commissioned employees may have OrdersCheckCommissioned employees are employees who can have Orders; only Commissioned employees may have Orders.
Applies to: Commissioned Employee
If violated: Only commissioned employees may have Orders (order count is [order count])
Hours worked must be null for non-hourly employees
added by AI
Check(not stated in the requirement)
Applies to: Hourly Employee
If violated: hours worked must be null for non-hourly employees
Hourly rate must be null for non-hourly employees
added by AI
Check(not stated in the requirement)
Applies to: Hourly Employee
If violated: hourly rate must be null for non-hourly employees
Base salary must be null for non-commissioned employees
added by AI
Check(not stated in the requirement)
Applies to: Commissioned Employee
If violated: base salary must be null for non-commissioned employees

Military Compensation

RuleTypeRequirement
Employee military stipend: service years * the system setting military stipend per service year for military employees, 0 otherwiseCalculationMilitary employees receive a military_stipend (REAL) = service_years * 100. / Total compensation for military employees = salary + military_stipend.
Employee total compensation: salary + military stipend for military employees; salary for non-militaryCalculationTotal compensation for military employees = salary + military_stipend.
Military must be 'yes' or 'no'
added by AI
Check(not stated in the requirement)
If violated: military ([military]) must be 'yes' or 'no'
Branch must be one of: Army, Navy, Air Force, Marines, Coast GuardCheckMilitary employees have a branch (TEXT: 'Army', 'Navy', 'Air Force', 'Marines', 'Coast Guard'),
If violated: branch ([branch]) must be one of: Army, Navy, Air Force, Marines, Coast Guard
Branch must be null for non-military employees
added by AI
Check(not stated in the requirement)
Applies to: Military Employee
If violated: branch must be null for non-military employees
Rank must be null for non-military employees
added by AI
Check(not stated in the requirement)
Applies to: Military Employee
If violated: rank must be null for non-military employees
Service years must be null for non-military employees
added by AI
Check(not stated in the requirement)
Applies to: Military Employee
If violated: service years must be null for non-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
Department total salaryEmployee salary
Employee salaryEmployee type, Employee hours worked, Employee hourly rate, Employee base salary, Employee commission total
Employee union duesEmployee type, Employee union id, Employee hours worked, Labor union dues rate
Employee commission totalOrder amount
Employee order countOrder records
Employee military stipendEmployee military, Employee service years, Sys config military stipend per service year
Employee total compensationEmployee military, Employee salary, Employee military stipend
If this changesthese are recalculated
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
Employee union idEmployee union dues
Labor union dues rateEmployee union dues
Order amountEmployee commission total, Employee salary, Department total salary, Employee total compensation
Order recordsEmployee order count
Employee militaryEmployee military stipend, Employee total compensation
Employee service yearsEmployee military stipend, Employee total compensation
Sys config military stipend per service yearEmployee military stipend, Employee total compensation

5. Check of the current data

All 12 records in the system satisfy every check that can be stated as a standard SHACL shape (demo_emp_types.shapes.ttl).

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