Skip to content

Conversation

@stephenhand
Copy link
Collaborator

Description

  • values for USCH state / province is now in the form of Country/StateProvince
  • values for USCH city is now in the form of Country/StateProvince/City

info for these respective values have entries for country, state (the full name looked up against abbreviation if appropriate)

This will allow filters to be applied to the values

Checklist

  • Corresponding issue has been opened
  • New tests added
  • [n/a (pre release)] Feature flags / configuration added

Other Related Issues

None

Verification steps

See ticket

AFTER YOU MERGE

  1. Cut a release tag using the GitHub workflow. Wait for it to complete and notify in the #aselo-deploys Slack channel.
  2. Comment on the ticket with the release tag version AND any additional instructions required to configure an environment to test the changes.
  3. Only then move the ticket into the QA column in JIRA

You are responsible for ensuring the above steps are completed. If you move a ticket into QA without advising what version to test, the QA team will assume the latest tag has the changes. If it does not, the following confusion is on you! :-P

@stephenhand stephenhand marked this pull request as ready for review October 17, 2025 10:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds filterable, path-structured address values for USCH data and enables querying list-string-attributes by hierarchical paths (including slashes) with optional prefix filtering.

  • Introduces hierarchical values and associated info for USCH state/province and city during import.
  • Adds API support to fetch distinct string attributes with optional language and prefix filtering; supports keys with slashes via wildcard routes.
  • Expands test coverage for list-string-attributes and reference-attributes using slash-delimited keys; adjusts CI to run all service tests.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
resources-domain/lambdas/s3-importer/src/uschMappings.ts Builds hierarchical address paths and info for USCH mappings (Country/StateProvince and Country/StateProvince/City).
resources-domain/resources-service/src/resource/sql/resourceGetSql.ts Extends SQL to return distinct value and info and to support LIKE-based prefix filtering.
resources-domain/resources-service/src/resource/resourceDataAccess.ts Adds valueStartsWith param to query; returns rows for distinct value+info.
resources-domain/resources-service/src/resource/resourceService.ts Plumbs valueStartsWith through service method.
resources-domain/resources-service/src/resource/resourceRoutesV0.ts Adds wildcard and query-based key support for list-string-attributes; introduces a shared handler.
resources-domain/resources-service/src/referenceAttributes/referenceAttributeRoutesV0.ts Switches to wildcard route to support lists with slashes.
resources-domain/resources-service/tests/service/listStringAttributes.test.ts New tests for list-string-attributes including language and prefix filtering.
resources-domain/resources-service/tests/service/referenceAttributes.test.ts Updates tests to use slash-delimited list names and legacy URL-encoded lists.
resources-domain/resources-service/tests/service/resources.elasticsearch.test.ts Skips suggest/search suites; updates index config retrieval.
resources-domain/resources-service/tests/service/import.test.ts Adjusts import statement (non-type import).
resources-domain/resources-service/tests/service/clearDb.ts Adds DB cleanup helper.
resources-domain/resources-service/package.json Runs all service tests in CI.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

const response = await request
.get(`${basePath}/${key}${queryString.length ? '?' : ''}${queryString}`)
.set(headers);
console.log(response.body);
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the console.log from tests to keep CI output clean; if needed for debugging, prefer using test-only logging helpers or assertions that output on failure.

Suggested change
console.log(response.body);

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Collaborator

@gpaoloni gpaoloni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, just a small question

'{coverageIndex}': translatableAttributeMapping('coverage/{coverageIndex}', {
value: ({ currentValue }) => currentValue,
value: ({ currentValue }) =>
`United States/${currentValue.replace(/\s+-\s+/, '/')}`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this treating all resources as United States resources? I don't get what's the intention of this templated string 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first look there weren't coverages for international resources so I was assuming the ones that existed were US. But there are some international coverages, but they are formatted '{country} - {stateProvince}' not '{stateProvince} - {city}'

Updated the mapping code to account for this

router.get('/*', async (req, res) => {
const { valueStartsWith, language } = req.query;
const { list } = req.params;
const list = (req as any).params[0];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we document what's this doing? Is params now a list or how is this working? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes /* returns a list, which is documented in Express, I'm not sure we should document standard API behaviour

const response = await request
.get(`${basePath}/${key}${queryString.length ? '?' : ''}${queryString}`)
.set(headers);
console.log(response.body);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +95 to +96
router.get('/list-string-attributes/*', listStringAttributesHandler);
router.get('/list-string-attributes', listStringAttributesHandler);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference of this two endpoints, when should each be used?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One specifies the key on the path, the other in a query item. I prefer using the path because it's more consistent with the reference-string-attributes API, but the query item form might be needed if we ever need to specify multiple keys for the same request.

Just being indecisive really, and it wasn't much extra code to support both forms

@nickhurlburt
Copy link
Collaborator

oooooooo... we're trying it...

@stephenhand stephenhand merged commit 6803cbb into master Oct 22, 2025
32 of 33 checks passed
@stephenhand stephenhand deleted the CHI-3500-usch_location_paths branch October 22, 2025 19:52
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.

4 participants