Housing and location updates - #12
Open
labkey-martyp wants to merge 8 commits into
Open
Conversation
Rooms are now keyed by building and name instead of floor, buildings drop the area suffix, and the derived cage location key is persisted via a managed column. Cagemates now matches on room as well as cage so group-pen animals, which have no cage, resolve correctly.
Removing floors deleted the fullRoom and fullFloor display columns but left the room and floor lookups, the cage details page, and roughly fifty views still pointing through them, so Room and Building rendered blank. Room entry now requires a building, which the derived room key needs and previously went unchecked.
The fixtures housed animals in rooms and cages that nothing ever created, so every room lookup in the housing views resolved to nothing. Adds coverage for the derived room key, the building requirement, and cagemates in a group pen.
The sample housing rows used a free-text location that matches no registered room or cage, and omitted the room entirely, so the housing trigger skipped every one of them.
The fixture supplied a location outright, so the derivation the trigger performs for real entry was never exercised and the test keys looked nothing like production ones.
Cagemates match on the cage where there is one and fall back to the room only for group pens, so a record entered without a room still resolves. Derived room, building, and cage keys are persisted the same way as the cage location and rejected when they cannot be stored or would collide, and floor is kept out of the room views.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale
Remove floors from the NBRI location hierarchy so a location is identified by building, room, and cage alone. Floors are not a meaningful unit of location at NBRI, and requiring one on every room forced entry of a value that carries no information while complicating the derived location keys. This also drops the historicalOther dataset, which is no longer part of the reference study.
Keys are derived only when a record is created, so nothing recomputes them for locations that already exist. There is no location data in place yet, so there is nothing to migrate.
Related Pull Requests
None.
Changes
Rooms are keyed by building and name, and floor is no longer required or shown. Room entry now requires a building, since the derived key depends on it.
Buildings no longer fold the area into their name, so a description identifies a building on its own and a reused one is rejected rather than colliding.
Derived building, room, and cage keys are persisted consistently, and a key too long for its column is rejected with a message naming the parts at fault. Cages resolve to their room.
The cagemates report resolves animals in group pens, which have no cage and are housed against the room alone. Animals with a cage continue to match on the cage, which already identifies its room.
The cagemates report now counts only current occupants. It previously counted every living animal that had ever been housed in the cage, and it now also skips housing records that have not been approved.
Removes the floor-based combined room and floor display columns, and repoints everything that depended on them: the room and floor lookups, the housing views and history, the cage details page, and every view that previously reached the building through a floor.
Room lookups carry a link through to the cage details page, matching how cages already behave.
Location test fixtures build rooms from a building instead of a floor, and cover the room key, the building rules, and cagemates for both group pens and cages recorded without a room.
Removes the historicalOther dataset, its report, and its metadata.