Class: Api::V2::SampleMetadataResource

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

Overview

TODO:

Figure out how to send a POST for a sample with sample metadata association. Currently, it is possible to create a sample and sample metadata seperately, but they are not associated with each other. How do you create the association, either in one request or after the individual requests?

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",
      "date_of_sample_collection": "2024-01-15T12:00:00Z",
      "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.



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

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.



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

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.



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

attribute :concentration

#date_of_sample_collectionDateTime

Returns The date and time when the sample was collected.

Returns:

  • (DateTime)

    The date and time when the sample was collected.



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

attribute :date_of_sample_collection

#donor_idString

Returns The unique identifier assigned to the sample donor.

Returns:

  • (String)

    The unique identifier assigned to the sample donor.



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

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).



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

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).



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

attribute :sample_common_name

#sample_descriptionString

Returns A textual description of the sample.

Returns:

  • (String)

    A textual description of the sample.



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

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.



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

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.



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

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:



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

filter :sample_id