Skip to content

Commit

Permalink
Schema version 6.1 (#659)
Browse files Browse the repository at this point in the history
Creates schemas with sub elements in Mediaflux::Http::SchemaFeildsCreateRequest
Creates the aterm script with sub elements
fills in the required new fields with data and updates the format of storage capacity
  • Loading branch information
carolyncole authored Apr 29, 2024
1 parent 2bf24ac commit 3ba81ed
Show file tree
Hide file tree
Showing 24 changed files with 687 additions and 219 deletions.
17 changes: 14 additions & 3 deletions app/models/mediaflux/http/asset_create_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def tigerdata_values_xml(xml)

element_name = @xml_namespace.nil? ? "project" : "#{@xml_namespace}:project"
xml.send(element_name) do
xml.Code @tigerdata_values[:code]
xml.ProjectDirectory @tigerdata_values[:project_directory]
xml.Title @tigerdata_values[:title]
xml.Description @tigerdata_values[:description] if @tigerdata_values[:description].present?
xml.Status @tigerdata_values[:status]
Expand All @@ -107,9 +107,20 @@ def tigerdata_values_xml(xml)
xml.CreatedOn @tigerdata_values[:created_on]
xml.CreatedBy @tigerdata_values[:created_by]
xml.ProjectID @tigerdata_values[:project_id]
xml.StorageCapacity @tigerdata_values[:storage_capacity]
xml.StoragePerformance @tigerdata_values[:storage_performance]
xml.StorageCapacity do
xml.Size @tigerdata_values[:storage_capacity][:size]
xml.Unit @tigerdata_values[:storage_capacity][:unit]
end
xml.Performance do
xml.parent.set_attribute("Requested", @tigerdata_values[:storage_performance])
xml.text(@tigerdata_values[:storage_performance])
end
xml.Submission do
xml.RequestedBy @tigerdata_values[:created_by]
xml.RequestDateTime @tigerdata_values[:created_on]
end
xml.ProjectPurpose @tigerdata_values[:project_purpose]
xml.SchemaVersion TigerdataSchema::SCHEMA_VERSION
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/mediaflux/http/asset_update_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def build_http_request_body(name:)

element_name = @xml_namespace.nil? ? "project" : "#{@xml_namespace}:project"
xml.send(element_name) do
xml.Code @tigerdata_values[:code]
xml.ProjectDirectory @tigerdata_values[:project_directory]
xml.Title @tigerdata_values[:title]
xml.Description @tigerdata_values[:description]
xml.DataSponsor @tigerdata_values[:data_sponsor]
Expand Down
4 changes: 4 additions & 0 deletions app/models/mediaflux/http/schema_fields_create_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def build_field(xml:, field:)
attributes = dup_field.delete(:attributes)
description = dup_field.delete(:description)
instructions = dup_field.delete(:instructions)
sub_elements = dup_field.delete(:sub_elements) || []
xml.element(dup_field) do
if attributes.present?
attributes.each do |attribute|
Expand All @@ -55,6 +56,9 @@ def build_field(xml:, field:)
if instructions.present?
xml.instructions instructions
end
sub_elements.each do |field|
build_field(xml:, field:)
end
end
end
end
Expand Down
7 changes: 5 additions & 2 deletions app/models/project_mediaflux.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ def self.format_date_for_mediaflux(iso8601_date)
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def self.project_values(project:)
split_capacity = project.metadata[:storage_capacity_requested]&.split(" ") || []
size = split_capacity[0]
unit = split_capacity[1]
values = {
code: project.directory,
project_directory: project.directory,
title: project.metadata[:title],
description: project.metadata[:description],
status: project.metadata[:status],
Expand All @@ -82,7 +85,7 @@ def self.project_values(project:)
updated_on: format_date_for_mediaflux(project.metadata[:updated_on]),
updated_by: project.metadata[:updated_by],
project_id: project.metadata[:project_id],
storage_capacity: project.metadata[:storage_capacity_requested],
storage_capacity: { size: , unit: },
storage_performance: project.metadata[:storage_performance_expectations_requested],
project_purpose: project.metadata[:project_purpose]
}
Expand Down
151 changes: 112 additions & 39 deletions app/models/tigerdata_schema.rb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/views/projects/_edit_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<div>
<h2>Project Description</h2>
<div class="description-container">
<div>Affiliated Departments:<br/>
<div>Departments:<br/>
<select id="departments" name="departments[]" required value class="form-select" multiple >
<% Affiliation.all.each do |affiliation| %>
<% if @project.departments.include?(affiliation[:code]) %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/projects/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Project Details:
<% end %>
</h2>
<dl>
<dt>Affiliated Departments</dt>
<dt>Departments</dt>
<% if @departments.empty? %>
<dd><strong class="px-0">None</strong></dd>
<% else %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/tigerdata_mailer/project_creation.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<dd><%= @project.metadata[:data_sponsor] %></dd>
<dt>Data Manager</dt>
<dd><%= @project.metadata[:data_manager] %></dd>
<dt>Affiliated Departments</dt>
<dt>Departments</dt>
<dd><%= @project.departments.join(", ") %></dd>
<dt>Project Directory</dt>
<dd><%= Rails.configuration.mediaflux["api_root_ns"] %>/<%= @project.metadata[:directory] %> </dd>
Expand Down
2 changes: 1 addition & 1 deletion app/views/tigerdata_mailer/project_creation.text.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Requesting User Netid: <%= @project.created_by_user.uid %>
Requesting User Name: <%= @project.created_by_user.display_name %>
Data Sponsor: <%= @project.metadata[:data_sponsor] %>
Data Manager: <%= @project.metadata[:data_manager] %>
Affiliated Departments: <%= @project.departments.join(", ") %>
Departments: <%= @project.departments.join(", ") %>
Project Directory: <%= Rails.configuration.mediaflux["api_root_ns"] %>/<%= @project.metadata[:directory] %>
Title: <%= @project.metadata[:title] %>
Description: <%= @project.metadata[:description] %>
Expand Down
2 changes: 1 addition & 1 deletion architecture-decisions/0005-practicle-limits-to-text.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Discussion

## Context

We need to set some practical limits for project metadata fields, not only for initial testing purposes, but also for the sustainability of inter-operating systems at scale. It is, of course, impossible to allow infinite text to be input into free-text fields (such as "Description") or infinite repetition of fields with cardinality of 0-n (such as "Data User") or 1-n (such as "Affiliated Department"). There is guidance from DataCite on practical limits of some fields (such as [contributors, which can handle 8 - 10 thousand repetitions](https://support.datacite.org/docs/datacite-metadata-schema-v44-recommended-and-optional-properties#7-contributor)), but DataCite does not specify limits for every field, and we need to have our own limits for our own infrastructure anyway.
We need to set some practical limits for project metadata fields, not only for initial testing purposes, but also for the sustainability of inter-operating systems at scale. It is, of course, impossible to allow infinite text to be input into free-text fields (such as "Description") or infinite repetition of fields with cardinality of 0-n (such as "Data User") or 1-n (such as "Department"). There is guidance from DataCite on practical limits of some fields (such as [contributors, which can handle 8 - 10 thousand repetitions](https://support.datacite.org/docs/datacite-metadata-schema-v44-recommended-and-optional-properties#7-contributor)), but DataCite does not specify limits for every field, and we need to have our own limits for our own infrastructure anyway.

To begin, we want limits that we expect to meet the needs of most users and that we feel comfortable testing at scale. If we change the limits, from a user perspective, it is much worse to decrease them than to increase them. From a technical perspective, it makes more sense to try to improve infrastructure to increase metadata capacity than it does to scramble to limit metadata due to performance issues.

Expand Down
Loading

0 comments on commit 3ba81ed

Please sign in to comment.