Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge to master: Release 2.4.0 - Multi-backend stores integrations, URI content negotiation and Ontology metadata and data indexation #73

Merged
merged 14 commits into from
May 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Feature: mappings statistics slices support (#78)
* restrict mapping statistics ontologies to the ontologies of the current slice

* add a test for the mappings slices support

* add test for mappings statistics slices support
Bilelkihal authored May 21, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 5c03e7ea87349ce19ea738fccd3fc5bb4e0385d5
2 changes: 2 additions & 0 deletions controllers/mappings_controller.rb
Original file line number Diff line number Diff line change
@@ -191,6 +191,8 @@ class MappingsController < ApplicationController
.each do |m|
persistent_counts[m.ontologies.first] = m.count
end
ont_acronyms = restricted_ontologies_to_acronyms(params)
persistent_counts = persistent_counts.select { |key, _| ont_acronyms.include?(key) || key.start_with?("http://") }
reply persistent_counts
end

3 changes: 3 additions & 0 deletions test/controllers/test_mappings_controller.rb
Original file line number Diff line number Diff line change
@@ -88,6 +88,7 @@ def test_mappings_file_load
commun_created_mappings_test(created, mapping_term_a, mapping_term_b, relations)
end


private

def commun_created_mappings_test(created, mapping_term_a, mapping_term_b, relations)
@@ -423,4 +424,6 @@ def build_mappings_hash
end
[mappings, mapping_ont_a, mapping_ont_b, mapping_term_a, mapping_term_b, relations]
end


end
25 changes: 25 additions & 0 deletions test/helpers/test_slices_helper.rb
Original file line number Diff line number Diff line change
@@ -70,6 +70,31 @@ def test_search_slices
assert results.all? {|r| group_ids.include?(r["links"]["ontology"])}
end

def test_mappings_slices
LinkedData::Mappings.create_mapping_counts(Logger.new(TestLogFile.new))

get "/mappings/statistics/ontologies/"

expected_result_without_slice = ["PARSED-0",
"PARSED-1",
"http://data.bioontology.org/metadata/ExternalMappings",
"http://data.bioontology.org/metadata/InterportalMappings/agroportal",
"http://data.bioontology.org/metadata/InterportalMappings/ncbo",
"http://data.bioontology.org/metadata/InterportalMappings/sifr"]

assert_equal expected_result_without_slice, MultiJson.load(last_response.body).keys.sort

get "http://#{@@group_acronym}/mappings/statistics/ontologies/"

expected_result_with_slice = ["PARSED-0",
"http://data.bioontology.org/metadata/ExternalMappings",
"http://data.bioontology.org/metadata/InterportalMappings/agroportal",
"http://data.bioontology.org/metadata/InterportalMappings/ncbo",
"http://data.bioontology.org/metadata/InterportalMappings/sifr"]

assert_equal expected_result_with_slice, MultiJson.load(last_response.body).keys.sort
end

private

def self._create_group