Skip to content

Commit

Permalink
Merge pull request #4212 from SpeciesFileGroup/filter_field_occurrences
Browse files Browse the repository at this point in the history
Filter field occurrences
  • Loading branch information
jlpereira authored Feb 25, 2025
2 parents b9502fe + 2c7c380 commit 4e3404a
Show file tree
Hide file tree
Showing 77 changed files with 2,033 additions and 1,259 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ This project <em>does not yet</em> adheres to [Semantic Versioning](https://semv
### Added

- Append mode to multi update data attributes task [#4204]
<<<<<<< HEAD
- <in progress Batch add/remove Protocols>
- Protocol `is_machine_output` attribute to facilitate MachineObservation types
=======
- Sticky navbar on browse nomenclature and collecting event
- Move button to citations and depiction slices in radial annotator
- Freeze column checkbox to filter tasks [#4220]
Expand All @@ -18,6 +22,7 @@ This project <em>does not yet</em> adheres to [Semantic Versioning](https://semv
### Changed

- Add total to unmatched panel on Nomenclature match task
>>>>>>> development
[#4204]: https://github.com/SpeciesFileGroup/taxonworks/pull/4204
[#4219]: https://github.com/SpeciesFileGroup/taxonworks/pull/4219
Expand Down
16 changes: 16 additions & 0 deletions app/controllers/protocol_relationships_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,22 @@ def search
end
end

# POST
def batch_by_filter_scope
if r = ProtocolRelationship.batch_by_filter_scope(
mode: params[:mode] || :add,
filter_query: params.require(:filter_query), # like filter_query: { otu_query: {}}
protocol_id: params.require(:protocol_id),
replace_protocol_id: params[:replace_protocol_id]
)
render json: r.to_json, status: :ok
else
render json: {}, status: :unprocessable_entity
end
end



private

def set_protocol_relationship
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/protocols_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,6 @@ def set_protocol
end

def protocol_params
params.require(:protocol).permit(:name, :short_name, :description)
params.require(:protocol).permit(:name, :short_name, :description, :is_machine_output)
end
end
4 changes: 4 additions & 0 deletions app/controllers/tasks/field_occurrences/filter_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Tasks::FieldOccurrences::FilterController < ApplicationController
include TaskControllerConfiguration

end
1 change: 1 addition & 0 deletions app/javascript/packs/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,4 @@ import '../vue/tasks/biological_associations/new/main.js'
import '../vue/tasks/otus/duplicates/main.js'
import '../vue/tasks/field_occurrences/browse/main.js'
import '../vue/tasks/data_attributes/multi_update/main.js'
import '../vue/tasks/field_occurrences/filter/main.js'
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</template>

<script setup>
import { computed, ref, onBeforeMount } from 'vue'
import { computed, ref, onBeforeMount, watch } from 'vue'
import { ControlledVocabularyTerm } from '@/routes/endpoints'
import { URLParamsToJSON } from '@/helpers/url/parse.js'
import FacetContainer from '@/components/Filter/Facets/FacetContainer.vue'
Expand Down Expand Up @@ -61,4 +61,13 @@ onBeforeMount(() => {
}
)
})
watch(
() => params.value.biocuration_class_id,
(newVal) => {
if (!newVal) {
params.value.biocuration_class_id = []
}
}
)
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export const FILTER_EXTRACT = {
label: 'Extracts',
link: '/tasks/extracts/filter'
}
export const FILTER_FIELD_OCCURRENCE = {
label: 'Field occurrences',
link: '/tasks/field_occurrences/filter'
}
export const FILTER_OTU = {
label: 'OTUs',
link: '/tasks/otus/filter'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
DESCRIPTOR,
DWC_OCCURRENCE,
EXTRACT,
FIELD_OCCURRENCE,
IMAGE,
LOAN,
OBSERVATION,
Expand All @@ -27,6 +28,7 @@ export const ID_PARAM_FOR = {
[DESCRIPTOR]: 'descriptor_id',
[DWC_OCCURRENCE]: 'dwc_occurrence_id',
[EXTRACT]: 'extract_id',
[FIELD_OCCURRENCE]: 'field_occurrence_id',
[IMAGE]: 'image_id',
[LOAN]: 'loan_id',
[OBSERVATION]: 'observation_id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
COLLECTION_OBJECT,
DESCRIPTOR,
EXTRACT,
FIELD_OCCURRENCE,
IMAGE,
OTU,
PEOPLE,
Expand All @@ -24,6 +25,7 @@ export const QUERY_PARAM = {
[DESCRIPTOR]: 'descriptor_query',
[DWC_OCCURRENCE]: 'dwc_occurrence_query',
[EXTRACT]: 'extract_query',
[FIELD_OCCURRENCE]: 'field_occurrence_query',
[IMAGE]: 'image_query',
[OTU]: 'otu_query',
[SOURCE]: 'source_query',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {
FILTER_COLLECTION_OBJECT,
FILTER_OTU,
FILTER_SOURCE,
FILTER_TAXON_NAME
FILTER_TAXON_NAME,
FILTER_FIELD_OCCURRENCE
} from '../constants/filterLinks'

export const BiologicalAssociation = [
Expand All @@ -13,5 +14,6 @@ export const BiologicalAssociation = [
FILTER_COLLECTION_OBJECT,
FILTER_OTU,
FILTER_SOURCE,
FILTER_TAXON_NAME
FILTER_TAXON_NAME,
FILTER_FIELD_OCCURRENCE
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@
import {
FILTER_BIOLOGICAL_ASSOCIATION,
FILTER_COLLECTION_OBJECT,
FILTER_FIELD_OCCURRENCE,
FILTER_OTU,
FILTER_SOURCE,
FILTER_TAXON_NAME,
FILTER_IMAGE,
FILTER_DWC_OCCURRENCE,
FILTER_DWC_OCCURRENCE
} from '../constants/filterLinks'

export const CollectingEvent = [
FILTER_BIOLOGICAL_ASSOCIATION,
FILTER_COLLECTION_OBJECT,
FILTER_FIELD_OCCURRENCE,
FILTER_OTU,
FILTER_SOURCE,
FILTER_TAXON_NAME,
FILTER_IMAGE,
FILTER_DWC_OCCURRENCE,
FILTER_DWC_OCCURRENCE
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {
FILTER_BIOLOGICAL_ASSOCIATION,
FILTER_COLLECTING_EVENT,
FILTER_OTU
} from '../constants/filterLinks'

export const FieldOccurrence = [
FILTER_BIOLOGICAL_ASSOCIATION,
FILTER_COLLECTING_EVENT,
FILTER_OTU
]
4 changes: 3 additions & 1 deletion app/javascript/vue/components/radials/filter/links/Otu.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
FILTER_OBSERVATION,
FILTER_SOURCE,
FILTER_TAXON_NAME,
FILTER_FIELD_OCCURRENCE
} from '../constants/filterLinks'

export const Otu = [
Expand All @@ -21,9 +22,10 @@ export const Otu = [
FILTER_CONTENT,
FILTER_DESCRIPTOR,
FILTER_EXTRACT,
FILTER_FIELD_OCCURRENCE,
FILTER_IMAGE,
FILTER_LOAN,
FILTER_OBSERVATION,
FILTER_SOURCE,
FILTER_TAXON_NAME,
FILTER_TAXON_NAME
]
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export * from './Content'
export * from './Descriptor'
export * from './DwcOccurrence'
export * from './Extract'
export * from './FieldOccurrence'
export * from './Image'
export * from './Loan'
export * from './Observation'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import { ref, onBeforeMount, shallowRef } from 'vue'
import { ControlledVocabularyTerm, Confidence } from '@/routes/endpoints'
import { ID_PARAM_FOR } from '@/components/radials/filter/constants/idParams.js'
import { QUERY_PARAM } from '@/components/radials/filter/constants/queryParam'
import { CONFIDENCE_LEVEL } from '@/constants'
import ConfidenceList from './ConfidenceList.vue'
import ConfirmationModal from '@/components/ConfirmationModal.vue'
Expand Down Expand Up @@ -134,7 +135,9 @@ function makePayload(confidence) {
return {
mode: selectedMode.value.mode,
confidence_level_id: confidence.id,
filter_query: props.parameters
filter_query: {
[QUERY_PARAM[props.objectType]]: props.parameters
}
}
}
Expand All @@ -143,7 +146,9 @@ function makeReplacePayload([replace, to]) {
mode: selectedMode.value.mode,
confidence_level_id: to.id,
replace_confidence_level_id: replace.id,
filter_query: props.parameters
filter_query: {
[QUERY_PARAM[props.objectType]]: props.parameters
}
}
}
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<template>
<div
color="create"
class="flex-wrap-row gap-small margin-large-top"
>
<VBtn
v-for="item in list"
:key="item.id"
:color="color"
medium
@click="() => emit('select', item)"
>
<span v-html="item.object_tag" />
</VBtn>
</div>
</template>

<script setup>
import VBtn from '@/components/ui/VBtn/index.vue'
defineProps({
color: {
type: String,
default: 'primary'
},
list: {
type: Array,
default: () => []
}
})
const emit = defineEmits(['select'])
</script>
Loading

0 comments on commit 4e3404a

Please sign in to comment.