Skip to content

feat(GAT-9143): Implements the first migration tests to typesense migration. Datasets and Tools.#1697

Merged
loki-sinclair-hdruk merged 16 commits into
devfrom
feat/GAT-9143
Jul 24, 2026
Merged

feat(GAT-9143): Implements the first migration tests to typesense migration. Datasets and Tools.#1697
loki-sinclair-hdruk merged 16 commits into
devfrom
feat/GAT-9143

Conversation

@loki-sinclair-hdruk

Copy link
Copy Markdown
Contributor

Screenshots (if relevant)

Describe your changes

Begins the migration to Typesense. Currently only:

  1. Datasets
  2. Tools

Governed by two individual feature flags. First being:

  1. V2_SearchAggregation
  2. TypesenseSearch

The first defines whether or not the Gateway uses the new Search Provider layer to funnel off searches. The second determines the search method to use, between Elastic (the fallback) and Typesense.

Issue ticket link

Environment / Configuration changes (if applicable)

See .env.example

Requires migrations being run?

No.

If not using the pre-push hook. Confirm tests pass:

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have added appropriate unit tests
  • I have created mocks for unit tests (where appropriate)
  • I have added appropriate Behat tests to confirm AC (if applicable)
  • I have added Swagger annotations for new endpoints (if applicable)
  • I have added audit logs for new operation logic (if applicable)
  • I have added new environment variables to the .env.example file (if applicable)
  • I have added new environment variables to terraform repository (if applicable)

@gh-actions-pipelines-app

Copy link
Copy Markdown

🎉 Great job! Your PR title follows the correct format. 🚀

…I, thus filtering would overwrite existing filters with the one selected only
@loki-sinclair-hdruk loki-sinclair-hdruk changed the title feat(GAT-9143): Implements the first migration tests to typesense migration. Datasets and Tools. WIP: feat(GAT-9143): Implements the first migration tests to typesense migration. Datasets and Tools. Jul 14, 2026
@gh-actions-pipelines-app

Copy link
Copy Markdown

🚨 Invalid PR title format!

Your PR title must follow one of these formats:

  • feat(GAT-1234): Your title
  • fix!(GAT-5678): Breaking change
  • RELEASE: vX.Y.Z

Please update your PR title accordingly. 😊

…here are additional filters left, that require computed values, which is more complex
@gh-actions-pipelines-app

Copy link
Copy Markdown

🚨 Invalid PR title format!

Your PR title must follow one of these formats:

  • feat(GAT-1234): Your title
  • fix!(GAT-5678): Breaking change
  • RELEASE: vX.Y.Z

Please update your PR title accordingly. 😊

Comment on lines +282 to +302
/**
* Material types present on the dataset (GWDM >= 2.0's
* metadata.tissuesSampleCollection[].materialType, excluding the
* "no samples" sentinel value), or null if the section is absent.
* Backs both containsBioSamples (boolean) and sampleAvailability
* (the material type list itself) — same source, two views.
*/
private function materialTypes(array $meta): ?array
{
$tissues = data_get($meta, 'metadata.tissuesSampleCollection', null);
if (!is_array($tissues)) {
return null;
}

$types = array_values(array_filter(array_map(
fn ($item) => ($item['materialType'] ?? null),
$tissues
), fn ($type) => $type !== null && $type !== 'None/not available'));

return $types === [] ? null : array_values(array_unique($types));
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You might want to hold off on more changes like this until i'm done with my changes to the GWDM management system.

This is very specific to GWDM 2.0 as your comment says with a hard-coded path

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

as per my comment above, this would be better suited in the new GwdmHandler to retrieve materialTypes

'geographicLocation' => $this->spatialCoverage->pluck('region')->all(),
'datasetDOI' => data_get($meta, 'metadata.summary.doiName', ''),
'conformsTo' => array_values(array_filter(explode(';,;', $conformsTo))),
'accessService' => data_get($meta, 'metadata.accessibility.access.accessServiceCategory', '') ?? '',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As in my other comment - shall we get in these changes and then put a freeze on it until mine are done?

My changes are going to have an impact on data_get --> this will all be re-written and will need to be context aware (aware of the GWDM version)

@gh-actions-pipelines-app

Copy link
Copy Markdown

🚨 Invalid PR title format!

Your PR title must follow one of these formats:

  • feat(GAT-1234): Your title
  • fix!(GAT-5678): Breaking change
  • RELEASE: vX.Y.Z

Please update your PR title accordingly. 😊

@gh-actions-pipelines-app

Copy link
Copy Markdown

🚨 Invalid PR title format!

Your PR title must follow one of these formats:

  • feat(GAT-1234): Your title
  • fix!(GAT-5678): Breaking change
  • RELEASE: vX.Y.Z

Please update your PR title accordingly. 😊

@gh-actions-pipelines-app

Copy link
Copy Markdown

🚨 Invalid PR title format!

Your PR title must follow one of these formats:

  • feat(GAT-1234): Your title
  • fix!(GAT-5678): Breaking change
  • RELEASE: vX.Y.Z

Please update your PR title accordingly. 😊

@gh-actions-pipelines-app

Copy link
Copy Markdown

🚨 Invalid PR title format!

Your PR title must follow one of these formats:

  • feat(GAT-1234): Your title
  • fix!(GAT-5678): Breaking change
  • RELEASE: vX.Y.Z

Please update your PR title accordingly. 😊

@gh-actions-pipelines-app

Copy link
Copy Markdown

🚨 Invalid PR title format!

Your PR title must follow one of these formats:

  • feat(GAT-1234): Your title
  • fix!(GAT-5678): Breaking change
  • RELEASE: vX.Y.Z

Please update your PR title accordingly. 😊

… edge where a team was soft-deleted, but its associated assets hadnt been, causing the BE to crash
@gh-actions-pipelines-app

Copy link
Copy Markdown

🚨 Invalid PR title format!

Your PR title must follow one of these formats:

  • feat(GAT-1234): Your title
  • fix!(GAT-5678): Breaking change
  • RELEASE: vX.Y.Z

Please update your PR title accordingly. 😊

@gh-actions-pipelines-app

Copy link
Copy Markdown

🚨 Invalid PR title format!

Your PR title must follow one of these formats:

  • feat(GAT-1234): Your title
  • fix!(GAT-5678): Breaking change
  • RELEASE: vX.Y.Z

Please update your PR title accordingly. 😊

…s in a few NTH parts, such as admin panel for Typesense models and indexing from GW UI and the reindexing job. Also Stephen blew the scope for this and asked for a DataCustodianNetwork creation and management portal. Wedged that into the new admin portal in the FE too.
@gh-actions-pipelines-app

Copy link
Copy Markdown

🚨 Invalid PR title format!

Your PR title must follow one of these formats:

  • feat(GAT-1234): Your title
  • fix!(GAT-5678): Breaking change
  • RELEASE: vX.Y.Z

Please update your PR title accordingly. 😊

…y API call - slight improvements to knock off ~2s per call. Also adds a new command to reindex typesense easily
@gh-actions-pipelines-app

Copy link
Copy Markdown

🚨 Invalid PR title format!

Your PR title must follow one of these formats:

  • feat(GAT-1234): Your title
  • fix!(GAT-5678): Breaking change
  • RELEASE: vX.Y.Z

Please update your PR title accordingly. 😊

@gh-actions-pipelines-app

Copy link
Copy Markdown

🚨 Invalid PR title format!

Your PR title must follow one of these formats:

  • feat(GAT-1234): Your title
  • fix!(GAT-5678): Breaking change
  • RELEASE: vX.Y.Z

Please update your PR title accordingly. 😊

Comment thread app/Models/Team.php
private function facetDataTypes(): array
{
return $this->activeDatasetVersions()
->flatMap(fn ($version) => explode(';,;', data_get($version->metadata, 'metadata.summary.datasetType', '') ?? ''))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

very specific for GWDM - would break if this changes - will be better in the handlers

@gh-actions-pipelines-app

Copy link
Copy Markdown

🚨 Invalid PR title format!

Your PR title must follow one of these formats:

  • feat(GAT-1234): Your title
  • fix!(GAT-5678): Breaking change
  • RELEASE: vX.Y.Z

Please update your PR title accordingly. 😊

public function reindex(Request $request): JsonResponse
{
try {
$validator = Validator::make($request->all(), [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would be nice if we validated this in a custom request object, to avoid the validation logic being in the controller.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will discuss offline for pattern to use going forward, as per slack.

$modelClass = HDRUK::typesenseModelMap()[$this->entity] ?? null;

if ($modelClass === null) {
throw new Exception("Unknown Typesense entity '{$this->entity}'");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The failure is deterministic. If it doesn't work now, it won't work on a retry.

Consider using:

$this->fail(new Exception("Unknown Typesense entity '{$this->entity}'"));
return;


$typesense->createCollectionFromModel($modelClass);

Artisan::call('scout:import', ['model' => $modelClass]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggest to use $modelClass::makeAllSearchable(); - same effect as scout:import and no need to invoke the CLI.

@loki-sinclair-hdruk loki-sinclair-hdruk changed the title WIP: feat(GAT-9143): Implements the first migration tests to typesense migration. Datasets and Tools. feat(GAT-9143): Implements the first migration tests to typesense migration. Datasets and Tools. Jul 23, 2026
@loki-sinclair-hdruk
loki-sinclair-hdruk merged commit 2bb2389 into dev Jul 24, 2026
2 of 3 checks passed
@loki-sinclair-hdruk
loki-sinclair-hdruk deleted the feat/GAT-9143 branch July 24, 2026 15:05
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.

3 participants