feat(GAT-9143): Implements the first migration tests to typesense migration. Datasets and Tools.#1697
Conversation
|
🎉 Great job! Your PR title follows the correct format. 🚀 |
…I, thus filtering would overwrite existing filters with the one selected only
|
🚨 Invalid PR title format! Your PR title must follow one of these formats:
Please update your PR title accordingly. 😊 |
…here are additional filters left, that require computed values, which is more complex
|
🚨 Invalid PR title format! Your PR title must follow one of these formats:
Please update your PR title accordingly. 😊 |
| /** | ||
| * 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)); | ||
| } |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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', '') ?? '', |
There was a problem hiding this comment.
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)
|
🚨 Invalid PR title format! Your PR title must follow one of these formats:
Please update your PR title accordingly. 😊 |
|
🚨 Invalid PR title format! Your PR title must follow one of these formats:
Please update your PR title accordingly. 😊 |
|
🚨 Invalid PR title format! Your PR title must follow one of these formats:
Please update your PR title accordingly. 😊 |
|
🚨 Invalid PR title format! Your PR title must follow one of these formats:
Please update your PR title accordingly. 😊 |
|
🚨 Invalid PR title format! Your PR title must follow one of these formats:
Please update your PR title accordingly. 😊 |
… edge where a team was soft-deleted, but its associated assets hadnt been, causing the BE to crash
|
🚨 Invalid PR title format! Your PR title must follow one of these formats:
Please update your PR title accordingly. 😊 |
|
🚨 Invalid PR title format! Your PR title must follow one of these formats:
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.
|
🚨 Invalid PR title format! Your PR title must follow one of these formats:
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
|
🚨 Invalid PR title format! Your PR title must follow one of these formats:
Please update your PR title accordingly. 😊 |
|
🚨 Invalid PR title format! Your PR title must follow one of these formats:
Please update your PR title accordingly. 😊 |
| private function facetDataTypes(): array | ||
| { | ||
| return $this->activeDatasetVersions() | ||
| ->flatMap(fn ($version) => explode(';,;', data_get($version->metadata, 'metadata.summary.datasetType', '') ?? '')) |
There was a problem hiding this comment.
very specific for GWDM - would break if this changes - will be better in the handlers
|
🚨 Invalid PR title format! Your PR title must follow one of these formats:
Please update your PR title accordingly. 😊 |
| public function reindex(Request $request): JsonResponse | ||
| { | ||
| try { | ||
| $validator = Validator::make($request->all(), [ |
There was a problem hiding this comment.
Would be nice if we validated this in a custom request object, to avoid the validation logic being in the controller.
There was a problem hiding this comment.
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}'"); |
There was a problem hiding this comment.
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]); |
There was a problem hiding this comment.
Suggest to use $modelClass::makeAllSearchable(); - same effect as scout:import and no need to invoke the CLI.
Screenshots (if relevant)
Describe your changes
Begins the migration to Typesense. Currently only:
Governed by two individual feature flags. First being:
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