@abi-software/map-side-bar 2.11.4-acupoints.1 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/map-side-bar",
3
- "version": "2.11.4-acupoints.1",
3
+ "version": "2.12.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
package/src/App.vue CHANGED
@@ -18,7 +18,6 @@
18
18
  <el-button @click="keywordSearch">keyword search</el-button>
19
19
  <el-button @click="getFacets">Get facets</el-button>
20
20
  <el-button @click="toggleCreateData">Create Data/Annotation</el-button>
21
- <el-button @click="searchAcupoints">Search Acupoints</el-button>
22
21
  <el-button @click="openConnectivitySearch()">Connectivity Search</el-button>
23
22
  </div>
24
23
  <SideBar
@@ -27,18 +26,14 @@
27
26
  ref="sideBar"
28
27
  :visible="sideBarVisibility"
29
28
  :annotationEntry="annotationEntry"
30
- :acupointsInfoList="acupoints"
31
29
  :createData="createData"
32
30
  :connectivityEntry="connectivityEntry"
33
31
  :connectivityKnowledge="connectivityKnowledge"
34
32
  :showVisibilityFilter="true"
35
- :tabs="tabArray"
36
33
  @search-changed="searchChanged($event)"
37
34
  @hover-changed="hoverChanged($event)"
38
35
  @connectivity-hovered="onConnectivityHovered"
39
36
  @actionClick="action"
40
- @acupoints-clicked="onAcupointsClicked"
41
- @acupoints-hovered="onAcupointsHovered"
42
37
  @connectivity-collapse-change="onConnectivityCollapseChange"
43
38
  />
44
39
  </div>
@@ -47,7 +42,6 @@
47
42
  <script>
48
43
  /* eslint-disable no-alert, no-console */
49
44
  // optionally import default styles
50
- import { acupointEntries } from './acupoints.js'
51
45
  import SideBar from './components/SideBar.vue'
52
46
  import EventBus from './components/EventBus.js'
53
47
  import exampleConnectivityInput from './exampleConnectivityInput.js'
@@ -127,14 +121,6 @@ export default {
127
121
  },
128
122
  data: function () {
129
123
  return {
130
- acupoints: acupointEntries,
131
- contextArray: [null, null],
132
- tabArray: [
133
- { title: 'Dataset Explorer', id: 1, type: 'datasetExplorer', closable: false },
134
- { title: 'Connectivity Explorer', id: 2, type: 'connectivityExplorer', closable: false },
135
- { title: 'Annotation', id: 3, type: 'annotation', closable: true },
136
- {title: 'Acupoints', id: 4, type: 'acupoints' },
137
- ],
138
124
  annotationEntry: [{
139
125
  featureId: "epicardium",
140
126
  resourceId: "https://mapcore-bucket1.s3-us-west-2.amazonaws.com/others/29_Jan_2020/heartICN_metadata.json",
@@ -170,12 +156,6 @@ export default {
170
156
  }
171
157
  },
172
158
  methods: {
173
- onAcupointsClicked: function (data) {
174
- console.log("acupoints-clicked", data)
175
- },
176
- onAcupointsHovered: function (data) {
177
- console.log("acupoints-hovered", data)
178
- },
179
159
  loadConnectivityKnowledge: async function () {
180
160
  const sql = `select knowledge from knowledge
181
161
  where source="${this.sckanVersion}"
@@ -252,9 +232,6 @@ export default {
252
232
  'http://purl.obolibrary.org/obo/UBERON_0001103'
253
233
  )
254
234
  },
255
- searchAcupoints: function() {
256
- this.$refs.sideBar.openAcupointsSearch("LU 1")
257
- },
258
235
  singleFacets: function () {
259
236
  this.$refs.sideBar.addFilter({
260
237
  facet: 'Cardiovascular system',
@@ -429,4 +406,4 @@ body {
429
406
  align-items: center;
430
407
  gap: 0.5rem;
431
408
  }
432
- </style>./acupoints.js
409
+ </style>
@@ -187,24 +187,47 @@ export class AlgoliaClient {
187
187
  * This is using fetch from the Algolia API
188
188
  */
189
189
  search(filter, query = '', hitsperPage = 10, page = 1) {
190
+ const terms = query.replaceAll('"', '').split(",")
191
+ let processed = "";
192
+ const optionalWords = [];
193
+ if (terms) {
194
+ if (terms.length === 1 && (!(query.includes(" ")))) {
195
+ processed = query;
196
+ } else {
197
+ terms.forEach(term => {
198
+ optionalWords.push(term.trim())
199
+ processed += `"${term.trim()}" `;
200
+ });
201
+ }
202
+ }
203
+ processed = processed.trim()
204
+
205
+ const payload = {
206
+ advancedSyntax: true,
207
+ advancedSyntaxFeatures: ['exactPhrase'],
208
+ queryType: 'prefixAll',
209
+ facets: ['*'],
210
+ hitsPerPage: hitsperPage,
211
+ page: page - 1,
212
+ filters: filter,
213
+ attributesToHighlight: [],
214
+ attributesToRetrieve: [
215
+ 'pennsieve.publishDate',
216
+ 'pennsieve.updatedAt',
217
+ 'item.curie',
218
+ 'item.name',
219
+ 'item.description',
220
+ 'objectID',
221
+ 'anatomy.organ.curie'
222
+ ],
223
+ }
224
+ if (optionalWords.length > 1) {
225
+ payload.optionalWords = optionalWords
226
+ }
227
+
190
228
  return new Promise(resolve => {
191
229
  this.index
192
- .search(query, {
193
- facets: ['*'],
194
- hitsPerPage: hitsperPage,
195
- page: page - 1,
196
- filters: filter,
197
- attributesToHighlight: [],
198
- attributesToRetrieve: [
199
- 'pennsieve.publishDate',
200
- 'pennsieve.updatedAt',
201
- 'item.curie',
202
- 'item.name',
203
- 'item.description',
204
- 'objectID',
205
- 'anatomy.organ.curie'
206
- ],
207
- })
230
+ .search(processed, payload)
208
231
  .then(response => {
209
232
  let searchData = {
210
233
  items: this._processResultsForCards(response.hits),
@@ -299,7 +322,7 @@ export class AlgoliaClient {
299
322
  const anatomyOrganSubcategoryNames = anatomyOrganSubcategoryName ? Object.keys(anatomyOrganSubcategoryName) : []
300
323
  const anatomyOrganSubsubcategoryNames = anatomyOrganSubsubcategoryName ? Object.keys(anatomyOrganSubsubcategoryName) : []
301
324
  const filteredOrganNames = []
302
-
325
+
303
326
  anatomyOrganCategoryNames.forEach((_categoryName) => {
304
327
  const categoryName = _categoryName.toLowerCase();
305
328
  anatomyOrganNames.forEach((_organName) => {
@@ -313,7 +336,7 @@ export class AlgoliaClient {
313
336
  } else {
314
337
  return anatomyOrganSubsubcategoryNames.find((name) => {
315
338
  const fullsubsubname = `${subcategoryName}.${organName}`
316
- return (fullsubsubname === name)
339
+ return (fullsubsubname === name)
317
340
  })
318
341
  }
319
342
  });
@@ -0,0 +1,90 @@
1
+
2
+ .filter-help-popover {
3
+ font-family: 'Asap', sans-serif;
4
+ background: #f3ecf6 !important;
5
+ border: 1px solid $app-primary-color !important;
6
+ border-radius: 4px !important;
7
+ color: #303133 !important;
8
+ font-size: 12px !important;
9
+ line-height: 18px !important;
10
+
11
+ > div {
12
+ word-break: break-word;
13
+ text-align: initial;
14
+ }
15
+
16
+ ul {
17
+ padding-left: 1.5rem;
18
+
19
+ > li + li {
20
+ margin-top: 0.5rem;
21
+ }
22
+ }
23
+
24
+ .el-popper__arrow::before {
25
+ background: #f3ecf6 !important;
26
+ border-color: $app-primary-color !important;
27
+ }
28
+
29
+ &[data-popper-placement^=bottom] .el-popper__arrow:before {
30
+ border-bottom-color: transparent !important;
31
+ border-right-color: transparent !important;
32
+ }
33
+
34
+ code {
35
+ font-size: 90%;
36
+ }
37
+ }
38
+
39
+ .header {
40
+ display: flex;
41
+ align-items: center;
42
+
43
+ .el-button {
44
+ font-family: inherit;
45
+
46
+ &:hover,
47
+ &:focus {
48
+ background: $app-primary-color;
49
+ box-shadow: -3px 2px 4px #00000040;
50
+ color: #ffffff;
51
+ }
52
+ }
53
+ }
54
+
55
+ .help {
56
+ width: 24px !important;
57
+ height: 24px;
58
+ transform: scale(1.1);
59
+ cursor: pointer;
60
+ color: #ffffff !important;
61
+ }
62
+
63
+ .search-input {
64
+ width: 298px !important;
65
+ height: 40px;
66
+ padding-right: 14px;
67
+ font-family: inherit;
68
+
69
+ :deep(.el-input__inner) {
70
+ font-family: inherit;
71
+ }
72
+ }
73
+
74
+ .search-input-container {
75
+ position: relative;
76
+ display: flex;
77
+ align-items: center;
78
+
79
+ .map-icon {
80
+ position: absolute;
81
+ right: 18px;
82
+ color: $app-primary-color !important;
83
+ }
84
+
85
+ &.is-focus {
86
+ .map-icon {
87
+ display: none;
88
+ }
89
+ }
90
+ }
@@ -646,6 +646,7 @@ export default {
646
646
  </script>
647
647
 
648
648
  <style lang="scss" scoped>
649
+ @import '../assets/searchPopover.scss';
649
650
  @import '../assets/pagination.scss';
650
651
 
651
652
  .connectivity-card {
@@ -700,51 +701,6 @@ export default {
700
701
  }
701
702
  }
702
703
 
703
- .search-input {
704
- width: 298px !important;
705
- height: 40px;
706
- padding-right: 14px;
707
- font-family: inherit;
708
-
709
- :deep(.el-input__inner) {
710
- font-family: inherit;
711
- }
712
- }
713
-
714
- .search-input-container {
715
- position: relative;
716
- display: flex;
717
- align-items: center;
718
-
719
- .map-icon {
720
- position: absolute;
721
- right: 18px;
722
- color: $app-primary-color !important;
723
- }
724
-
725
- &.is-focus {
726
- .map-icon {
727
- display: none;
728
- }
729
- }
730
- }
731
-
732
- .header {
733
- display: flex;
734
- align-items: center;
735
-
736
- .el-button {
737
- font-family: inherit;
738
-
739
- &:hover,
740
- &:focus {
741
- background: $app-primary-color;
742
- box-shadow: -3px 2px 4px #00000040;
743
- color: #ffffff;
744
- }
745
- }
746
- }
747
-
748
704
  .error-feedback {
749
705
  font-family: Asap;
750
706
  font-size: 14px;
@@ -864,48 +820,4 @@ export default {
864
820
  }
865
821
  }
866
822
 
867
- .help {
868
- width: 24px !important;
869
- height: 24px;
870
- transform: scale(1.1);
871
- cursor: pointer;
872
- color: #ffffff !important;
873
- }
874
-
875
- .filter-help-popover {
876
- font-family: 'Asap', sans-serif;
877
- background: #f3ecf6 !important;
878
- border: 1px solid $app-primary-color !important;
879
- border-radius: 4px !important;
880
- color: #303133 !important;
881
- font-size: 12px !important;
882
- line-height: 18px !important;
883
-
884
- > div {
885
- word-break: break-word;
886
- text-align: initial;
887
- }
888
-
889
- ul {
890
- padding-left: 1.5rem;
891
-
892
- > li + li {
893
- margin-top: 0.5rem;
894
- }
895
- }
896
-
897
- .el-popper__arrow::before {
898
- background: #f3ecf6 !important;
899
- border-color: $app-primary-color !important;
900
- }
901
-
902
- &[data-popper-placement^=bottom] .el-popper__arrow:before {
903
- border-bottom-color: transparent !important;
904
- border-right-color: transparent !important;
905
- }
906
-
907
- code {
908
- font-size: 90%;
909
- }
910
- }
911
823
  </style>
@@ -2,14 +2,50 @@
2
2
  <el-card :body-style="bodyStyle" class="content-card">
3
3
  <template #header>
4
4
  <div class="header">
5
- <el-input
6
- class="search-input"
7
- placeholder="Search"
8
- v-model="searchInput"
9
- @keyup="searchEvent"
10
- clearable
11
- @clear="clearSearchClicked"
12
- ></el-input>
5
+ <div class="search-input-container" :class="{'is-focus': searchInput}">
6
+ <el-input
7
+ class="search-input"
8
+ placeholder="Search"
9
+ v-model="searchInput"
10
+ @keyup="searchEvent"
11
+ clearable
12
+ @clear="clearSearchClicked"
13
+ ></el-input>
14
+ <el-popover
15
+ width="350"
16
+ trigger="hover"
17
+ popper-class="filter-help-popover"
18
+ >
19
+ <template #reference>
20
+ <MapSvgIcon icon="help" class="help" />
21
+ </template>
22
+ <div>
23
+ <strong>Search rules:</strong>
24
+ <ul>
25
+ <li>
26
+ <strong>Multiple Terms:</strong> Separate terms with a comma (<code>,</code>).
27
+ This will find dataset that match any of the terms (an "OR" search).
28
+ </li>
29
+ <li>
30
+ <strong>Exact Phrase:</strong> Terms within a comma block will be matched as exact phrase.
31
+ </li>
32
+ </ul>
33
+ <br/>
34
+ <strong>Examples:</strong>
35
+ <ul>
36
+ <li>
37
+ <strong>To find by exact phrase:</strong>
38
+ Searching for <code>vagus nerve</code> will find any dataset containing <code>vagus nerve</code>.
39
+ </li>
40
+ <li>
41
+ <strong>To find by multiple terms:</strong>
42
+ Searching for <code>kidney, vagus</code> will find data that contains either <code>kidney</code> OR <code>vagus</code>.
43
+ Due to the limitation of the search engine, space between words in a comma block will be treated as comma when multiple terms search is active.
44
+ </li>
45
+ </ul>
46
+ </div>
47
+ </el-popover>
48
+ </div>
13
49
  <el-button
14
50
  type="primary"
15
51
  class="button"
@@ -90,6 +126,7 @@ import EventBus from './EventBus.js'
90
126
  import { AlgoliaClient } from '../algolia/algolia.js'
91
127
  import { getFilters, facetPropPathMapping } from '../algolia/utils.js'
92
128
  import { markRaw } from 'vue'
129
+ import { MapSvgIcon, MapSvgSpriteColor } from "@abi-software/svg-sprite";
93
130
 
94
131
  // handleErrors: A custom fetch error handler to recieve messages from the server
95
132
  // even when an error is found
@@ -130,7 +167,9 @@ export default {
130
167
  Drawer,
131
168
  Icon,
132
169
  Input,
133
- Pagination
170
+ Pagination,
171
+ MapSvgIcon,
172
+ MapSvgSpriteColor
134
173
  },
135
174
  name: 'DatasetExplorer',
136
175
  props: {
@@ -537,6 +576,7 @@ export default {
537
576
  </script>
538
577
 
539
578
  <style lang="scss" scoped>
579
+ @import '../assets/searchPopover.scss';
540
580
  @import '../assets/pagination.scss';
541
581
 
542
582
  .dataset-card {
@@ -577,29 +617,6 @@ export default {
577
617
  text-align: left;
578
618
  }
579
619
 
580
- .search-input {
581
- width: 298px !important;
582
- height: 40px;
583
- padding-right: 14px;
584
-
585
- :deep(.el-input__inner) {
586
- font-family: inherit;
587
- }
588
- }
589
-
590
- .header {
591
- .el-button {
592
- font-family: inherit;
593
-
594
- &:hover,
595
- &:focus {
596
- background: $app-primary-color;
597
- box-shadow: -3px 2px 4px #00000040;
598
- color: #fff;
599
- }
600
- }
601
- }
602
-
603
620
  .error-feedback {
604
621
  font-family: Asap;
605
622
  font-size: 14px;
@@ -64,14 +64,6 @@
64
64
  @connectivity-item-close="onConnectivityItemClose"
65
65
  />
66
66
  </template>
67
- <template v-else-if="tab.type === 'acupoints' && acupointsInfoList">
68
- <acupoints-info-search
69
- :ref="'acupointsTab_' + tab.id"
70
- :entry="acupointsInfoList"
71
- @on-acupoints-click="acupointClicked"
72
- v-show="tab.id === activeTabId"
73
- />
74
- </template>
75
67
  <template v-else>
76
68
  <DatasetExplorer
77
69
  class="sidebar-content-container"
@@ -100,7 +92,6 @@ import { ElDrawer as Drawer, ElIcon as Icon } from 'element-plus'
100
92
  import DatasetExplorer from './DatasetExplorer.vue'
101
93
  import EventBus from './EventBus.js'
102
94
  import Tabs from './Tabs.vue'
103
- import AcupointsInfoSearch from './AcupointsInfoSearch.vue'
104
95
  import AnnotationTool from './AnnotationTool.vue'
105
96
  import ConnectivityExplorer from './ConnectivityExplorer.vue'
106
97
  import { removeShowAllFacets } from '../algolia/utils.js'
@@ -160,13 +151,6 @@ export default {
160
151
  type: Array,
161
152
  default: [],
162
153
  },
163
- /**
164
- * The acupoints info to show in sidebar.
165
- */
166
- acupointsInfoList: {
167
- type: Object,
168
- default: null,
169
- },
170
154
  /**
171
155
  * The annotation data to show in sidebar.
172
156
  */
@@ -220,13 +204,6 @@ export default {
220
204
  }
221
205
  },
222
206
  methods: {
223
- /**
224
- * This event is emitted with a mouse click on acupoint card
225
- * @arg data
226
- */
227
- acupointClicked: function (data) {
228
- this.$emit('acupoints-clicked', data)
229
- },
230
207
  onConnectivityCollapseChange: function (data) {
231
208
  this.$emit('connectivity-collapse-change', data)
232
209
  },
@@ -318,6 +295,9 @@ export default {
318
295
  datasetExplorerTabRef.openSearch(facets, query);
319
296
  })
320
297
  },
298
+ /**
299
+ * Get the ref id of the tab by id and type.
300
+ */
321
301
  getTabRef: function (id, type, switchTab = false) {
322
302
  const matchedTab = this.tabEntries.filter((tabEntry) => {
323
303
  return (id === undefined || tabEntry.id === id) &&
@@ -427,14 +407,6 @@ export default {
427
407
  updateConnectivityError: function (errorInfo) {
428
408
  EventBus.emit('connectivity-error', errorInfo);
429
409
  },
430
- openAcupointsSearch: function (term) {
431
- this.drawerOpen = true
432
- // Because refs are in v-for, nextTick is needed here
433
- this.$nextTick(() => {
434
- const tabRef = this.getTabRef(undefined, 'acupoints', true);
435
- tabRef.search(term);
436
- })
437
- },
438
410
  /**
439
411
  * Store available anatomy facets data for connectivity list component
440
412
  */
@@ -531,11 +503,6 @@ export default {
531
503
  // This should respect the information provided by the property
532
504
  tabEntries: function () {
533
505
  return this.tabs.filter((tab) =>
534
- (tab.type === "acupoints" &&
535
- (
536
- this.acupointsInfoList &&
537
- Object.keys(this.acupointsInfoList).length > 0
538
- )) ||
539
506
  tab.type === "datasetExplorer" ||
540
507
  tab.type === "connectivityExplorer" ||
541
508
  (
@@ -598,16 +565,6 @@ export default {
598
565
  this.$emit('connectivity-source-change', payLoad);
599
566
  })
600
567
 
601
- // Emit acupoints clicked event
602
- EventBus.on('acupoints-clicked', (payLoad) => {
603
- this.$emit('acupoints-clicked', payLoad);
604
- })
605
-
606
- // Emit acupoints hovered event
607
- EventBus.on('acupoints-hovered', (payLoad) => {
608
- this.$emit('acupoints-hovered', payLoad);
609
- })
610
-
611
568
  // Get available anatomy facets for the connectivity info
612
569
  EventBus.on('available-facets', (payLoad) => {
613
570
  this.availableAnatomyFacets = payLoad.find((facet) => facet.label === 'Anatomical Structure').children
@@ -7,8 +7,6 @@ export {}
7
7
 
8
8
  declare module 'vue' {
9
9
  export interface GlobalComponents {
10
- AcupointsCard: typeof import('./components/AcupointsCard.vue')['default']
11
- AcupointsInfoSearch: typeof import('./components/AcupointsInfoSearch.vue')['default']
12
10
  AnnotationTool: typeof import('./components/AnnotationTool.vue')['default']
13
11
  BadgesGroup: typeof import('./components/BadgesGroup.vue')['default']
14
12
  ConnectivityCard: typeof import('./components/ConnectivityCard.vue')['default']
@@ -21,8 +19,6 @@ declare module 'vue' {
21
19
  ElCascader: typeof import('element-plus/es')['ElCascader']
22
20
  ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
23
21
  ElCol: typeof import('element-plus/es')['ElCol']
24
- ElCollapse: typeof import('element-plus/es')['ElCollapse']
25
- ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
26
22
  ElDrawer: typeof import('element-plus/es')['ElDrawer']
27
23
  ElDropdown: typeof import('element-plus/es')['ElDropdown']
28
24
  ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
@@ -42,7 +38,6 @@ declare module 'vue' {
42
38
  ElPagination: typeof import('element-plus/es')['ElPagination']
43
39
  ElPopover: typeof import('element-plus/es')['ElPopover']
44
40
  ElRadio: typeof import('element-plus/es')['ElRadio']
45
- ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
46
41
  ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
47
42
  ElRow: typeof import('element-plus/es')['ElRow']
48
43
  ElSelect: typeof import('element-plus/es')['ElSelect']
package/src/acupoints.js DELETED
@@ -1,49 +0,0 @@
1
- export const acupointEntries = {
2
- "LU 1": {
3
- "Acupoint": "LU 1",
4
- "Label": "LU 1",
5
- "Synonym": "Test data",
6
- "UMLS CUI": "",
7
- "Meridian": "LTest data",
8
- "Chinese Name": "Zhongfu",
9
- "English Name": "Central Treasury",
10
- "Location": " z zxczc.",
11
- "Reference": "Test data",
12
- "Indications": "Test data",
13
- "Acupuncture Method": "Test data",
14
- "Vasculature": "Test data",
15
- "Innervation": "Test data",
16
- "Curated": false,
17
- },
18
- "LU 2": {
19
- "Acupoint": "LU 2",
20
- "Label": "LU 2",
21
- "Synonym": "Test data",
22
- "UMLS CUI": "",
23
- "Meridian": "LTest data",
24
- "Chinese Name": "Yunmen",
25
- "English Name": "Cloud Gate",
26
- "Location": " z zxczc.",
27
- "Reference": "Test data",
28
- "Indications": "Test data",
29
- "Acupuncture Method": "Test data",
30
- "Vasculature": "Test data",
31
- "Innervation": "Test data",
32
- "Curated": true,
33
- },
34
- "ST 3": {
35
- "Acupoint": "ST 3",
36
- "Label": "ST 3",
37
- "Synonym": "Test data",
38
- "UMLS CUI": "",
39
- "Meridian": "STest data",
40
- "Chinese Name": "Cheng Qi",
41
- "English Name": "Not Available",
42
- "Location": " z zxcxadadadzc.",
43
- "Reference": "Test data",
44
- "Indications": "Test data",
45
- "Acupuncture Method": "Test data",
46
- "Vasculature": "Test data",
47
- "Innervation": "Test data"
48
- }
49
- }