CDLUC3 / dmsp_aws_prototype

Sceptre CloudFormation templates for DMPHub v2
MIT License
1 stars 0 forks source link

Setup secondary indices on DynamoDb Table #18

Closed briri closed 6 months ago

briri commented 1 year ago

We will need to create some DynamoDB global secondary indexes to support the new UI dashboards.

Table scans are expensive in DynamoDB (although we have < 600 items in the table, so not an immediate concern). As the table grows (including versions) this will get expensive.

Dynamo does not currently allow indexing of nested elements in an item, so we need a way to ask things like 'give me all of the DMPs (latest versions) for Funder ABC'.

Suggest creating a Ruby module in the Lambda Layer that manages these connections via relationship based Dynamo items. It would be called by the DmpCreator module. The entries would contain just enough metadata for the user to make a decision in the UI. For example:

{
  "PK": "affiliation_id": "https://ror.org/12345",
  "SK": "DMPS",
  "dmps": [
    { "PK": "DMP:doi.org/10.12345/A1IUYGJHT", "title": "Example A", "modified": "2022-11-15T09:41:32+0", "funding_status": "planned" }
    { "PK": "DMP:doi.org/10.12345/A1JHGF543", "title": "Example B", "modified": "2022-11-14T09:41:32+0", "funding_status": "granted" }
  ]
}

The index could then be queried with the affiliation identifiers and the projection that includes the subset of attributes (although the UI should dictate specific needs).

The UI could then make subsequent calls for the full DMP metadata when the user selects the item and drill in for details.

This will likely be needed for 'Affiliation', 'Funder', 'Contributor', 'Contact', 'Related Identifier'

See the Dynamo Querying docs for details

briri commented 6 months ago

Closing this one. We are going to use OpenSearch for this