Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata: Update values to strings #808

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Conversation

ksierks
Copy link
Contributor

@ksierks ksierks commented Oct 3, 2024

What does this PR do and why?

Converting metadata values to strings, so we can search all metadata values. (See #807.)
Fixes #771.

Screenshots or screen recordings

image

How to set up and validate locally

Add metadata through the UI:

  1. Navigate to a samples page that the logged in user has access to update.
  2. Hit the Import Metadata button.
  3. Select a file. (See /irida-next-core/test/fixtures/files/metadata/valid.xlsx)
  4. Select the Sample ID Column.
  5. Hit the Import Metadata button.
  6. Verify the sample metadata was added as strings.
  7. Follow the Test searching metadata instructions below.

Add metadata through GraphQL:

  1. Navigate to http://localhost:3000 and login as admin.
  2. Navigate to http://localhost:3000/graphiql.
  3. Run the following to retrieve a project:
query getProject{
  project(fullPath: "bacillus/bacillus-anthracis/outbreak-2022") {
    id
    name
    path
  }
}
  1. Run the following to create a fresh sample:
mutation createSample{
  createSample(input: { 
    projectId: "<insert here>", 
    name: "Sample Name", 
    description: "Sample Description" 
  }) {
    sample {
      id,
      puid,
      name,
      description
    }
    errors {
      path,
      message
    }
  }
}
  1. Run the following to add metadata to the sample:
mutation addMetadataToSample{
  updateSampleMetadata(input: {
    sampleId: "<insert here>", 
    metadata: { true_boolean: true, false_boolean: false, nil: null, empty: "", number: 123, date: "2024-03-11" }
  }) {
    sample{
      id,
      name,
      description,
      metadata
    },
    status,
    errors {
      path
      message
    }
  }
}
  1. Verify the date, number, true_boolean, and false_boolean were added successfully as strings.
  2. Follow the Test searching metadata instructions below.

Test searching metadata

  1. Navigate to a samples page.
  2. Toggle metadata.
  3. Search using the format FIELD_NAME:FIELD_VALUE.
  4. Verify the results when searching for dates, numbers, booleans, etc.

PR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

@ksierks ksierks self-assigned this Oct 3, 2024

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@ksierks ksierks changed the title Metadata types fix Metadata: Update values to strings Oct 4, 2024
Copy link

github-actions bot commented Oct 8, 2024

Code Metrics Report

Coverage Test Execution Time
93.3% 8m18s

Code coverage of files in pull request scope (100.0%)

Files Coverage
app/services/samples/metadata/update_service.rb 100.0%

Reported by octocov

@ksierks ksierks marked this pull request as ready for review October 8, 2024 14:39
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.

Metdata: Inconsistent handling of values
1 participant