Skip to content

Commit

Permalink
Merge branch 'develop' into y24-234-update-missing-event-history-records
Browse files Browse the repository at this point in the history
  • Loading branch information
seenanair committed Aug 20, 2024
2 parents 80f2a1c + 485de71 commit a9a6713
Show file tree
Hide file tree
Showing 73 changed files with 1,152 additions and 317 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/generate_pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Deploy Yard to GitHub Pages

on:
push:
branches:
- "master"
workflow_dispatch:

permissions:
pages: write # Allow writing to the GitHub Pages
id-token: write # Allow OIDC token to be issued

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Generate Yard documentation
run: |
bundle exec yard doc
- name: Upload artifact to GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
path: doc # Path to the folder containing the Yard documentation (default is 'doc')

deploy:
runs-on: ubuntu-latest
needs: build # The deploy job will only run if the build job is successful

steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion .release-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.40.0
14.41.0
3 changes: 3 additions & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
--markup=markdown
--asset docs/images:images
--exclude app/controllers/api/v2/[^/]*\.rb
--exclude app/controllers/api/v2/concerns/.*
-
LICENSE
docs/*.md
Expand Down
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,19 @@ a organisation of 900 people.
In addition to the [externally hosted YARD docs](https://www.rubydoc.info/github/sanger/sequencescape), you can also run a local server:

```shell
yard server -r --gems -m sequencescape .
yard server --reload sequencescape
```

You can then access the Sequencescape documentation through: [http://localhost:8808/docs/sequencescape](http://localhost:8808/docs/sequencescape)
You can then access the Sequencescape documentation through: [http://localhost:8808/docs](http://localhost:8808/docs)

Yard will also try and document the installed gems: [http://localhost:8808/docs](http://localhost:8808/docs)
If the server complains that the stack depth is too deep, this only appears to be a problem when you try to view the documentation without pre-compiling it.
Precompiling is the simple solution and can be achieved with the following.

```shell
yard doc sequencescape
```

This will pre-fill the cache and allow the server command above to display the documentation without complaining about stack depths.

### Linting

Expand Down
12 changes: 12 additions & 0 deletions app/controllers/api/v2/tag_group_adapter_types_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

module Api
module V2
# Provides a JSON API controller for TagGroup::AdapterType
# See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation
class TagGroupAdapterTypesController < JSONAPI::ResourceController
# By default JSONAPI::ResourceController provides most the standard
# behaviour, and in many cases this file may be left empty.
end
end
end
12 changes: 12 additions & 0 deletions app/controllers/api/v2/tube_rack_statuses_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

module Api
module V2
# Provides a JSON API controller for TubeRackStatus
# See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation
class TubeRackStatusesController < JSONAPI::ResourceController
# By default JSONAPI::ResourceController provides most the standard
# behaviour, and in many cases this file may be left empty.
end
end
end
2 changes: 1 addition & 1 deletion app/models/api/study_io.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ def render_class
map_attribute_to_json_attribute(:s3_email_list)
map_attribute_to_json_attribute(:data_deletion_period)
map_attribute_to_json_attribute(:contaminated_human_data_access_group)
with_association(:program, lookup_by: :id) { map_attribute_to_json_attribute(:name, 'program') }
with_association(:program, lookup_by: :id) { map_attribute_to_json_attribute(:name, 'programme') }
end
end
36 changes: 36 additions & 0 deletions app/models/tag_set.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# frozen_string_literal: true

# Links together two related tag groups - i7 and i5 - to represent a dual index tag set
# It can also be used to represent single index tag sets
# Background explained in Y24-170 (https://github.com/sanger/sequencescape/issues/4160)
class TagSet < ApplicationRecord
# For dual index tags, tag_group is i7 oligos and tag2_group is i5 oligos
belongs_to :tag_group, class_name: 'TagGroup', optional: false
belongs_to :tag2_group, class_name: 'TagGroup', optional: true

# We can assume adapter_type is the same for both tag groups
# But tag2_group may not be present so we delegate to tag_group
delegate :adapter_type, to: :tag_group

validates :name, presence: true, uniqueness: true
validate :tag_group_adapter_types_must_match

# Dynamic method to determine the visibility of a tag_set based on the visibility of its tag_groups
def visible
tag_group.visible && (tag2_group.nil? || tag2_group.visible)
end

# Method to determine that both tag groups have the same adapter type
def tag_group_adapter_types_must_match
return unless tag2_group && tag_group.adapter_type != tag2_group.adapter_type
errors.add(:tag_group, 'Adapter types of tag groups must match')
end

def tag_group_name=(name)
self.tag_group = TagGroup.find_by!(name: name)
end

def tag2_group_name=(name)
self.tag2_group = TagGroup.find_by!(name: name)
end
end
15 changes: 11 additions & 4 deletions app/resources/api/v2/aliquot_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@

module Api
module V2
# Provides a JSON API representation of aliquot
# See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation
# @todo This documentation does not yet include a detailed description of what this resource represents.
# @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters.
# @todo This documentation does not yet include any example usage of the API via cURL or similar.
#
# @note Access this resource via the `/api/v2/aliquots/` endpoint.
#
# Provides a JSON:API representation of {Aliquot}.
#
# For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/)
# or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation
# of the JSON:API standard.
class AliquotResource < BaseResource
# immutable # comment to make the resource mutable

default_includes :tag, :tag2

# Associations
Expand Down
25 changes: 17 additions & 8 deletions app/resources/api/v2/asset_audit_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,42 @@

module Api
module V2
# Provides a JSON API representation of AssetAudit
# See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation
# @todo This documentation does not yet include a detailed description of what this resource represents.
# @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters.
# @todo This documentation does not yet include any example usage of the API via cURL or similar.
#
# @note Access this resource via the `/api/v2/asset_audits/` endpoint.
#
# Provides a JSON:API representation of {AssetAudit}.
#
# For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/)
# or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation
# of the JSON:API standard.
class AssetAuditResource < BaseResource
model_name 'AssetAudit'

# @!attribute key
# @return [String] the key of the asset audit.
# @return [String] the key of the asset audit.
attribute :key

# @!attribute message
# @return [String] the message of the asset audit.
# @return [String] the message of the asset audit.
attribute :message

# @!attribute created_by
# @return [String] the user who created the asset audit.
# @return [String] the user who created the asset audit.
attribute :created_by

# @!attribute asset_uuid
# @return [String] the uuid of the asset associated with the asset audit.
# @return [String] the uuid of the asset associated with the asset audit.
attribute :asset_uuid

# @!attribute witnessed_by
# @return [String] the user who witnessed the asset audit.
# @return [String] the user who witnessed the asset audit.
attribute :witnessed_by

# @!attribute metadata
# @return [Hash] the metadata of the asset audit.
# @return [Hash] the metadata of the asset audit.
attribute :metadata # Currently known clients (AssetAudits app) are sending null; unsure of the expected format.

# Sets the Asset on the model using the UUID provided in the API create/update request.
Expand Down
12 changes: 11 additions & 1 deletion app/resources/api/v2/asset_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@

module Api
module V2
# AssetResource
# @todo This documentation does not yet include a detailed description of what this resource represents.
# @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters.
# @todo This documentation does not yet include any example usage of the API via cURL or similar.
#
# @note Access this resource via the `/api/v2/assets/` endpoint.
#
# Provides a JSON:API representation of {Asset}.
#
# For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/)
# or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation
# of the JSON:API standard.
class AssetResource < BaseResource
attributes :uuid

Expand Down
13 changes: 11 additions & 2 deletions app/resources/api/v2/base_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@

module Api
module V2
# Provides extensions to JSONAPI::Resource as well as global behaviour
# See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation
# @api V2
# @abstract
#
# @todo This documentation does not yet include complete descriptions of methods and what this class offers to its
# sub-classes.
#
# Provides a base class for JSON:API representations of {ApplicationRecord} sub-classes.
#
# For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/)
# or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation
# of the JSON:API standard.
class BaseResource < JSONAPI::Resource
abstract

Expand Down
15 changes: 11 additions & 4 deletions app/resources/api/v2/comment_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@

module Api
module V2
# Provides a JSON API representation of Comment
# See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation
# @todo This documentation does not yet include a detailed description of what this resource represents.
# @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters.
# @todo This documentation does not yet include any example usage of the API via cURL or similar.
#
# @note Access this resource via the `/api/v2/comments/` endpoint.
#
# Provides a JSON:API representation of {Comment}.
#
# For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/)
# or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation
# of the JSON:API standard.
class CommentResource < BaseResource
# Constants...

# immutable # uncomment to make the resource immutable

# model_name / model_hint if required

# Associations:
Expand Down
15 changes: 11 additions & 4 deletions app/resources/api/v2/custom_metadatum_collection_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@

module Api
module V2
# Provides a JSON API representation of custom_metadatum_collection
# See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation
# @todo This documentation does not yet include a detailed description of what this resource represents.
# @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters.
# @todo This documentation does not yet include any example usage of the API via cURL or similar.
#
# @note Access this resource via the `/api/v2/custom_metadatum_collections/` endpoint.
#
# Provides a JSON:API representation of {CustomMetadatumCollection}.
#
# For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/)
# or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation
# of the JSON:API standard.
class CustomMetadatumCollectionResource < BaseResource
# Constants...

# immutable # uncomment to make the resource immutable

# model_name / model_hint if required

default_includes :uuid_object, :custom_metadata
Expand Down
12 changes: 11 additions & 1 deletion app/resources/api/v2/fragment_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@

module Api
module V2
# Fragment
# @todo This documentation does not yet include a detailed description of what this resource represents.
# @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters.
# @todo This documentation does not yet include any example usage of the API via cURL or similar.
#
# @note Access this resource via the `/api/v2/fragments/` endpoint.
#
# Provides a JSON:API representation of {Fragment}.
#
# For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/)
# or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation
# of the JSON:API standard.
class FragmentResource < JSONAPI::Resource
attributes :uuid
end
Expand Down
12 changes: 11 additions & 1 deletion app/resources/api/v2/labware_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@

module Api
module V2
# LabwareResource
# @todo This documentation does not yet include a detailed description of what this resource represents.
# @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters.
# @todo This documentation does not yet include any example usage of the API via cURL or similar.
#
# @note Access this resource via the `/api/v2/labware/` endpoint.
#
# Provides a JSON:API representation of {Labware}.
#
# For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/)
# or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation
# of the JSON:API standard.
class LabwareResource < BaseResource
# We import most labware shared behaviour, this includes associations,
# attributes and filters. By adding behaviour here we ensure that it
Expand Down
16 changes: 13 additions & 3 deletions app/resources/api/v2/lane_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,22 @@

module Api
module V2
# Provides a JSON API representation of receptacle
# See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation
# @todo This documentation does not yet include a detailed description of what this resource represents.
# @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters.
# @todo This documentation does not yet include any example usage of the API via cURL or similar.
#
# @note This resource is immutable: its endpoint will not accept `POST`, `PATCH`, or `DELETE` requests.
# @note Access this resource via the `/api/v2/lanes/` endpoint.
#
# Provides a JSON:API representation of {Lane}.
#
# For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/)
# or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation
# of the JSON:API standard.
class LaneResource < BaseResource
# Constants...

immutable # comment to make the resource mutable
immutable

# Associations:
has_many :samples
Expand Down
15 changes: 11 additions & 4 deletions app/resources/api/v2/lot_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@

module Api
module V2
# Provides a JSON API representation of Lot
# See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation
# @todo This documentation does not yet include a detailed description of what this resource represents.
# @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters.
# @todo This documentation does not yet include any example usage of the API via cURL or similar.
#
# @note Access this resource via the `/api/v2/lots/` endpoint.
#
# Provides a JSON:API representation of {Lot}.
#
# For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/)
# or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation
# of the JSON:API standard.
class LotResource < BaseResource
# Constants...

# immutable # uncomment to make the resource immutable

# model_name / model_hint if required

default_includes :uuid_object
Expand Down
Loading

0 comments on commit a9a6713

Please sign in to comment.