01 — Quick Reference

Numbers

Record Number How
Employee (own staff) E-0019 … assigned on save (E-{sequence:04}); locked once issued
Employee (a contractor's person) C2044 … the number their employer gave them; required when an employer is set
Trade electrician … typed in; may be corrected (copies elsewhere follow)

The four demo people keep the numbers Work already knew (E1001, E1002, E1017, C2044).

Statuses

active, inactive (for example long leave), suspended, terminated. Terminating sets the end date (today when none is given). An employee is never deleted; a delete is refused with the reason.

The events

Event When Carries
workforce.employee_registered an employee is created (on screen or by command) number, name, trade (trade_cid / trade_ref), employer (supplier_cid / supplier_ref), site, dates, status
workforce.employee_changed the trade, employer, site, status, name or position changes the same, and profile_revision
workforce.employee_left the status becomes terminated number, name, employer, end date, status
workforce.trade_reference_changed a trade's code is corrected the trade, its new and previous code

Terminating publishes both employee_changed and employee_left. A change of contact details only (e-mail, phone) publishes nothing. Nothing is published while seed data loads.

Commands and queries

Kind Name What
command workforce.register_employee first and last name; trade by trade_cid or code (trade_ref); optional number, employer, site, supervisor (by number, name or id), start date
command workforce.change_employee the employee by employee_cid or employee_number; any of trade, position, employer, site, status, end date, supervisor, contact; a key sent blank clears it
query workforce.search_trades the picker for a trade (items of {cid, ref, label}); inactive trades only when asked
query workforce.search_employees people by number or name, optionally one employer or one trade; terminated and inactive people only when asked
query workforce.employee_profile one person by id or number: trade, employer, site, supervisor, dates, status

Settings

schema/workforce_settings.yaml: the timesheet period and lock (used from W3) and the own-staff number pattern (the one the runtime uses is the canonical_entity pattern in workforce.integration.dsl; keep the two the same).

Everyday tasks

To… Do this
Register a new starter People → Employee → New (leave the number blank for own staff; enter the employer's number for a contractor's person).
Change someone's trade or employer Edit the employee. Work's copy follows; earlier time entries keep the trade they were recorded with.
Record that someone left Set the status to terminated (the end date defaults to today).
Add a trade Reference → Trade → New.

Running it

python server/run.py workforce                          # alone, http://localhost:5102
python networks/work_supply/network.py start            # with the whole Work & Supply network