From 80860f18e5d29ee07744b8e1a43b0cf42632c8b8 Mon Sep 17 00:00:00 2001 From: mjy Date: Tue, 17 Sep 2024 14:45:56 -0500 Subject: [PATCH 01/25] Remove duplicate validation call --- app/models/collecting_event.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/models/collecting_event.rb b/app/models/collecting_event.rb index b9e2bd4c49..31c1753164 100644 --- a/app/models/collecting_event.rb +++ b/app/models/collecting_event.rb @@ -256,7 +256,6 @@ class CollectingEvent < ApplicationRecord :check_elevation_range, :check_min_land_elevation, :check_max_land_elevation, - :check_date_range, :check_ma_range validates_uniqueness_of :md5_of_verbatim_label, scope: [:project_id], unless: -> { verbatim_label.blank? } From 009265546e3f41f2ec2806a521b900a93556f4d4 Mon Sep 17 00:00:00 2001 From: Tom Klein Date: Wed, 18 Sep 2024 09:51:03 -0500 Subject: [PATCH 02/25] Deal with some UI exceptions --- .../components/ModalGraph.vue | 6 ++++-- .../composer/components/Properties/NewProperty.vue | 12 +++++++----- .../tasks/sources/new_source/components/bibtex.vue | 6 ++++-- .../tasks/sources/new_source/components/crossRef.vue | 4 +++- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/javascript/vue/tasks/biological_associations/biological_associations_graph/components/ModalGraph.vue b/app/javascript/vue/tasks/biological_associations/biological_associations_graph/components/ModalGraph.vue index ee8975374a..6ed1e2ac43 100644 --- a/app/javascript/vue/tasks/biological_associations/biological_associations_graph/components/ModalGraph.vue +++ b/app/javascript/vue/tasks/biological_associations/biological_associations_graph/components/ModalGraph.vue @@ -26,7 +26,7 @@ diff --git a/app/javascript/vue/tasks/biological_relationships/composer/components/Properties/NewProperty.vue b/app/javascript/vue/tasks/biological_relationships/composer/components/Properties/NewProperty.vue index 16a061bd71..63ae1deceb 100644 --- a/app/javascript/vue/tasks/biological_relationships/composer/components/Properties/NewProperty.vue +++ b/app/javascript/vue/tasks/biological_relationships/composer/components/Properties/NewProperty.vue @@ -90,11 +90,13 @@ export default { controlled_vocabulary_term: this.controlVocabularyTerm }) - saveRecord.then((response) => { - this.$emit('save', response.body) - this.showModal = false - this.controlVocabularyTerm = this.resetCVT() - }) + saveRecord + .then((response) => { + this.$emit('save', response.body) + this.showModal = false + this.controlVocabularyTerm = this.resetCVT() + }) + .catch(() => {}) }, resetCVT() { diff --git a/app/javascript/vue/tasks/sources/new_source/components/bibtex.vue b/app/javascript/vue/tasks/sources/new_source/components/bibtex.vue index faaf3a62d3..c09bf44396 100644 --- a/app/javascript/vue/tasks/sources/new_source/components/bibtex.vue +++ b/app/javascript/vue/tasks/sources/new_source/components/bibtex.vue @@ -51,7 +51,7 @@ import setParam from '@/helpers/setParam' import { MutationNames } from '../store/mutations/mutations' import { ActionNames } from '../store/actions/actions' import { Source, Serial } from '@/routes/endpoints' -import { ref, onMounted } from 'vue' +import { ref, nextTick, onMounted } from 'vue' import { useStore } from 'vuex' const emit = defineEmits(['close']) @@ -62,7 +62,9 @@ const textareaRef = ref(null) const store = useStore() onMounted(() => { - textareaRef.value.focus() + nextTick(() => { + textareaRef.value.focus() + }) }) function createSource() { diff --git a/app/javascript/vue/tasks/sources/new_source/components/crossRef.vue b/app/javascript/vue/tasks/sources/new_source/components/crossRef.vue index 0d16c3fe15..d1c1d48d19 100644 --- a/app/javascript/vue/tasks/sources/new_source/components/crossRef.vue +++ b/app/javascript/vue/tasks/sources/new_source/components/crossRef.vue @@ -100,7 +100,9 @@ export default { }, mounted() { - this.$refs.textareaRef.focus() + this.$nextTick(() => { + this.$refs.textareaRef.focus() + }) }, methods: { From 99c4a83509b00ee20b7944d2d41a23e9dbc6015f Mon Sep 17 00:00:00 2001 From: mjy Date: Wed, 18 Sep 2024 15:43:22 -0500 Subject: [PATCH 03/25] Spec that identifiers are not also recorded as verbatim --- spec/models/dataset_record/darwin_core/occurrence_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/models/dataset_record/darwin_core/occurrence_spec.rb b/spec/models/dataset_record/darwin_core/occurrence_spec.rb index ba5ac951de..43adc5deb8 100644 --- a/spec/models/dataset_record/darwin_core/occurrence_spec.rb +++ b/spec/models/dataset_record/darwin_core/occurrence_spec.rb @@ -132,6 +132,10 @@ it 'attached FieldNumber to CollectingEvent' do expect(Identifier::Local::FieldNumber.first.identifier_object).to be_kind_of(CollectingEvent) end + + it 'does not populate verbatim fields by default' do + expect(CollectingEvent.first.verbatim_trip_identifier).to eq(nil) + end end # TODO: Check that `TW:CollectingEvent:verbatim_locality' alone will create a CE (see tsv) From dec4c03b0c8c38f26373e47092130074c1cebe0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20Lucas=20Pereira?= Date: Wed, 18 Sep 2024 18:01:54 -0300 Subject: [PATCH 04/25] Stop populating verbatim_trip_identifier with fieldIdentifier data --- app/models/dataset_record/darwin_core/occurrence.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/models/dataset_record/darwin_core/occurrence.rb b/app/models/dataset_record/darwin_core/occurrence.rb index 60be22d575..4a1fcba4fe 100644 --- a/app/models/dataset_record/darwin_core/occurrence.rb +++ b/app/models/dataset_record/darwin_core/occurrence.rb @@ -297,7 +297,6 @@ def import(dwc_data_attributes = {}) # # New rules: # * No overlapping intended meanings, each maps to itself - # * verbatim_trip_identifier should look exactly like the (fully) defined fieldNumber (remember use of virtual attribute in Namespace to render without namespace string) # event_id, field_number = get_field_value(:eventID), get_field_value(:fieldNumber) collecting_event_identifiers = [] @@ -356,8 +355,6 @@ def import(dwc_data_attributes = {}) field_number_namespace = Namespace.find_by(Namespace.arel_table[:short_name].matches(field_number_namespace)) # Case insensitive match raise DarwinCore::InvalidData.new({ 'TW:Namespace:fieldNumber' => ['Namespace not found'] }) unless field_number_namespace - verbatim_trip_identifier = "#{field_number_namespace.is_virtual ? '': Identifier::Local.build_cached_prefix(field_number_namespace)}#{field_number}" - attributes[:collecting_event][:verbatim_trip_identifier] ||= verbatim_trip_identifier identifier_attributes[:namespace] = field_number_namespace field_number_identifier = Identifier::Local::FieldNumber.find_by(identifier_attributes) From 578ab802a6abc911b66c9fb35774aa781577f59f Mon Sep 17 00:00:00 2001 From: jlpereira Date: Wed, 18 Sep 2024 18:35:31 -0300 Subject: [PATCH 05/25] Add new category to new otu task --- config/interface/hub/user_tasks.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/interface/hub/user_tasks.yml b/config/interface/hub/user_tasks.yml index 44fac753c5..3ef505faf9 100644 --- a/config/interface/hub/user_tasks.yml +++ b/config/interface/hub/user_tasks.yml @@ -893,6 +893,7 @@ new_otu_task: related: categories: - otu + - new status: prototype description: 'Create one or many OTUs in batch.' leads_hub_task: From 56aa6855b1d0b2e5836cc1f8cef047de31b02594 Mon Sep 17 00:00:00 2001 From: jlpereira Date: Wed, 18 Sep 2024 18:35:46 -0300 Subject: [PATCH 06/25] Add task links to dwca importer --- app/javascript/vue/tasks/dwca_import/app.vue | 160 ++++++++----------- 1 file changed, 71 insertions(+), 89 deletions(-) diff --git a/app/javascript/vue/tasks/dwca_import/app.vue b/app/javascript/vue/tasks/dwca_import/app.vue index e484b46286..757d545f55 100644 --- a/app/javascript/vue/tasks/dwca_import/app.vue +++ b/app/javascript/vue/tasks/dwca_import/app.vue @@ -1,122 +1,104 @@ - diff --git a/app/javascript/vue/tasks/observation_matrices/new/components/Matrix/MatrixParent.vue b/app/javascript/vue/tasks/observation_matrices/new/components/Matrix/MatrixParent.vue new file mode 100644 index 0000000000..53218a2913 --- /dev/null +++ b/app/javascript/vue/tasks/observation_matrices/new/components/Matrix/MatrixParent.vue @@ -0,0 +1,60 @@ + + + diff --git a/app/javascript/vue/tasks/observation_matrices/new/components/newMatrix/switch.vue b/app/javascript/vue/tasks/observation_matrices/new/components/Matrix/switch.vue similarity index 100% rename from app/javascript/vue/tasks/observation_matrices/new/components/newMatrix/switch.vue rename to app/javascript/vue/tasks/observation_matrices/new/components/Matrix/switch.vue diff --git a/app/javascript/vue/tasks/observation_matrices/new/components/newMatrix/newMatrix.vue b/app/javascript/vue/tasks/observation_matrices/new/components/newMatrix/newMatrix.vue deleted file mode 100644 index 78a6b0e98f..0000000000 --- a/app/javascript/vue/tasks/observation_matrices/new/components/newMatrix/newMatrix.vue +++ /dev/null @@ -1,132 +0,0 @@ - - - diff --git a/app/javascript/vue/tasks/observation_matrices/new/components/rows/copyRows.vue b/app/javascript/vue/tasks/observation_matrices/new/components/rows/copyRows.vue index 9a619b8806..42245a07ee 100644 --- a/app/javascript/vue/tasks/observation_matrices/new/components/rows/copyRows.vue +++ b/app/javascript/vue/tasks/observation_matrices/new/components/rows/copyRows.vue @@ -1,267 +1,228 @@ - diff --git a/app/javascript/vue/tasks/observation_matrices/new/components/tables/view.vue b/app/javascript/vue/tasks/observation_matrices/new/components/tables/view.vue index 4e6df3f380..c0160050f8 100644 --- a/app/javascript/vue/tasks/observation_matrices/new/components/tables/view.vue +++ b/app/javascript/vue/tasks/observation_matrices/new/components/tables/view.vue @@ -5,60 +5,64 @@ :gap="4" >
- -
- -
- diff --git a/app/javascript/vue/tasks/observation_matrices/new/request/resources.js b/app/javascript/vue/tasks/observation_matrices/new/request/resources.js index 59d156b139..ae554e8756 100644 --- a/app/javascript/vue/tasks/observation_matrices/new/request/resources.js +++ b/app/javascript/vue/tasks/observation_matrices/new/request/resources.js @@ -81,14 +81,6 @@ const GetSmartSelector = function (type) { }) } -const SortRows = function (ids) { - return ajaxCall('patch', `/observation_matrix_rows/sort`, { ids: ids }) -} - -const SortColumns = function (ids) { - return ajaxCall('patch', `/observation_matrix_columns/sort`, { ids: ids }) -} - const SortMatrixByNomenclature = (matrixId) => ajaxCall('get', `/observation_matrices/${matrixId}/reorder_rows`, { params: { by: 'nomenclature' } @@ -105,7 +97,5 @@ export { GetMatrixRowMetadata, BatchRemoveKeyword, GetSmartSelector, - SortColumns, - SortMatrixByNomenclature, - SortRows + SortMatrixByNomenclature } diff --git a/app/javascript/vue/tasks/observation_matrices/new/store/actions/actionNames.js b/app/javascript/vue/tasks/observation_matrices/new/store/actions/actionNames.js index 166be56f2c..346e9feb83 100644 --- a/app/javascript/vue/tasks/observation_matrices/new/store/actions/actionNames.js +++ b/app/javascript/vue/tasks/observation_matrices/new/store/actions/actionNames.js @@ -8,7 +8,7 @@ const ActionNames = { GetMatrixObservationColumnsDynamic: 'getMatrixObservationColumnsDynamic', RemoveRow: 'removeRow', RemoveColumn: 'removeColumn', - UpdateMatrix: 'updateMatrix' + SaveMatrix: 'saveMatrix' } export default ActionNames diff --git a/app/javascript/vue/tasks/observation_matrices/new/store/actions/actions.js b/app/javascript/vue/tasks/observation_matrices/new/store/actions/actions.js index 226dd70179..2b7109f658 100644 --- a/app/javascript/vue/tasks/observation_matrices/new/store/actions/actions.js +++ b/app/javascript/vue/tasks/observation_matrices/new/store/actions/actions.js @@ -8,7 +8,7 @@ import getMatrixObservationColumnsDynamic from './loadColumnDynamicItems' import loadMatrix from './loadMatrix' import removeRow from './removeRow' import removeColumn from './removeColumn' -import updateMatrix from './updateMatrix' +import saveMatrix from './saveMatrix' const ActionFunctions = { [ActionNames.CreateRowItem]: createRowItem, @@ -20,7 +20,7 @@ const ActionFunctions = { [ActionNames.GetMatrixObservationColumnsDynamic]: getMatrixObservationColumnsDynamic, [ActionNames.RemoveRow]: removeRow, [ActionNames.RemoveColumn]: removeColumn, - [ActionNames.UpdateMatrix]: updateMatrix + [ActionNames.SaveMatrix]: saveMatrix } export { ActionNames, ActionFunctions } \ No newline at end of file diff --git a/app/javascript/vue/tasks/observation_matrices/new/store/actions/saveMatrix.js b/app/javascript/vue/tasks/observation_matrices/new/store/actions/saveMatrix.js new file mode 100644 index 0000000000..bcf1161b2d --- /dev/null +++ b/app/javascript/vue/tasks/observation_matrices/new/store/actions/saveMatrix.js @@ -0,0 +1,24 @@ +import { ObservationMatrix } from '@/routes/endpoints' + +export default ({ state }) => { + const payload = { + observation_matrix: { + id: state.matrix.id, + name: state.matrix.name, + otu_id: state.matrix.otu_id + } + } + + const request = state.matrix.id + ? ObservationMatrix.update(state.matrix.id, payload) + : ObservationMatrix.create(payload) + + request + .then(({ body }) => { + TW.workbench.alert.create('Matrix was successfully saved.', 'notice') + state.matrix = body + }) + .catch(() => {}) + + return request +} diff --git a/app/javascript/vue/tasks/observation_matrices/new/store/actions/updateMatrix.js b/app/javascript/vue/tasks/observation_matrices/new/store/actions/updateMatrix.js deleted file mode 100644 index 5c30daeaf2..0000000000 --- a/app/javascript/vue/tasks/observation_matrices/new/store/actions/updateMatrix.js +++ /dev/null @@ -1,16 +0,0 @@ -import { ObservationMatrix } from '@/routes/endpoints' - -export default ({ state }) => - new Promise((resolve, reject) => { - const data = { - id: state.matrix.id, - name: state.matrix.name - } - - ObservationMatrix.update(state.matrix.id, { - observation_matrix: data - }).then((response) => { - TW.workbench.alert.create('Matrix was successfully updated.', 'notice') - return resolve(response.body) - }) - }) diff --git a/app/javascript/vue/tasks/observation_matrices/new/store/store.js b/app/javascript/vue/tasks/observation_matrices/new/store/store.js index 5dfd3472f8..a0ff60c3c2 100644 --- a/app/javascript/vue/tasks/observation_matrices/new/store/store.js +++ b/app/javascript/vue/tasks/observation_matrices/new/store/store.js @@ -3,7 +3,7 @@ import { GetterFunctions } from './getters/getters' import { MutationFunctions } from './mutations/mutations' import { ActionFunctions } from './actions/actions' -function makeInitialState () { +function makeInitialState() { return { settings: { loadingRows: false, @@ -17,6 +17,7 @@ function makeInitialState () { matrix: { id: undefined, name: undefined, + otu_id: undefined, project_id: undefined, global_id: undefined }, @@ -31,7 +32,7 @@ function makeInitialState () { } } -function newStore () { +function newStore() { return createStore({ state: makeInitialState(), getters: GetterFunctions, @@ -40,6 +41,4 @@ function newStore () { }) } -export { - newStore -} +export { newStore } diff --git a/app/javascript/vue/tasks/otus/new_otu/components/TaxonNameSelector.vue b/app/javascript/vue/tasks/otus/new_otu/components/TaxonNameSelector.vue index a8f118c916..88a93c4820 100644 --- a/app/javascript/vue/tasks/otus/new_otu/components/TaxonNameSelector.vue +++ b/app/javascript/vue/tasks/otus/new_otu/components/TaxonNameSelector.vue @@ -35,7 +35,7 @@ import BlockLayout from '@/components/layout/BlockLayout.vue' import { TaxonName } from '@/routes/endpoints' import SmartSelectorItem from '@/components/ui/SmartSelectorItem.vue' import VAutocomplete from '@/components/ui/Autocomplete.vue' -import VToggle from '@/tasks/observation_matrices/new/components/newMatrix/switch.vue' +import VToggle from '@/tasks/observation_matrices/new/components/Matrix/switch.vue' const isMatch = defineModel('match', { type: Boolean, diff --git a/app/javascript/vue/tasks/people/filter/components/Facet/FacetProjects.vue b/app/javascript/vue/tasks/people/filter/components/Facet/FacetProjects.vue index 9b5a3ac249..0c50a1240b 100644 --- a/app/javascript/vue/tasks/people/filter/components/Facet/FacetProjects.vue +++ b/app/javascript/vue/tasks/people/filter/components/Facet/FacetProjects.vue @@ -41,7 +41,7 @@ import { ref, computed, watch, onBeforeMount } from 'vue' import { User } from '@/routes/endpoints' import { getCurrentUserId } from '@/helpers/user.js' import { getCurrentProjectId } from '@/helpers/project.js' -import VToggle from '@/tasks/observation_matrices/new/components/newMatrix/switch.vue' +import VToggle from '@/tasks/observation_matrices/new/components/Matrix/switch.vue' import FacetContainer from '@/components/Filter/Facets/FacetContainer.vue' const props = defineProps({ diff --git a/app/views/observation_matrices/_attributes.json.jbuilder b/app/views/observation_matrices/_attributes.json.jbuilder index f293510ebe..6b9d26465e 100644 --- a/app/views/observation_matrices/_attributes.json.jbuilder +++ b/app/views/observation_matrices/_attributes.json.jbuilder @@ -1,4 +1,4 @@ -json.extract! observation_matrix, :id, :name, :created_by_id, :updated_by_id, :project_id, :created_at, :updated_at +json.extract! observation_matrix, :id, :name, :otu_id, :created_by_id, :updated_by_id, :project_id, :created_at, :updated_at json.partial! '/shared/data/all/metadata', object: observation_matrix json.is_media_matrix observation_matrix.is_media_matrix? From 647740d40a94f7d9afcee7529923e2c6ad522ae2 Mon Sep 17 00:00:00 2001 From: jlpereira Date: Mon, 23 Sep 2024 17:44:28 -0300 Subject: [PATCH 11/25] Add missing facet to observation matrix filter --- lib/queries/observation_matrix/filter.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/queries/observation_matrix/filter.rb b/lib/queries/observation_matrix/filter.rb index e13456693c..4e77b47f8d 100644 --- a/lib/queries/observation_matrix/filter.rb +++ b/lib/queries/observation_matrix/filter.rb @@ -34,7 +34,9 @@ def otu_id_facet end def and_clauses - [ ] + [ + otu_id_facet + ] end end From 0185b2a1bc7748a459a89882474278cf43659ac0 Mon Sep 17 00:00:00 2001 From: mjy Date: Mon, 23 Sep 2024 16:07:19 -0500 Subject: [PATCH 12/25] Add /api/v1/otus/:id/inventory/keys metadata endpoint --- CHANGELOG.md | 2 +- app/controllers/otus_controller.rb | 7 ++++++- app/helpers/otus_helper.rb | 13 +++++++++++++ app/models/observation_matrix.rb | 3 ++- app/models/otu.rb | 2 ++ app/views/observation_matrices/_attributes.html.erb | 5 +++++ config/routes/api_v1.rb | 1 + 7 files changed, 30 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b0d55ceb4..45259a380e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,9 @@ This project does not yet adheres to [Semantic Versioning](https://semv ## [unreleased] - ### Added +- `/api/v1/otus/:id/inventory/keys` a list of keys scoped to or containing the Otu - `otu_id` to ObservationMatrix, to facilitate setting scope and indexing of multi-entry keys ## [0.44.0] - 2024-09-17 diff --git a/app/controllers/otus_controller.rb b/app/controllers/otus_controller.rb index d95138454c..4080595dca 100644 --- a/app/controllers/otus_controller.rb +++ b/app/controllers/otus_controller.rb @@ -5,7 +5,7 @@ class OtusController < ApplicationController :show, :edit, :update, :destroy, :collection_objects, :navigation, :breadcrumbs, :timeline, :coordinate, :distribution, :api_show, :api_taxonomy_inventory, :api_type_material_inventory, - :api_nomenclature_citations, :api_distribution, :api_content, :api_dwc_inventory, :api_dwc_gallery ] + :api_nomenclature_citations, :api_distribution, :api_content, :api_dwc_inventory, :api_dwc_gallery, :api_key_inventory ] after_action -> { set_pagination_headers(:otus) }, only: [:index, :api_index], if: :json_request? @@ -313,6 +313,11 @@ def api_autocomplete render '/otus/api/v1/autocomplete' end + # GET /api/v1/otus/:id/inventory/keys + def api_key_inventory + render json: helpers.otu_key_inventory(@otu) + end + # GET /api/v1/otus/:id/inventory/taxonomy def api_taxonomy_inventory render '/otus/api/v1/inventory/taxonomy' diff --git a/app/helpers/otus_helper.rb b/app/helpers/otus_helper.rb index e5ec52f557..4a0612c737 100644 --- a/app/helpers/otus_helper.rb +++ b/app/helpers/otus_helper.rb @@ -348,4 +348,17 @@ def dwc_gallery_data(otu) r end + def otu_key_inventory(otu) + return { + observation_matrices: { + scoped: otu.in_scope_observation_matrices.pluck(:id) || [] , + in: otu.observation_matrices.pluck(:id) || [] , + }, + leads: { + scoped: otu.leads.where(parent_id: nil).pluck(:id) || [], + in: otu.leads.where.not(parent_id: nil).pluck(:id) || [], + } + } + end + end diff --git a/app/models/observation_matrix.rb b/app/models/observation_matrix.rb index d11d185f14..f1096ad92a 100644 --- a/app/models/observation_matrix.rb +++ b/app/models/observation_matrix.rb @@ -23,7 +23,8 @@ class ObservationMatrix < ApplicationRecord validates_presence_of :name validates_uniqueness_of :name, scope: [:project_id] - belongs_to :otu, inverse_of: :observation_matrices + # We can not inverse: `observation_matrices` as that comes from row content. + belongs_to :otu, inverse_of: :in_scope_observation_matrices has_many :observation_matrix_column_items, dependent: :delete_all, inverse_of: :observation_matrix has_many :observation_matrix_row_items, dependent: :delete_all, inverse_of: :observation_matrix diff --git a/app/models/otu.rb b/app/models/otu.rb index e4a4f32781..6f47ba04e6 100644 --- a/app/models/otu.rb +++ b/app/models/otu.rb @@ -59,6 +59,8 @@ class Otu < ApplicationRecord # Why? Could be combination too. belongs_to :protonym, -> { where(type: 'Protonym') }, foreign_key: :taxon_name_id + has_many :in_scope_observation_matrices, inverse_of: :otu, class_name: 'ObservationMatrix' + has_many :asserted_distributions, inverse_of: :otu, dependent: :restrict_with_error has_many :taxon_determinations, inverse_of: :otu, dependent: :destroy # TODO: change diff --git a/app/views/observation_matrices/_attributes.html.erb b/app/views/observation_matrices/_attributes.html.erb index a86cc94f65..c18096dfde 100644 --- a/app/views/observation_matrices/_attributes.html.erb +++ b/app/views/observation_matrices/_attributes.html.erb @@ -3,3 +3,8 @@ <%= @observation_matrix.name %>

+

+ Otu (parent/scoping): + <%= otu_link(@observation_matrix.otu) %> +

+ diff --git a/config/routes/api_v1.rb b/config/routes/api_v1.rb index c9508b9941..0ff0633a46 100644 --- a/config/routes/api_v1.rb +++ b/config/routes/api_v1.rb @@ -46,6 +46,7 @@ get '/otus/autocomplete', to: '/otus#api_autocomplete' get '/otus/:id/inventory/content', to: '/otus#api_content', as: :api_content get '/otus/:id/inventory/distribution', to: '/otus#api_distribution', as: :api_distribution + get '/otus/:id/inventory/keys', to: '/otus#api_key_inventory', as: :key_inventory get '/otus/:id/inventory/taxonomy', to: '/otus#api_taxonomy_inventory', as: :taxonomy_inventory get '/otus/:otu_id/inventory/images', to: '/images#api_image_inventory', as: :images_inventory get '/otus/:id/inventory/dwc_gallery', to: '/otus#api_dwc_gallery', as: :dwc_inventory_gallery From b8c054503f2153bca30d786a809787b56e8748aa Mon Sep 17 00:00:00 2001 From: mjy Date: Mon, 23 Sep 2024 16:33:00 -0500 Subject: [PATCH 13/25] Rename verbatim_trip_code to verbatim_field_number #4058 --- CHANGELOG.md | 7 +++++ .../vue/adapters/makeCollectingEvent.js | 2 +- .../payload/makeCollectionObjectPayload.js | 2 +- .../components/map/PrintLabel.vue | 2 +- .../components/verbatim/TripIdentifier.vue | 2 +- .../FormCollectingEvent/const/components.js | 6 ++-- .../helpers/verbatimProperties.js | 2 +- .../radials/ce/components/VerbatimSlice.vue | 2 +- app/javascript/vue/factory/CollectingEvent.js | 2 +- .../vue/routes/endpoints/CollectingEvents.js | 2 +- .../Filter/constants/collectingEvent.js | 2 +- .../components/map/PrintLabel.vue | 2 +- .../components/verbatim/TripIdentifier.vue | 2 +- .../new_collecting_event/const/components.js | 6 ++-- .../helpers/verbatimProperties.js | 2 +- .../filter/constants/layouts.js | 2 +- .../components/map/printLabel.vue | 2 +- .../components/verbatim/tripIdentifier.vue | 2 +- .../vue/tasks/digitize/const/components.js | 6 ++-- app/models/collecting_event.rb | 18 ++++++------ .../collection_object/dwc_extensions.rb | 2 +- .../dataset_record/darwin_core/occurrence.rb | 8 +++--- app/models/identifier/local/field_number.rb | 4 +-- .../collecting_events/_attributes.html.erb | 2 +- .../_attributes.json.jbuilder | 2 +- app/views/collecting_events/_card.html.erb | 4 +-- app/views/collecting_events/_form.html.erb | 8 +++--- .../api/v1/_attributes.json.jbuilder | 28 +++++++++---------- app/views/collecting_events/list.html.erb | 4 +-- ...ame_collecting_event_verbatim_trip_code.rb | 7 +++++ db/schema.rb | 4 +-- lib/batch_load/import/collection_objects.rb | 2 +- lib/queries/collecting_event/autocomplete.rb | 6 ++-- .../collecting_event/autocomplete_spec.rb | 6 ++-- .../queries/collecting_event/filter_spec.rb | 2 +- .../queries/collection_object/filter_spec.rb | 2 +- spec/lib/queries/concerns/attributes_spec.rb | 2 +- spec/models/collecting_event_spec.rb | 6 ++-- .../darwin_core/occurrence_spec.rb | 2 +- .../identifier/local/field_number_spec.rb | 8 +++--- 40 files changed, 97 insertions(+), 85 deletions(-) create mode 100644 db/migrate/20240923211118_rename_collecting_event_verbatim_trip_code.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 45259a380e..4e1715dfaa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,13 @@ This project does not yet adheres to [Semantic Versioning](https://semv - `/api/v1/otus/:id/inventory/keys` a list of keys scoped to or containing the Otu - `otu_id` to ObservationMatrix, to facilitate setting scope and indexing of multi-entry keys +### Changed + +- Renamed CollectingEvent `verbatim_trip_code` to `verbatim_field_number` [#4058] + +[#4058]: https://github.com/SpeciesFileGroup/taxonworks/issues/4058 + + ## [0.44.0] - 2024-09-17 ### Added diff --git a/app/javascript/vue/adapters/makeCollectingEvent.js b/app/javascript/vue/adapters/makeCollectingEvent.js index 65eea25e34..dfd136e7a7 100644 --- a/app/javascript/vue/adapters/makeCollectingEvent.js +++ b/app/javascript/vue/adapters/makeCollectingEvent.js @@ -11,7 +11,7 @@ export function makeCollectingEvent (ceData = {}) { verbatimLongitude: ceData.verbatim_longitude, verbatimLatitude: ceData.verbatim_latitude, verbatimGeolocationUncertainty: ceData.verbatim_geolocation_uncertainty, - verbatimTripIdentifier: ceData.verbatim_trip_identifier, + verbatimFieldNumber: ceData.verbatim_field_number, verbatimCollectors: ceData.verbatim_collectors, verbatimMethod: ceData.verbatim_method, verbatimHabitat: ceData.verbatim_habitat, diff --git a/app/javascript/vue/adapters/payload/makeCollectionObjectPayload.js b/app/javascript/vue/adapters/payload/makeCollectionObjectPayload.js index 0c9907040b..1c1e3d8616 100644 --- a/app/javascript/vue/adapters/payload/makeCollectionObjectPayload.js +++ b/app/javascript/vue/adapters/payload/makeCollectionObjectPayload.js @@ -10,7 +10,7 @@ export function makeCollectingEventPayload (ceData) { verbatim_longitude: ceData.verbatimLongitude, verbatim_latitude: ceData.verbatimLatitude, verbatim_geolocation_uncertainty: ceData.verbatimGeolocationUncertainty, - verbatim_trip_identifier: ceData.verbatimTripIdentifier, + verbatim_field_number: ceData.verbatimFieldNumber, verbatim_collectors: ceData.verbatimCollectors, verbatim_method: ceData.verbatimMethod, verbatim_habitat: ceData.verbatimHabitat, diff --git a/app/javascript/vue/components/Form/FormCollectingEvent/components/map/PrintLabel.vue b/app/javascript/vue/components/Form/FormCollectingEvent/components/map/PrintLabel.vue index 561751a141..fcd152d438 100644 --- a/app/javascript/vue/components/Form/FormCollectingEvent/components/map/PrintLabel.vue +++ b/app/javascript/vue/components/Form/FormCollectingEvent/components/map/PrintLabel.vue @@ -112,7 +112,7 @@ function generateLabel() { ...generateParsedLabel() ) - const AtStart = ['TripIdentifier', 'TripCode'] + const AtStart = ['FieldNumber', 'TripCode'] const sortedObjectLabelKeys = sortArrayByArray( Object.keys(objectLabels), diff --git a/app/javascript/vue/components/Form/FormCollectingEvent/components/verbatim/TripIdentifier.vue b/app/javascript/vue/components/Form/FormCollectingEvent/components/verbatim/TripIdentifier.vue index 6858cd6358..e3f1dce4e3 100644 --- a/app/javascript/vue/components/Form/FormCollectingEvent/components/verbatim/TripIdentifier.vue +++ b/app/javascript/vue/components/Form/FormCollectingEvent/components/verbatim/TripIdentifier.vue @@ -5,7 +5,7 @@ class="full_width" type="text" rows="3" - v-model="collectingEvent.verbatim_trip_identifier" + v-model="collectingEvent.verbatim_field_number" @change="() => { collectingEvent.isUnsaved = true }" /> diff --git a/app/javascript/vue/components/Form/FormCollectingEvent/const/components.js b/app/javascript/vue/components/Form/FormCollectingEvent/const/components.js index 9d9a2ad58e..6deac717ca 100644 --- a/app/javascript/vue/components/Form/FormCollectingEvent/const/components.js +++ b/app/javascript/vue/components/Form/FormCollectingEvent/const/components.js @@ -8,7 +8,7 @@ import Latitude from '../components/verbatim/Latitude.vue' import Locality from '../components/verbatim/Locality.vue' import Longitude from '../components/verbatim/Longitude.vue' import Method from '../components/verbatim/Method.vue' -import TripIdentifier from '../components/verbatim/TripIdentifier.vue' +import FieldNumber from '../components/verbatim/FieldNumber.vue' import Dates from '../components/parsed/Dates.vue' import Elevation from '../components/parsed/Elevation.vue' import GeographicArea from '../components/parsed/GeographicArea.vue' @@ -36,7 +36,7 @@ const ComponentVerbatim = { Datum: 'Datum', Collectors: 'Collectors', Method: 'Method', - TripIdentifier: 'TripIdentifier' + FieldNumber: 'FieldNumber' } const ComponentParse = { @@ -70,7 +70,7 @@ const VueComponents = { [ComponentVerbatim.VerbatimElevation]: VerbatimElevation, [ComponentVerbatim.Datum]: Datum, [ComponentVerbatim.Method]: Method, - [ComponentVerbatim.TripIdentifier]: TripIdentifier, + [ComponentVerbatim.FieldNumber]: FieldNumber, [ComponentParse.Dates]: Dates, [ComponentParse.Elevation]: Elevation, [ComponentParse.GeographicArea]: GeographicArea, diff --git a/app/javascript/vue/components/Form/FormCollectingEvent/helpers/verbatimProperties.js b/app/javascript/vue/components/Form/FormCollectingEvent/helpers/verbatimProperties.js index 66235bc7c8..f78c445c9e 100644 --- a/app/javascript/vue/components/Form/FormCollectingEvent/helpers/verbatimProperties.js +++ b/app/javascript/vue/components/Form/FormCollectingEvent/helpers/verbatimProperties.js @@ -9,5 +9,5 @@ export const verbatimProperties = { DateComponent: 'verbatim_date', Collectors: 'verbatim_collectors', Method: 'verbatim_method', - TripIdentifier: 'verbatim_trip_identifier' + FieldNumber: 'verbatim_field_number' } diff --git a/app/javascript/vue/components/radials/ce/components/VerbatimSlice.vue b/app/javascript/vue/components/radials/ce/components/VerbatimSlice.vue index 477034ac8e..e9ffdab927 100644 --- a/app/javascript/vue/components/radials/ce/components/VerbatimSlice.vue +++ b/app/javascript/vue/components/radials/ce/components/VerbatimSlice.vue @@ -86,7 +86,7 @@ const VERBATIM_FIELDS = { verbatim_datum: 'input', verbatim_collectors: 'textarea', verbatim_method: 'input', - verbatim_trip_identifier: 'input' + verbatim_field_number: 'input' } const props = defineProps({ diff --git a/app/javascript/vue/factory/CollectingEvent.js b/app/javascript/vue/factory/CollectingEvent.js index 3bcbcafafb..9d6239d761 100644 --- a/app/javascript/vue/factory/CollectingEvent.js +++ b/app/javascript/vue/factory/CollectingEvent.js @@ -10,7 +10,7 @@ export default () => ({ verbatim_longitude: undefined, verbatim_latitude: undefined, verbatim_geolocation_uncertainty: undefined, - verbatim_trip_identifier: undefined, + verbatim_field_number: undefined, verbatim_collectors: undefined, verbatim_method: undefined, verbatim_habitat: undefined, diff --git a/app/javascript/vue/routes/endpoints/CollectingEvents.js b/app/javascript/vue/routes/endpoints/CollectingEvents.js index 64e94ee16d..06da581038 100644 --- a/app/javascript/vue/routes/endpoints/CollectingEvents.js +++ b/app/javascript/vue/routes/endpoints/CollectingEvents.js @@ -14,7 +14,7 @@ const permitParams = { verbatim_longitude: String, verbatim_latitude: String, verbatim_geolocation_uncertainty: String, - verbatim_trip_identifier: String, + verbatim_field_number: String, verbatim_collectors: String, verbatim_method: String, geographic_area_id: String, diff --git a/app/javascript/vue/shared/Filter/constants/collectingEvent.js b/app/javascript/vue/shared/Filter/constants/collectingEvent.js index 916551a4c1..0c6464668b 100644 --- a/app/javascript/vue/shared/Filter/constants/collectingEvent.js +++ b/app/javascript/vue/shared/Filter/constants/collectingEvent.js @@ -8,7 +8,7 @@ export const COLLECTING_EVENT_PROPERTIES = [ 'verbatim_longitude', 'verbatim_latitude', 'verbatim_geolocation_uncertainty', - 'verbatim_trip_identifier', + 'verbatim_field_number', 'verbatim_collectors', 'verbatim_method', 'geographic_area_id', diff --git a/app/javascript/vue/tasks/collecting_events/new_collecting_event/components/map/PrintLabel.vue b/app/javascript/vue/tasks/collecting_events/new_collecting_event/components/map/PrintLabel.vue index efa88797d3..2d6bd0c900 100644 --- a/app/javascript/vue/tasks/collecting_events/new_collecting_event/components/map/PrintLabel.vue +++ b/app/javascript/vue/tasks/collecting_events/new_collecting_event/components/map/PrintLabel.vue @@ -124,7 +124,7 @@ export default { ...this.generateParsedLabel() ) - const AtStart = ['TripIdentifier', 'TripCode'] + const AtStart = ['FieldNumber', 'TripCode'] const sortedObjectLabelKeys = sortArrayByArray( Object.keys(objectLabels), diff --git a/app/javascript/vue/tasks/collecting_events/new_collecting_event/components/verbatim/TripIdentifier.vue b/app/javascript/vue/tasks/collecting_events/new_collecting_event/components/verbatim/TripIdentifier.vue index cd5d71da4a..a6c70a8671 100644 --- a/app/javascript/vue/tasks/collecting_events/new_collecting_event/components/verbatim/TripIdentifier.vue +++ b/app/javascript/vue/tasks/collecting_events/new_collecting_event/components/verbatim/TripIdentifier.vue @@ -5,7 +5,7 @@ class="full_width" type="text" rows="3" - v-model="collectingEvent.verbatim_trip_identifier" + v-model="collectingEvent.verbatim_field_number" /> diff --git a/app/javascript/vue/tasks/collecting_events/new_collecting_event/const/components.js b/app/javascript/vue/tasks/collecting_events/new_collecting_event/const/components.js index 9d9a2ad58e..6deac717ca 100644 --- a/app/javascript/vue/tasks/collecting_events/new_collecting_event/const/components.js +++ b/app/javascript/vue/tasks/collecting_events/new_collecting_event/const/components.js @@ -8,7 +8,7 @@ import Latitude from '../components/verbatim/Latitude.vue' import Locality from '../components/verbatim/Locality.vue' import Longitude from '../components/verbatim/Longitude.vue' import Method from '../components/verbatim/Method.vue' -import TripIdentifier from '../components/verbatim/TripIdentifier.vue' +import FieldNumber from '../components/verbatim/FieldNumber.vue' import Dates from '../components/parsed/Dates.vue' import Elevation from '../components/parsed/Elevation.vue' import GeographicArea from '../components/parsed/GeographicArea.vue' @@ -36,7 +36,7 @@ const ComponentVerbatim = { Datum: 'Datum', Collectors: 'Collectors', Method: 'Method', - TripIdentifier: 'TripIdentifier' + FieldNumber: 'FieldNumber' } const ComponentParse = { @@ -70,7 +70,7 @@ const VueComponents = { [ComponentVerbatim.VerbatimElevation]: VerbatimElevation, [ComponentVerbatim.Datum]: Datum, [ComponentVerbatim.Method]: Method, - [ComponentVerbatim.TripIdentifier]: TripIdentifier, + [ComponentVerbatim.FieldNumber]: FieldNumber, [ComponentParse.Dates]: Dates, [ComponentParse.Elevation]: Elevation, [ComponentParse.GeographicArea]: GeographicArea, diff --git a/app/javascript/vue/tasks/collecting_events/new_collecting_event/helpers/verbatimProperties.js b/app/javascript/vue/tasks/collecting_events/new_collecting_event/helpers/verbatimProperties.js index 66235bc7c8..f78c445c9e 100644 --- a/app/javascript/vue/tasks/collecting_events/new_collecting_event/helpers/verbatimProperties.js +++ b/app/javascript/vue/tasks/collecting_events/new_collecting_event/helpers/verbatimProperties.js @@ -9,5 +9,5 @@ export const verbatimProperties = { DateComponent: 'verbatim_date', Collectors: 'verbatim_collectors', Method: 'verbatim_method', - TripIdentifier: 'verbatim_trip_identifier' + FieldNumber: 'verbatim_field_number' } diff --git a/app/javascript/vue/tasks/collection_objects/filter/constants/layouts.js b/app/javascript/vue/tasks/collection_objects/filter/constants/layouts.js index c5ef3b9860..a69534c8e5 100644 --- a/app/javascript/vue/tasks/collection_objects/filter/constants/layouts.js +++ b/app/javascript/vue/tasks/collection_objects/filter/constants/layouts.js @@ -187,7 +187,7 @@ export const LAYOUTS = { 'verbatim_longitude', 'verbatim_latitude', 'verbatim_geolocation_uncertainty', - 'verbatim_trip_identifier', + 'verbatim_field_number', 'verbatim_collectors', 'verbatim_method', 'verbatim_elevation', diff --git a/app/javascript/vue/tasks/digitize/components/collectingEvent/components/map/printLabel.vue b/app/javascript/vue/tasks/digitize/components/collectingEvent/components/map/printLabel.vue index c43f16f50e..4c35ee7816 100644 --- a/app/javascript/vue/tasks/digitize/components/collectingEvent/components/map/printLabel.vue +++ b/app/javascript/vue/tasks/digitize/components/collectingEvent/components/map/printLabel.vue @@ -124,7 +124,7 @@ export default { ...this.generateParsedLabel() ) - const AtStart = ['TripIdentifier', 'TripCode'] + const AtStart = ['FieldNumber', 'TripCode'] const sortedObjectLabelKeys = sortArrayByArray( Object.keys(objectLabels), diff --git a/app/javascript/vue/tasks/digitize/components/collectingEvent/components/verbatim/tripIdentifier.vue b/app/javascript/vue/tasks/digitize/components/collectingEvent/components/verbatim/tripIdentifier.vue index e9b0309c13..5a33255f54 100644 --- a/app/javascript/vue/tasks/digitize/components/collectingEvent/components/verbatim/tripIdentifier.vue +++ b/app/javascript/vue/tasks/digitize/components/collectingEvent/components/verbatim/tripIdentifier.vue @@ -3,7 +3,7 @@ diff --git a/app/javascript/vue/tasks/digitize/const/components.js b/app/javascript/vue/tasks/digitize/const/components.js index b9b58d61b8..dfeca4bef8 100644 --- a/app/javascript/vue/tasks/digitize/const/components.js +++ b/app/javascript/vue/tasks/digitize/const/components.js @@ -3,7 +3,7 @@ import Label from '../components/collectingEvent/components/verbatim/label.vue' import DateComponent from '../components/collectingEvent/components/verbatim/date.vue' import Datum from '../components/collectingEvent/components/verbatim/datum.vue' import VerbatimElevation from '../components/collectingEvent/components/verbatim/elevation.vue' -import TripIdentifier from '../components/collectingEvent/components/verbatim/tripIdentifier.vue' +import FieldNumber from '../components/collectingEvent/components/verbatim/tripIdentifier.vue' import Geolocation from '../components/collectingEvent/components/verbatim/geolocationUncertainty.vue' import Habitat from '../components/collectingEvent/components/verbatim/habitat.vue' import Latitude from '../components/collectingEvent/components/verbatim/latitude.vue' @@ -48,7 +48,7 @@ const ComponentVerbatim = { Datum: 'Datum', Collectors: 'Collectors', Method: 'Method', - TripIdentifier: 'TripIdentifier' + FieldNumber: 'FieldNumber' } const ComponentParse = { @@ -83,7 +83,7 @@ const VueComponents = { [ComponentVerbatim.DateComponent]: DateComponent, [ComponentVerbatim.Datum]: Datum, [ComponentVerbatim.Method]: Method, - [ComponentVerbatim.TripIdentifier]: TripIdentifier, + [ComponentVerbatim.FieldNumber]: FieldNumber, [ComponentParse.Dates]: Dates, [ComponentParse.Elevation]: Elevation, [ComponentParse.GeographicArea]: GeographicArea, diff --git a/app/models/collecting_event.rb b/app/models/collecting_event.rb index 31c1753164..5ed3aaeb9b 100644 --- a/app/models/collecting_event.rb +++ b/app/models/collecting_event.rb @@ -31,7 +31,7 @@ # @return [String] # A string, typically sliced from verbatim_label, that represents the provided uncertainty value. # -# @!attribute verbatim_trip_identifier +# @!attribute verbatim_field_number # @return [String] # the literal string/identifier used by the collector(s) to identify this particular collecting event, usually part of a series particular to one trip # @@ -295,13 +295,13 @@ class CollectingEvent < ApplicationRecord validates_presence_of :geographic_area_id, if: -> { meta_prioritize_geographic_area } - validate :verbatim_trip_identifier_syncronized + validate :verbatim_field_number_syncronized - def verbatim_trip_identifier_syncronized - if verbatim_trip_identifier.present? + def verbatim_field_number_syncronized + if verbatim_field_number.present? if i = identifiers.where(type: 'Identifier::Local::FieldNumber').first - if i.cached != verbatim_trip_identifier - errors.add(:verbatim_trip_identifier, 'does not match the FieldNumber identifier attached to record') + if i.cached != verbatim_field_number + errors.add(:verbatim_field_number, 'does not match the FieldNumber identifier attached to record') end end end @@ -332,7 +332,7 @@ def verbatim_trip_identifier_syncronized description: 'Georaphic area is missing') def dwc_occurrences - # THrough CollectionObjects + # Through CollectionObjects DwcOccurrence .joins("JOIN collection_objects co on dwc_occurrence_object_id = co.id AND dwc_occurrence_object_type = 'CollectionObject'") .where(co: {collecting_event_id: id}) @@ -1027,7 +1027,7 @@ def clone(annotations: false, incremented_identifier_id: nil) # not_georeference_attributes = %w{created_at updated_at project_id updated_by_id created_by_id collecting_event_id id position} georeferences.each do |g| i = g.dup - + g.georeferencer_roles.each do |r| i.georeferencer_roles.build(person: r.person, position: r.position) end @@ -1041,7 +1041,7 @@ def clone(annotations: false, incremented_identifier_id: nil) add_incremented_identifier(to_object: a, incremented_identifier_id:) end - if !annotations.blank? # TODO: boolean param this + if !annotations.blank? # TODO: boolean param this clone_annotations(to_object: a, except: [:identifiers]) end diff --git a/app/models/collection_object/dwc_extensions.rb b/app/models/collection_object/dwc_extensions.rb index b76506b323..df5679d21e 100644 --- a/app/models/collection_object/dwc_extensions.rb +++ b/app/models/collection_object/dwc_extensions.rb @@ -368,7 +368,7 @@ def dwc_sampling_protocol def dwc_field_number return nil unless collecting_event # Since we enforce that they are identical we can choose the former if present - collecting_event&.verbatim_trip_identifier || collecting_event.identifiers.where(type: 'Identifier::Local::FieldNumber').first&.cached + collecting_event&.verbatim_field_number || collecting_event.identifiers.where(type: 'Identifier::Local::FieldNumber').first&.cached end def dwc_event_id diff --git a/app/models/dataset_record/darwin_core/occurrence.rb b/app/models/dataset_record/darwin_core/occurrence.rb index 4a1fcba4fe..fc423ccaed 100644 --- a/app/models/dataset_record/darwin_core/occurrence.rb +++ b/app/models/dataset_record/darwin_core/occurrence.rb @@ -24,7 +24,7 @@ class DatasetRecord::DarwinCore::Occurrence < DatasetRecord::DarwinCore start_date_day start_date_month start_date_year end_date_day end_date_month end_date_year time_end_hour time_end_minute time_end_second time_start_hour time_start_minute time_start_second verbatim_collectors verbatim_date verbatim_datum verbatim_elevation verbatim_geolocation_uncertainty verbatim_habitat - verbatim_latitude verbatim_locality verbatim_longitude verbatim_method verbatim_trip_identifier + verbatim_latitude verbatim_locality verbatim_longitude verbatim_method verbatim_field_number ).to_set.freeze }.freeze @@ -297,7 +297,7 @@ def import(dwc_data_attributes = {}) # # New rules: # * No overlapping intended meanings, each maps to itself - # + # event_id, field_number = get_field_value(:eventID), get_field_value(:fieldNumber) collecting_event_identifiers = [] if event_id.present? @@ -305,7 +305,7 @@ def import(dwc_data_attributes = {}) # TODO: Shouldn't this be local?! identifier_type = Identifier::Global.descendants.detect { |c| c.name.downcase == event_id_namespace.downcase } if event_id_namespace - + identifier_attributes = { identifier: event_id, identifier_object_type: 'CollectingEvent', @@ -863,7 +863,7 @@ def parse_event_class # parentEventID: [Not mapped] - # fieldNumber: verbatim_trip_identifier & Identifier::Local::FieldNumber + # fieldNumber: verbatim_field_number & Identifier::Local::FieldNumber start_date, end_date = parse_iso_date(:eventDate) diff --git a/app/models/identifier/local/field_number.rb b/app/models/identifier/local/field_number.rb index d6460c6175..423d6e17d0 100644 --- a/app/models/identifier/local/field_number.rb +++ b/app/models/identifier/local/field_number.rb @@ -21,8 +21,8 @@ def dwc_occurrences def same_as_verbatim unless errors.any? || !identifier_object.present? - if identifier_object.verbatim_trip_identifier.present? && build_cached != identifier_object.verbatim_trip_identifier - errors.add(:identifier, 'not identical to CollectingEvent verbatim_trip_identifier') + if identifier_object.verbatim_field_number.present? && build_cached != identifier_object.verbatim_field_number + errors.add(:identifier, 'not identical to CollectingEvent verbatim_field_number') end end end diff --git a/app/views/collecting_events/_attributes.html.erb b/app/views/collecting_events/_attributes.html.erb index f74589028c..862d1fa047 100644 --- a/app/views/collecting_events/_attributes.html.erb +++ b/app/views/collecting_events/_attributes.html.erb @@ -63,7 +63,7 @@

Verbatim trip identifier: - <%= object.verbatim_trip_identifier %> + <%= object.verbatim_field_number %>

diff --git a/app/views/collecting_events/_attributes.json.jbuilder b/app/views/collecting_events/_attributes.json.jbuilder index bb01b48be2..c2440f263f 100644 --- a/app/views/collecting_events/_attributes.json.jbuilder +++ b/app/views/collecting_events/_attributes.json.jbuilder @@ -1,6 +1,6 @@ json.extract! collecting_event, :id, :verbatim_label, :print_label, :document_label, - :verbatim_locality, :verbatim_longitude, :verbatim_latitude, :verbatim_geolocation_uncertainty, :verbatim_trip_identifier, :verbatim_collectors, :verbatim_method, + :verbatim_locality, :verbatim_longitude, :verbatim_latitude, :verbatim_geolocation_uncertainty, :verbatim_field_number, :verbatim_collectors, :verbatim_method, :verbatim_elevation, :verbatim_habitat, :verbatim_datum, :verbatim_date, :geographic_area_id, :minimum_elevation, :maximum_elevation, :elevation_precision, :start_date_day, :start_date_month, :start_date_year, :end_date_day, :end_date_month, :end_date_year, diff --git a/app/views/collecting_events/_card.html.erb b/app/views/collecting_events/_card.html.erb index 65c3e55055..914b3c8a4f 100644 --- a/app/views/collecting_events/_card.html.erb +++ b/app/views/collecting_events/_card.html.erb @@ -10,13 +10,13 @@ 'Verbatim collectors:': object.verbatim_collectors, 'Verbatim method:': object.verbatim_method, 'Geographic area:': object_link(object.geographic_area), - 'Verbatim trip identifier:': object.verbatim_trip_identifier, + 'Verbatim trip identifier:': object.verbatim_field_number, 'Field notes:': object.field_notes, 'Verbatim date:': object.verbatim_date, 'Verbatim habitat:': object.verbatim_habitat, 'Verbatim label:': object.verbatim_label, 'Verbatim elevation:': object.verbatim_elevation, - 'Time start:': object.time_start, + 'Time start:': object.time_start, 'Time end:': object.time_end, 'Print label:': object.print_label, 'Document label:': object.document_label diff --git a/app/views/collecting_events/_form.html.erb b/app/views/collecting_events/_form.html.erb index 7d8021e364..9b38672a60 100644 --- a/app/views/collecting_events/_form.html.erb +++ b/app/views/collecting_events/_form.html.erb @@ -22,11 +22,11 @@ <%= content_tag(:li, link_to( "New", new_collecting_event_path, data: { confirm: "Leave this record? Changes will not be saved!"})) %> - + <%= content_tag(:li, radial_annotator(@collecting_event)) -%> -
+
<% end %> <%= form_for(@collecting_event, html: {id: :collecting_event_form}) do |f| %> @@ -95,9 +95,9 @@ <%= f.text_field :verbatim_geolocation_uncertainty %>

- <%= f.label :verbatim_trip_identifier %> + <%= f.label :verbatim_field_number %>
- <%= f.text_field :verbatim_trip_identifier, size: 35 %> + <%= f.text_field :verbatim_field_number, size: 35 %>
diff --git a/app/views/collecting_events/api/v1/_attributes.json.jbuilder b/app/views/collecting_events/api/v1/_attributes.json.jbuilder index 5d902629f2..8238eda933 100644 --- a/app/views/collecting_events/api/v1/_attributes.json.jbuilder +++ b/app/views/collecting_events/api/v1/_attributes.json.jbuilder @@ -1,26 +1,26 @@ -json.extract! collecting_event, :id, - :verbatim_label, :print_label, :document_label, - :verbatim_locality, :verbatim_longitude, :verbatim_latitude, :verbatim_geolocation_uncertainty, :verbatim_trip_identifier, :verbatim_collectors, :verbatim_method, +json.extract! collecting_event, :id, + :verbatim_label, :print_label, :document_label, + :verbatim_locality, :verbatim_longitude, :verbatim_latitude, :verbatim_geolocation_uncertainty, :verbatim_field_number, :verbatim_collectors, :verbatim_method, :verbatim_elevation, :verbatim_habitat, :verbatim_datum, :verbatim_date, - :geographic_area_id, :minimum_elevation, :maximum_elevation, :elevation_precision, + :geographic_area_id, :minimum_elevation, :maximum_elevation, :elevation_precision, :start_date_day, :start_date_month, :start_date_year, :end_date_day, :end_date_month, :end_date_year, :time_start_hour, - :time_start_minute, - :time_start_second, - :time_end_hour, - :time_end_minute, - :time_end_second, + :time_start_minute, + :time_start_second, + :time_end_hour, + :time_end_minute, + :time_end_second, :field_notes, :md5_of_verbatim_label, :min_ma, :max_ma, - :cached, + :cached, :cached_level0_geographic_name, :cached_level1_geographic_name, :cached_level2_geographic_name, :group, :formation, - :member, + :member, :lithology, - :max_ma, + :max_ma, :min_ma, :identifiers, :created_by_id, :updated_by_id, :project_id, :created_at, :updated_at @@ -35,7 +35,5 @@ if extend_response_with('roles') json.partial! '/people/api/v1/brief', person: role.person end end - end + end end - - diff --git a/app/views/collecting_events/list.html.erb b/app/views/collecting_events/list.html.erb index 9ea20b545c..8e8cc7b2c1 100644 --- a/app/views/collecting_events/list.html.erb +++ b/app/views/collecting_events/list.html.erb @@ -49,7 +49,7 @@ <%= collecting_event.start_date_day %> <%= collecting_event.start_date_month %> <%= collecting_event.start_date_year %> - + @@ -57,7 +57,7 @@ - + diff --git a/db/migrate/20240923211118_rename_collecting_event_verbatim_trip_code.rb b/db/migrate/20240923211118_rename_collecting_event_verbatim_trip_code.rb new file mode 100644 index 0000000000..9f76c354bf --- /dev/null +++ b/db/migrate/20240923211118_rename_collecting_event_verbatim_trip_code.rb @@ -0,0 +1,7 @@ +class RenameCollectingEventVerbatimTripCode < ActiveRecord::Migration[7.1] + def change + # Also verbatimTripIdentifier + # FieldIdentifier + rename_column :collecting_events, :verbatim_trip_identifier, :verbatim_field_number + end +end diff --git a/db/schema.rb b/db/schema.rb index 5899a9da89..87d8fd6741 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_09_23_143033) do +ActiveRecord::Schema[7.1].define(version: 2024_09_23_211118) do # These are extensions that must be enabled in order to support this database enable_extension "btree_gin" enable_extension "fuzzystrmatch" @@ -293,7 +293,7 @@ t.string "verbatim_longitude" t.string "verbatim_latitude" t.string "verbatim_geolocation_uncertainty" - t.string "verbatim_trip_identifier" + t.string "verbatim_field_number" t.string "verbatim_collectors" t.string "verbatim_method" t.integer "geographic_area_id" diff --git a/lib/batch_load/import/collection_objects.rb b/lib/batch_load/import/collection_objects.rb index baf27e0977..977ead3acb 100644 --- a/lib/batch_load/import/collection_objects.rb +++ b/lib/batch_load/import/collection_objects.rb @@ -123,7 +123,7 @@ def build_collection_objects time_end_minute: nil, time_end_second: nil, verbatim_date: row['verbatim_date'], - verbatim_trip_identifier: nil, + verbatim_field_number: nil, verbatim_collectors: nil, verbatim_label: nil, document_label: nil, diff --git a/lib/queries/collecting_event/autocomplete.rb b/lib/queries/collecting_event/autocomplete.rb index 01840d6832..5050d72ced 100644 --- a/lib/queries/collecting_event/autocomplete.rb +++ b/lib/queries/collecting_event/autocomplete.rb @@ -29,8 +29,8 @@ def autocomplete_start_date_wild_card(field = :verbatim_locality) base_query.where( a.and(table[field].matches(b.join)).to_sql).limit(20) end - def autocomplete_verbatim_trip_identifier_match - base_query.where( table[:verbatim_trip_identifier].matches(end_wildcard).to_sql).limit(20) + def autocomplete_verbatim_field_number_match + base_query.where( table[:verbatim_field_number].matches(end_wildcard).to_sql).limit(20) end def autocomplete_verbatim_collectors_wildcard @@ -80,7 +80,7 @@ def autocomplete autocomplete_identifier_identifier_exact, autocomplete_identifier_cached_exact, autocomplete_identifier_cached_like.limit(4), - autocomplete_verbatim_trip_identifier_match, + autocomplete_verbatim_field_number_match, autocomplete_start_or_end_date, autocomplete_start_date_wild_card(:verbatim_locality), autocomplete_start_date_wild_card(:cached), diff --git a/spec/lib/queries/collecting_event/autocomplete_spec.rb b/spec/lib/queries/collecting_event/autocomplete_spec.rb index af5e932d2c..1e6f013573 100644 --- a/spec/lib/queries/collecting_event/autocomplete_spec.rb +++ b/spec/lib/queries/collecting_event/autocomplete_spec.rb @@ -12,7 +12,7 @@ let!(:ce2) { CollectingEvent.create( verbatim_locality: 'Out there, under the stars', - verbatim_trip_identifier: 'Foo manchu', + verbatim_field_number: 'Foo manchu', start_date_year: 2000, start_date_month: 2, start_date_day: 19, @@ -68,9 +68,9 @@ expect(query.autocomplete_verbatim_locality_wildcard_end).to eq(nil) end - specify '#autocomplete_verbatim_trip_identifier_match (:cached)' do + specify '#autocomplete_verbatim_field_number_match (:cached)' do query.terms = 'foo manchu' - expect(query.autocomplete_verbatim_trip_identifier_match.map(&:id)).to contain_exactly(ce2.id) + expect(query.autocomplete_verbatim_field_number_match.map(&:id)).to contain_exactly(ce2.id) end specify '#autocomplete_identifier_cached_exact' do diff --git a/spec/lib/queries/collecting_event/filter_spec.rb b/spec/lib/queries/collecting_event/filter_spec.rb index ede9cd4baf..df0cace4ba 100644 --- a/spec/lib/queries/collecting_event/filter_spec.rb +++ b/spec/lib/queries/collecting_event/filter_spec.rb @@ -13,7 +13,7 @@ let!(:ce2) { CollectingEvent.create( verbatim_locality: 'Out there, under the stars', - verbatim_trip_identifier: 'Foo manchu', + verbatim_field_number: 'Foo manchu', start_date_year: 2000, start_date_month: 2, start_date_day: 18, diff --git a/spec/lib/queries/collection_object/filter_spec.rb b/spec/lib/queries/collection_object/filter_spec.rb index efab75efbb..2d9fffa4ab 100644 --- a/spec/lib/queries/collection_object/filter_spec.rb +++ b/spec/lib/queries/collection_object/filter_spec.rb @@ -396,7 +396,7 @@ let(:ce2) { CollectingEvent.create( verbatim_locality: 'Out there, under the stars', - verbatim_trip_identifier: 'Foo manchu', + verbatim_field_number: 'Foo manchu', start_date_year: 2000, start_date_month: 2, start_date_day: 18, diff --git a/spec/lib/queries/concerns/attributes_spec.rb b/spec/lib/queries/concerns/attributes_spec.rb index 09a8850d15..7b421ee579 100644 --- a/spec/lib/queries/concerns/attributes_spec.rb +++ b/spec/lib/queries/concerns/attributes_spec.rb @@ -13,7 +13,7 @@ let!(:ce2) { CollectingEvent.create( verbatim_locality: 'Out there, under the stars', - verbatim_trip_identifier: 'Foo manchu', + verbatim_field_number: 'Foo manchu', start_date_year: 2000, start_date_month: 2, start_date_day: 18, diff --git a/spec/models/collecting_event_spec.rb b/spec/models/collecting_event_spec.rb index 0925c950eb..dedae65a49 100644 --- a/spec/models/collecting_event_spec.rb +++ b/spec/models/collecting_event_spec.rb @@ -6,7 +6,7 @@ let(:state) { county.parent } let(:country) { state.parent } - specify '#verbatim_trip_identifier matches Identifier' do + specify '#verbatim_field_number matches Identifier' do collecting_event.verbatim_label = 'All the stuff' collecting_event.save! @@ -16,8 +16,8 @@ identifier: '1' ) - collecting_event.update(verbatim_trip_identifier: '2') - expect(collecting_event.errors.key?(:verbatim_trip_identifier)).to be_truthy + collecting_event.update(verbatim_field_number: '2') + expect(collecting_event.errors.key?(:verbatim_field_number)).to be_truthy end # Added as a context for exploring re-indexing DwC based on DataAttribute updates diff --git a/spec/models/dataset_record/darwin_core/occurrence_spec.rb b/spec/models/dataset_record/darwin_core/occurrence_spec.rb index 43adc5deb8..f6591a92d0 100644 --- a/spec/models/dataset_record/darwin_core/occurrence_spec.rb +++ b/spec/models/dataset_record/darwin_core/occurrence_spec.rb @@ -134,7 +134,7 @@ end it 'does not populate verbatim fields by default' do - expect(CollectingEvent.first.verbatim_trip_identifier).to eq(nil) + expect(CollectingEvent.first.verbatim_field_number).to eq(nil) end end diff --git a/spec/models/identifier/local/field_number_spec.rb b/spec/models/identifier/local/field_number_spec.rb index 290cddf77f..c94045b99b 100644 --- a/spec/models/identifier/local/field_number_spec.rb +++ b/spec/models/identifier/local/field_number_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' describe Identifier::Local::FieldNumber, type: :model, group: :identifiers do - let(:n) { FactoryBot.create(:valid_namespace, short_name: 'NS', delimiter: nil) } + let(:n) { FactoryBot.create(:valid_namespace, short_name: 'NS', delimiter: nil) } specify 'assigned to CollectingEvent only 1' do i = Identifier::Local::FieldNumber.create(identifier: '345', namespace: n, identifier_object: Specimen.create!) @@ -13,12 +13,12 @@ expect(i.errors.key?(:identifier_object_type)).to be_falsey end - specify 'must be same as verbatim_trip_identifier if provided' do - c = FactoryBot.create(:valid_collecting_event, verbatim_trip_identifier: 'NS345') + specify 'must be same as verbatim_field_number if provided' do + c = FactoryBot.create(:valid_collecting_event, verbatim_field_number: 'NS345') i = Identifier::Local::FieldNumber.new(identifier: '345', namespace: n, identifier_object: c) expect(i.valid?).to be_falsey expect(i.errors.key?(:identifier)).to be_truthy end - + end From 08cb9fe91d1042d312bc1d3830f7c7c34a93db13 Mon Sep 17 00:00:00 2001 From: jlpereira Date: Mon, 23 Sep 2024 18:42:54 -0300 Subject: [PATCH 14/25] Fix renamed files --- .../verbatim/{TripIdentifier.vue => FieldNumber.vue} | 8 ++++++-- .../verbatim/{TripIdentifier.vue => FieldNumber.vue} | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) rename app/javascript/vue/components/Form/FormCollectingEvent/components/verbatim/{TripIdentifier.vue => FieldNumber.vue} (67%) rename app/javascript/vue/tasks/collecting_events/new_collecting_event/components/verbatim/{TripIdentifier.vue => FieldNumber.vue} (88%) diff --git a/app/javascript/vue/components/Form/FormCollectingEvent/components/verbatim/TripIdentifier.vue b/app/javascript/vue/components/Form/FormCollectingEvent/components/verbatim/FieldNumber.vue similarity index 67% rename from app/javascript/vue/components/Form/FormCollectingEvent/components/verbatim/TripIdentifier.vue rename to app/javascript/vue/components/Form/FormCollectingEvent/components/verbatim/FieldNumber.vue index e3f1dce4e3..d3206fad2c 100644 --- a/app/javascript/vue/components/Form/FormCollectingEvent/components/verbatim/TripIdentifier.vue +++ b/app/javascript/vue/components/Form/FormCollectingEvent/components/verbatim/FieldNumber.vue @@ -1,12 +1,16 @@