Sorting logic used by Lords amendment lists
Amendments are automatically sorted as part of generating the different Lords Official Lists.
In short, it is a combination of:
where the amendment appears in the bill (subject to an order of consideration & whether it’s an amendment to amendment),
whether it is a new clause/schedule (specifically, dealing with the ‘before’ and ‘after’ cases),
position on the page (page & line information), and finally
sort codes where used
In more detail, this looks like:
First level sort: by the provision to which the amendment relates (using the ukl:targetProvision attribute)
Sort by the order that provisions appear in the Bill, as adjusted by the Order of Consideration (Bill is published version to which the amendments relate).
This level involves sorting amendments against a list of provisions in Bill order that has been sorted against the order of consideration.
Order of Bill provisions | Order of Consideration | Sort amendments using this order |
---|---|---|
longTitle | Clauses 2 to 5 | sec_2 |
preamble | Schedule 1 | sec_3 |
sec_1 | Clause 1 | sec_4 |
sec_2 | Clauses 6 to 9 | sec_5 |
sec_3 | Schedules 2 to 5 | sch_1 |
sec_4 | Preamble | sec_1 |
sec_5 | Long Title | sec_6 |
sec_6 | sec_7 | |
sec_7 | sec_8 | |
sec_8 | sec_9 | |
sec_9 | sch_2 | |
sch_1 | sch_3 | |
sch_2 | sch_4 | |
sch_3 | sch_5 | |
sch_4 | preamble | |
sch_5 | longTitle |
The types of entry in the OoC and what amendments fall within them are as follows:
OoC entry | amendments |
---|---|
Clauses x to y | all amendments of ukl:type "insert", "leaveOut", "substitute", "move", "divide" relating to clauses with ukl:targetProvision within range of sec_x to sec_y |
Schedules x to y | all amendments of ukl:type "insert", "leaveOut", "substitute", "move", "divide" relating to schedules with ukl:targetProvision within range of sch_x to sch_y |
Preamble | all amendments with ukl:targetProvision "preamble" |
Long title | all amendments with ukl:targetProvision "longTitle" |
If no order of consideration then use the following order:
Clauses 1 to (end)
Schedules 1 to (end)
Preamble
Long title
If the Order of Consideration doesn't cover certain provisions (i.e. there are gaps in the specified ranges of provisions) then those provisions should be treated as falling at the end of the order of consideration in the order they appear in the Bill.
Amendments to amendments that have a @ukl:targetProvision="amnd_z" should appear after their target amendment (identified using the number expressed as "z" in the example ukl:targetProvision="amnd_z").
Second level sort: by whether amendment is before the target provision, to the target provision or after it (using the ukl:location attribute)
Sort by values in the following order: before, (empty), after
Third level sort: by position on page (using the ukl:targetPage attribute)
Sort in ascending order by page (p_x), then line (ln_x), then column (col_x, if included) e.g.
Amendments with empty ukl:targetPage (i.e. an amendment to leave out clause/schedule) go last
Fourth level sort (using the ukl:targetSortKey attribute)
Amendments appear in sort code order ascending - using alphanumeric values e.g. M1, M2, M3... or 20, 30, 40 or 1, 2, 3