Skip to content

Improving location support (backend) - #2002

Open
OMWalmsley wants to merge 3 commits into
ml-evs/custom-itemsfrom
OMWalmsley/location-route-and-location-trait
Open

Improving location support (backend)#2002
OMWalmsley wants to merge 3 commits into
ml-evs/custom-itemsfrom
OMWalmsley/location-route-and-location-trait

Conversation

@OMWalmsley

@OMWalmsley OMWalmsley commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Superseeds #2001 (This new version is not from a fork and thus can be "stacked")
Resolves #1970

Locations are where things are stored. Currently we are using a single string in the database to store the location and then frontend application logic on top to create a nested hierarchy. Moving forward it would be ideal to move some of this logic to the backend to prevent locations being generated from stale/deprecated data that has been stored in the frontend.

Features

  • Introduces GET \locations endpoint.
    • Which returns a flat list of all locations and a nested list of all locations.
  • Introduces HasLocation attribute for all items

Example

An example return from the endpoint is here
{"flat_locations":["Hub1 > Hub2 > Place 1","LHud One","Lab 1 > Shelf 1 > Place A","Lab 4 > Shelf 1","lab1"],"nested_locations":{"Hub1":{"Hub2":{"Place 1":{}}},"LHud One":{},"Lab 1":{"Shelf 1":{"Place A":{}}},"Lab 4":{"Shelf 1":{}},"lab1":{}}}

Testing

Currently three tests have been written to test this endpoint functionality (GET \locations).

Further planned functionality

Implement this into the frontend so that it queries this endpoint instead of using frontend storage.

@OMWalmsley
OMWalmsley marked this pull request as ready for review August 12, 2026 11:30
@OMWalmsley OMWalmsley changed the title Improving location support Improving location support (backend) Aug 12, 2026
@cypress

cypress Bot commented Aug 12, 2026

Copy link
Copy Markdown

datalab    Run #5327

Run Properties:  status check passed Passed #5327  •  git commit 2b4cf4eac0 ℹ️: Merge 66f1042b1f4e28379bebcdd3de67f033895956c3 into 7ac227b25023731fb66b87ead849...
Project datalab
Branch Review OMWalmsley/location-route-and-location-trait
Run status status check passed Passed #5327
Run duration 25m 30s
Commit git commit 2b4cf4eac0 ℹ️: Merge 66f1042b1f4e28379bebcdd3de67f033895956c3 into 7ac227b25023731fb66b87ead849...
Committer Oliver Walmsley
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 548
View all changes introduced in this branch ↗︎

@ml-evs
ml-evs changed the base branch from ml-evs/bump-pydantic-final-final to ml-evs/custom-items August 12, 2026 13:35
@OMWalmsley

Copy link
Copy Markdown
Contributor Author

Added ability to have server default locations and added a test for this occurrence. To use this CONFIG.EXTRA_LOCATIONS should be populated.

@ml-evs
ml-evs force-pushed the OMWalmsley/location-route-and-location-trait branch from d6f6b58 to 19e494b Compare August 12, 2026 15:23
@ml-evs
ml-evs force-pushed the OMWalmsley/location-route-and-location-trait branch from 16f0d16 to d37a5aa Compare August 13, 2026 22:49
@ml-evs
ml-evs force-pushed the OMWalmsley/location-route-and-location-trait branch from d37a5aa to 66f1042 Compare August 13, 2026 23:14
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.34%. Comparing base (d7c4fc5) to head (66f1042).

Additional details and impacted files
@@                   Coverage Diff                   @@
##           ml-evs/custom-items    #2002      +/-   ##
=======================================================
+ Coverage                80.30%   80.34%   +0.04%     
=======================================================
  Files                       84       84              
  Lines                     7824     7841      +17     
=======================================================
+ Hits                      6283     6300      +17     
  Misses                    1541     1541              
Files with missing lines Coverage Δ
pydatalab/src/pydatalab/models/equipment.py 100.00% <ø> (ø)
pydatalab/src/pydatalab/models/items.py 96.96% <100.00%> (ø)
...datalab/src/pydatalab/models/starting_materials.py 100.00% <100.00%> (ø)
pydatalab/src/pydatalab/models/traits.py 99.04% <100.00%> (+0.02%) ⬆️
pydatalab/src/pydatalab/routes/v0_1/items.py 84.39% <100.00%> (+0.36%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improving location support

1 participant