Blog / NEC Schema

Voids, repairs and the joins between them

Where the void lifecycle meets the works-order spine. The link is a column in the schema, and inferring it from dates instead is how the numbers drift.

Voids and repairs are two of the most reported areas in social housing, and the relationship between them is more direct than it first looks. The temptation is to reconstruct it by matching a property and a date range. NEC already records the link on the works order itself, and using the date overlap instead is exactly where the numbers go wrong.

A works order that belongs to a void carries WOR_VIN_REFNO, a direct reference to the void instance. Void works are simply the works orders where that column is populated. You do not have to guess from property and dates; the schema states the relationship outright.

SQL void works via the stated link
SELECT vin.vin_pro_refno,
       wor.wor_srq_no || '/' || wor.wor_seqno AS works_order
FROM   void_instances vin
JOIN   works_orders   wor
  ON   wor.wor_vin_refno = vin.vin_refno

Why inferring it over-counts

Match every works order on the property between the void’s start and end and you sweep in responsive repairs that had nothing to do with the void, while still risking void works dated outside your window. The date-overlap heuristic feels reasonable and is wrong. WOR_VIN_REFNO is the answer, and it is unambiguous.

Mind property versus communal

One more nuance: a works order attaches to a property through WOR_PRO_REFNO or to a communal admin unit through WOR_AUN_CODE, never both. The universal location key is NVL(WOR_PRO_REFNO, WOR_AUN_CODE). Void works sit at property level, so decide up front whether communal work on the block during a void belongs in your figures, because it will not carry the property’s void reference.

The BaseData take
1 Identify void works by WOR_VIN_REFNO, the stated link. Do not infer them from property and dates.
2 A works order is property xor admin unit. NVL(WOR_PRO_REFNO, WOR_AUN_CODE) is the universal key.
3 Decide whether communal work during a void counts, and make that rule visible on the report.

The relationship is stated, not implied. Use the column NEC gives you, and the void repair numbers stop drifting.

NEC HousingVoidsRepairsSQL
Get in touch

Let's make your housing data make sense.

Tell us where your reporting hurts. We'll tell you, plainly, whether we can help and how we'd approach it.