Use new location metadata fields#1002
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1002 +/- ##
==========================================
+ Coverage 49.54% 49.93% +0.38%
==========================================
Files 346 346
Lines 11414 11421 +7
Branches 1944 1946 +2
==========================================
+ Hits 5655 5703 +48
+ Misses 5571 5528 -43
- Partials 188 190 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Updates the Angular web app’s location handling to support newly introduced location metadata fields (e.g., name/sublocation/city and role/precision/raw metadata), aligning the UI formatting and client-side models with the updated location schema.
Changes:
- Extend location DTO/model types with new metadata fields (name, sublocation, city, altitudeMeters, role/precision/raw metadata).
- Map Stela location fields into the app’s
LocnVODatashape, including renamingrole/precision/rawtolocationRole/locationPrecision/rawMetadata. - Prefer new location fields when rendering location display strings and when creating locations from Google Places.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/app/shared/services/api/record.repo.ts |
Adds new Stela location fields and maps role/precision/raw into the app’s renamed metadata fields during conversion. |
src/app/shared/pipes/pr-location.pipe.ts |
Updates display formatting to prefer sublocation, city, and name when present. |
src/app/models/locn-vo.ts |
Extends LocnVOData with new location metadata fields used across the app. |
src/app/file-browser/components/location-picker/location-picker.component.ts |
Populates sublocation, city, and name when creating a location from a selected Google Place. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8aacc88 to
0ef7893
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0ef7893 to
75feaaa
Compare
75feaaa to
e18814e
Compare
cecilia-donnelly
left a comment
There was a problem hiding this comment.
I don't see anything obviously off here! I have some questions, likely answered by your partner PRs to this one, but wanted to ask them right away.
| return component | ||
| ? component[getShortName ? 'short_name' : 'long_name'] | ||
| : null; | ||
| return component ? component.long_name : null; |
There was a problem hiding this comment.
What was the short name?
There was a problem hiding this comment.
@slifty is going to figure out if we want to keep that after all.
There was a problem hiding this comment.
The idea is that short vs long name isn't part of the new location specification, and so we just use the long name now because it's the only thing that will exist in the future.
Short name might have been "CA" when long name was "California"
The backend is changing which location metadata fields to store and we need to use those fields. Issue #1001 Use new location metadata fields
e18814e to
07ca375
Compare
aasandei-vsp
left a comment
There was a problem hiding this comment.
LGTM, small observations.
| ...rest, | ||
| locnId: Number.parseInt(stelaLocation.id, 10), | ||
| adminOneName: state ?? undefined, | ||
| locationPrecision: precision ?? undefined, |
There was a problem hiding this comment.
These checks don't really make sense.
There was a problem hiding this comment.
It's because precision can be null but locationPrecision is not nullable.
These lines are mapping null to undefined (so if precision is null it would be translated to undefined, which is allowed)
| latitude?: number | null; | ||
| longitude?: number | null; | ||
| altitudeMeters?: number | null; | ||
| precision?: LocationPrecision | null; |
There was a problem hiding this comment.
Why do we need them to be also null? they can just be skipped, as they are optional.
There was a problem hiding this comment.
null is a value and undefined is a lack of any value.
const foo = {
a: null,
b: undefined,
}
console.log(foo.a);
console.log(foo.b);
console.log(foo.c);results in
null
undefined
undefined
null and undefined are both falsey, but in any case where stela could return null or provide no value at all we'd want the types to reflect both possibilities.
I do personally believe that it is better to never have optional properties in an API's entity shape (outside of patch), and instead have our API commit to there being a nullable value because of this very ambiguity!
All that said: I'll double check the stela API commitments. If this can be null we should have null, and if not we shouldn't!
There was a problem hiding this comment.
OK! So currently the stela spec lists these as optional but not nullable; ironically the implementation is the inverse (stela can return null, and always returns something).
Given that I think we should keep this as written. Null is a possible value, and in theory stela could choose to not return a given value.
There was a problem hiding this comment.
Created a stela ticket about this: PermanentOrg/stela#742
QA InstructionsQA Testing InstructionsSummaryThis pull request modifies the application to adopt new location metadata fields for both the Test Environment Setup
Test Scenarios1. Validate Location Metadata Mapping in
|
|
In my own testing: I'd like to wait until the stela endpoints for location creation are live before moving the frontend to use the new properties. |
omnignorant
left a comment
There was a problem hiding this comment.
Not 100% sure what I am testing or what the success condition should be, but I did my best to suss it out of the QA guide. The gist seems to be "does a location properly save using the current picker UI"
Location editing seems to work inconsistently. In the screen capture attached here, I seem to have determined the following:
- location seems to save on initial selection
- for records without existing location data, the changed metadata persists after a refresh;
- for records with existing location data, the metadata does not persist;
- location metadata in profile, both general and milestone persists.
Screen.Recording.2026-05-08.at.4.50.36.PM.mov
|
@omnignorant sorry for the confusion -- I pulled this off of the QA pile since we need to do some additional changes for everything to work as expected! |
This PR modifies the web app to use the new location metadata fields.
Resolves #1001