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

PMR results mixed #81

Draft
wants to merge 79 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
8c29af0
Add pmr mode and selector to sidebar
Tehsurfer Sep 29, 2023
fcdc813
Add sparc datasets
Tehsurfer Oct 19, 2023
3f4c62e
Add missing files
Tehsurfer Oct 20, 2023
b568aeb
Catch up with main branch
Tehsurfer Jun 18, 2024
7dd9295
Update PMR test data and UI
akhuoa Jun 20, 2024
757ccfe
Update sample data
akhuoa Jun 20, 2024
4979c42
Refactor PMR Card
akhuoa Jun 20, 2024
06792ac
Move PMR sample data to json file and fetch
akhuoa Jun 20, 2024
1e54fca
Start using the flatmap server for pmr queries
Tehsurfer Jun 20, 2024
27525b2
Add processing for pmr results
Tehsurfer Jun 20, 2024
772474e
Fix pmr cards by only using metadata from pmr queries
Tehsurfer Jun 20, 2024
5555ab8
Remove duplicate results
Tehsurfer Jun 20, 2024
e410efe
Add ability to filter on features
Tehsurfer Jun 21, 2024
95a6ed4
Add ability to search on filters in pmr
Tehsurfer Jun 25, 2024
f6a1d0e
Hook pmr up to results
Tehsurfer Jun 25, 2024
40d9d4c
Attempt at pagination
Tehsurfer Jul 2, 2024
c3f9272
Results now in same pane, but pagination not perfect and numresults s…
Tehsurfer Jul 2, 2024
4865244
Add PMR checkbox under Data type filters
akhuoa Jul 3, 2024
b87cadc
Attempt at variable results ratio
Tehsurfer Jul 4, 2024
701d918
Add PMR search only function
akhuoa Jul 4, 2024
b1e11c6
Merge branch 'pmr-results-mixed' of github.com:Tehsurfer/map-sidebar …
akhuoa Jul 8, 2024
9f0cff5
Remove unnecessary variable
akhuoa Jul 9, 2024
f65beb9
Add dataset-card hover event
akhuoa Jul 9, 2024
ffe7590
Merge branch 'main' into pmr-results-mixed-updated
akhuoa Jul 9, 2024
654b292
Merge branch 'main' into pmr-results-mixed-updated
akhuoa Jul 11, 2024
86b18e4
Link PMR from filter to show PMR results
akhuoa Jul 11, 2024
e04c2c8
Finish getting mixed results to work
Tehsurfer Jul 11, 2024
ee0b168
Merge branch 'pmr-results-mixed' into pmr-results-mixed-updated
Tehsurfer Jul 11, 2024
3e5047a
Merge pull request #4 from akhuoa/pmr-results-mixed-updated
Tehsurfer Jul 11, 2024
409d9dc
Fix the pmr only button and add text search
Tehsurfer Jul 12, 2024
614bee7
Switch package # to alpha and publish
Tehsurfer Jul 12, 2024
b02c13d
Fix missing gallery thumbnails in sidebar
akhuoa Jul 16, 2024
6e4aa08
Merge pull request #5 from akhuoa/pmr-results-mixed
Tehsurfer Jul 16, 2024
4bb8c6c
Update PMR datasetcard styles to be same as datasetcard
akhuoa Jul 16, 2024
4b1380a
Fix variable name type and now can do text + filter search on pmr
Tehsurfer Jul 16, 2024
8e3c605
Merge branch 'pmr-results-mixed' of https://github.com/Tehsurfer/map-…
Tehsurfer Jul 16, 2024
9b49508
Merge pull request #6 from akhuoa/pmr-results-mixed
Tehsurfer Jul 16, 2024
8f69409
Cleanup code
Tehsurfer Jul 16, 2024
05c1048
Fix issue where label would sometimes grab middle level facet
Tehsurfer Jul 16, 2024
7d0557f
Move pmr results ratio constant to only be set in one location
Tehsurfer Jul 16, 2024
92de980
Increase allowed score but filter on tems, add try/catch for object t…
Tehsurfer Jul 16, 2024
a9c91b6
Add comments explaining mixed results calculations
Tehsurfer Jul 16, 2024
a7c67be
Add flatmap button in PMR card
akhuoa Jul 17, 2024
0e5aa93
Update flatmap button action
akhuoa Jul 17, 2024
c85591a
Format code
akhuoa Jul 17, 2024
cfc8274
No longer use score and exposure check on text searches
Tehsurfer Jul 17, 2024
12f10e4
Add simulation button in PMR datasetcard
akhuoa Jul 17, 2024
249edc7
Format code
akhuoa Jul 17, 2024
8a01000
Update flatmap button event in PMR datasetcard
akhuoa Jul 18, 2024
fe4206f
Update PMR flatmap and simulation action click events
akhuoa Jul 18, 2024
cfad72f
Merge pull request #6 from akhuoa/pmr-results-mixed-features
akhuoa Jul 18, 2024
d6665dd
Add simulation property description in PMR card
akhuoa Jul 18, 2024
e0c2e1e
Merge remote-tracking branch 'jesse/pmr-results-mixed' into pmr-resul…
akhuoa Jul 22, 2024
05ee9e1
Updte PMR search filter terms by using facet instead of label
akhuoa Jul 23, 2024
1625d86
Add open PMR search example in App
akhuoa Jul 23, 2024
b72a6b9
Updte PMR search with PMR only function
akhuoa Jul 23, 2024
d82c2d0
Fix openSearch on first load with filters
akhuoa Jul 23, 2024
8f22d6b
Fix pmr filter conditions
akhuoa Jul 23, 2024
5a1f669
Fix PMR search terms with undefined data
akhuoa Jul 24, 2024
76f2f93
Add loading indicator for PMR cards loading
akhuoa Jul 24, 2024
2e906a6
Fix filter on search history click
akhuoa Jul 24, 2024
f3fd958
Merge branch 'main' into pmr-results-mixed
akhuoa Jul 29, 2024
a572645
Resolve concurrent requests for duplicated items in results
akhuoa Jul 29, 2024
37b20bf
Fix missinng thumbnail
akhuoa Jul 29, 2024
3f05466
Fix show all auto check for data type filters with PMR
akhuoa Jul 29, 2024
d7ed247
Restore hoverChanged console log in App
akhuoa Jul 29, 2024
caa759a
Update envVars props doc
akhuoa Jul 29, 2024
8276800
Update PMR hits label with PMR flag
akhuoa Jul 30, 2024
2aab2ae
Activate withPMRData flag for PMR results
akhuoa Jul 30, 2024
2043bb4
Remmove console log
akhuoa Jul 31, 2024
d639b0e
Update pmr results flag names
akhuoa Jul 31, 2024
a3195d1
Update PMR results flags
akhuoa Jul 31, 2024
a41e0d0
Fix SPARC datasets results after removing PMR
akhuoa Jul 31, 2024
ae1149e
Update results tooltip style to be same as others
akhuoa Aug 5, 2024
d4e98a1
Update detail number of results text to include both SPARC and PMR
akhuoa Aug 7, 2024
1ce7a0b
Update detail number of results text to include both SPARC and PMR
akhuoa Aug 7, 2024
2268043
Handle all search conditions in one place
akhuoa Aug 7, 2024
d4fc6e7
Merge branch 'main' into pmr-results-mixed
akhuoa Aug 18, 2024
99485ea
Add copy-to-clipboard in PMR dataset card
akhuoa Aug 19, 2024
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
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ VITE_APP_PENNSIEVE_API_LOCATION=https://api.pennsieve.io
VITE_APP_ALGOLIA_INDEX=k-core_dev_published_time_desc
VITE_APP_BL_SERVER_URL=
VITE_APP_NL_LINK_PREFIX=
VITE_APP_ROOT_URL=
VITE_APP_ROOT_URL=
VITE_APP_FLATMAP_API_LOCATION='https://mapcore-demo.org/isan/flatmap/'
18 changes: 18 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/>
<div class="options-container">
<div>Click arrow to open sidebar</div>
<el-button @click="openPMRSearch">PMR Search</el-button>
<el-button @click="openSearch">search Uberon from refs</el-button>
<el-button @click="singleFacets">Add heart to Filter</el-button>
<el-button @click="addStomach">Add stomach to Filter</el-button>
Expand All @@ -23,6 +24,7 @@
:tabs="tabs"
:activeTabId="activeId"
:connectivityInfo="connectivityInput"
:withPMRData="true"
@tabClicked="tabClicked"
@search-changed="searchChanged($event)"
@hover-changed="hoverChanged($event)"
Expand Down Expand Up @@ -112,6 +114,7 @@ export default {
BL_SERVER_URL: import.meta.env.VITE_APP_BL_SERVER_URL,
NL_LINK_PREFIX: import.meta.env.VITE_APP_NL_LINK_PREFIX,
ROOT_URL: import.meta.env.VITE_APP_ROOT_URL,
FLATMAP_API_LOCATION: import.meta.env.VITE_APP_FLATMAP_API_LOCATION,
},
connectivityInput: exampleConnectivityInput,
activeId: 1,
Expand All @@ -130,6 +133,9 @@ export default {
// For connectivity input actions
action: function (action) {
console.log('action fired: ', action)
if (action.type === 'Flatmap' || action.type === 'Simulation') {
return;
}
let facets = [];
facets.push(
...action.labels.map(val => ({
Expand All @@ -143,6 +149,18 @@ export default {
this.$refs.sideBar.openSearch(facets, "");
}
},
openPMRSearch: function () {
this.$refs.sideBar.openSearch(
[
{
facet: "PMR",
term: "Data type",
facetPropPath: "item.types.name",
}
],
'cardiovascular multiscale model'
);
},
openSearch: function () {
this.$refs.sideBar.openSearch(
[],
Expand Down
73 changes: 43 additions & 30 deletions src/algolia/algolia.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class AlgoliaClient {
}
if (facet === info[0]) {
filtered.push({
label: info[1],
label: info[1],
id: facetId++,
facetPropPath: `${parentFacet ? parentFacet.facetSubpropPath : undefined}`
});
Expand Down Expand Up @@ -100,6 +100,7 @@ export class AlgoliaClient {
for (let res of results) {
newResult = { ...res }
newResult = {
dataSource: 'SPARC',
anatomy: res.anatomy ? res.anatomy.organ.map((organ => organ.curie)) : undefined,
doi: res.item.curie.split(':')[1],
name: res.item.name,
Expand Down Expand Up @@ -152,35 +153,47 @@ export class AlgoliaClient {
* Get Search results
* This is using fetch from the Algolia API
*/
search(filter, query = '', hitsperPage = 10, page = 1) {
return new Promise(resolve => {
this.index
.search(query, {
facets: ['*'],
hitsPerPage: hitsperPage,
page: page - 1,
filters: filter,
attributesToHighlight: [],
attributesToRetrieve: [
'pennsieve.publishDate',
'pennsieve.updatedAt',
'item.curie',
'item.name',
'item.description',
'objectID',
'anatomy.organ.curie'
],
})
.then(response => {
let searchData = {
items: this._processResultsForCards(response.hits),
total: response.nbHits,
discoverIds: response.hits.map(r => r.pennsieve ? r.pennsieve.identifier : r.objectID),
dois: response.hits.map(r => r.item.curie.split(':')[1])
}
resolve(searchData)
search(filter, query = '', offset = 0, length = 8) {
akhuoa marked this conversation as resolved.
Show resolved Hide resolved
// If the length is 0, return an empty result
if (length === 0) {
return new Promise(resolve => {
resolve({
items: [],
total: 0,
discoverIds: [],
dois: []
})
})
})
} else {
return new Promise(resolve => {
this.index
.search(query, {
facets: ['*'],
offset: offset,
length: length,
filters: filter,
attributesToHighlight: [],
attributesToRetrieve: [
'pennsieve.publishDate',
'pennsieve.updatedAt',
'item.curie',
'item.name',
'item.description',
'objectID',
'anatomy.organ.curie'
],
})
.then(response => {
let searchData = {
items: this._processResultsForCards(response.hits),
total: response.nbHits,
discoverIds: response.hits.map(r => r.pennsieve ? r.pennsieve.identifier : r.objectID),
dois: response.hits.map(r => r.item.curie.split(':')[1])
}
resolve(searchData)
})
})
}
}

/**
Expand Down Expand Up @@ -219,7 +232,7 @@ export class AlgoliaClient {
id: h.objectID,
terms: h.anatomy? h.anatomy.organ.map(o=>o.curie) : []
}))
return curieForDatsets
return curieForDatsets
}
processResultsForScaffold(hits) {
let numberOfDatasetsForAnatomy = {}
Expand Down
9 changes: 7 additions & 2 deletions src/algolia/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,13 @@ export function getFilters(selectedFacetArray=undefined) {
return 'NOT item.published.status:embargo'
}

// Switch the 'term' attribute to 'label' if 'label' does not exist
selectedFacetArray.forEach(f=>f.label=f.facet)
// Switch the 'term' attribute to 'label' if 'label' does not exist. Use facet2 if available
selectedFacetArray.forEach(f=>{
f.label=f.facet
if (f.facet2) {
f.label = f.facet2
}
})


let facets = removeShowAllFacets(selectedFacetArray)
Expand Down
2 changes: 2 additions & 0 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ declare module 'vue' {
ElSelect: typeof import('element-plus/es')['ElSelect']
ElTag: typeof import('element-plus/es')['ElTag']
ExternalResourceCard: typeof import('./components/ExternalResourceCard.vue')['default']
FlatmapDatasetCard: typeof import('./components/FlatmapDatasetCard.vue')['default']
ImageGallery: typeof import('./components/ImageGallery.vue')['default']
PMRDatasetCard: typeof import('./components/PMRDatasetCard.vue')['default']
SearchFilters: typeof import('./components/SearchFilters.vue')['default']
SearchHistory: typeof import('./components/SearchHistory.vue')['default']
SideBar: typeof import('./components/SideBar.vue')['default']
Expand Down
14 changes: 12 additions & 2 deletions src/components/DatasetCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/>
</span>
<div class="card-right">
<el-tag type="primary" class="source-tag">SPARC Dataset</el-tag>
<div class="title" @click="cardClicked">{{ entry.name }}</div>
<div class="details">
{{ contributors }} {{ entry.publishDate ? `(${publishYear})` : '' }}
Expand Down Expand Up @@ -355,6 +356,15 @@ export default {
color: #484848;
cursor: pointer;
}

.source-tag {
margin-bottom: 0.75rem;
margin-right: 2rem;
position: absolute;
bottom: 0;
right: 0;
}

.card {
padding-top: 18px;
position: relative;
Expand Down Expand Up @@ -430,8 +440,8 @@ export default {

.float-button-container {
position: absolute;
bottom: 8px;
right: 16px;
bottom: 0;
right: 4px;
opacity: 0;
visibility: hidden;

Expand Down
Loading