Class: Api::V2::SampleMetadataResource

Inherits:
BaseResource
  • Object
show all
Defined in:
app/resources/api/v2/sample_metadata_resource.rb

Overview

Note:

Access this resource via the /api/v2/sample_metadata/ endpoint.

Provides a JSON:API representation of Sample::Metadata which contains additional metadata related to a Sample.

A Sample represents the life of a DNA/RNA sample as it moves through processes. It may exist in multiple receptacles as aliquots. Sample tracks aspects that are always true, like its origin.

For more information about JSON:API see the JSON:API Specifications or look at the JSONAPI::Resources package for Sequencescape's implementation of the JSON:API standard.

Examples:

GET request for all sample metadata

GET /api/v2/sample_metadata/

GET request for a specific sample metadata record by ID

GET /api/v2/sample_metadata/123/

POST request to create a new sample metadata record

POST /api/v2/sample_metadata/
{
  "data": {
    "type": "sample_metadata",
    "attributes": {
      "cohort": "Cohort A",
      "collected_by": "Research Lab X",
      "concentration": "50",
      "donor_id": "D123456",
      "gender": "Female",
      "sample_common_name": "Homo sapiens",
      "sample_description": "Blood sample taken on 2024-01-15",
      "supplier_name": "Sample Supplier Y",
      "volume": "200"
    }
  }
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseResource

apply_includes, creatable_fields, default_includes, #fetchable_fields, inclusions, resolve_relationship_names_to_relations, updatable_fields

Instance Attribute Details

#cohortString

Returns The cohort to which the sample belongs.

Returns:

  • (String)

    The cohort to which the sample belongs.



56
# File 'app/resources/api/v2/sample_metadata_resource.rb', line 56

attribute :cohort

#collected_byString

Returns The name of the organization or person that collected the sample.

Returns:

  • (String)

    The name of the organization or person that collected the sample.



60
# File 'app/resources/api/v2/sample_metadata_resource.rb', line 60

attribute :collected_by

#concentrationString

Returns The concentration of the sample, typically measured in ng/µL.

Returns:

  • (String)

    The concentration of the sample, typically measured in ng/µL.



64
# File 'app/resources/api/v2/sample_metadata_resource.rb', line 64

attribute :concentration

#donor_idString

Returns The unique identifier assigned to the sample donor.

Returns:

  • (String)

    The unique identifier assigned to the sample donor.



68
# File 'app/resources/api/v2/sample_metadata_resource.rb', line 68

attribute :donor_id

#genderString

Returns The gender of the organism providing the sample (e.g., Male, Female, Unknown).

Returns:

  • (String)

    The gender of the organism providing the sample (e.g., Male, Female, Unknown).



72
# File 'app/resources/api/v2/sample_metadata_resource.rb', line 72

attribute :gender

#sample_common_nameString

Returns The common name of the organism from which the sample was derived (e.g., Homo sapiens).

Returns:

  • (String)

    The common name of the organism from which the sample was derived (e.g., Homo sapiens).



76
# File 'app/resources/api/v2/sample_metadata_resource.rb', line 76

attribute :sample_common_name

#sample_descriptionString

Returns A textual description of the sample.

Returns:

  • (String)

    A textual description of the sample.



80
# File 'app/resources/api/v2/sample_metadata_resource.rb', line 80

attribute :sample_description

#supplier_nameString

Returns The name of the supplier that provided the sample.

Returns:

  • (String)

    The name of the supplier that provided the sample.



84
# File 'app/resources/api/v2/sample_metadata_resource.rb', line 84

attribute :supplier_name

#volumeString

Returns The volume of the sample, typically measured in µL.

Returns:

  • (String)

    The volume of the sample, typically measured in µL.



88
# File 'app/resources/api/v2/sample_metadata_resource.rb', line 88

attribute :volume

Instance Method Details

#filter_sample_id(value) ⇒ SampleMetadataResource

Filters sample metadata by sample_id, allowing users to retrieve metadata for a specific sample.

Examples:

Filtering by sample_id

GET /api/v2/sample_metadata?filter[sample_id]=456

Parameters:

  • value (String)

    The sample ID to filter by.

Returns:



102
# File 'app/resources/api/v2/sample_metadata_resource.rb', line 102

filter :sample_id