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

Uat release #122

Closed
wants to merge 83 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
eee11fe
OLS search for filtered ontologies
yelenacox Oct 10, 2024
903d94e
added fetch function for ols search
yelenacox Oct 10, 2024
156100e
OLS ontology filters for mapping search
yelenacox Oct 15, 2024
27ff5fe
first pass at editing ontology filters
yelenacox Oct 15, 2024
970dee2
Delete preferred ontologies
yelenacox Oct 15, 2024
b0519ec
committing to switch branches
yelenacox Oct 15, 2024
3697025
Newly added ontologies checking by default on load
yelenacox Oct 16, 2024
a3bdbe2
ontology filter for mappings search
yelenacox Oct 16, 2024
642e2b1
Removed unnecesary console logs
yelenacox Oct 16, 2024
fd8452f
OLS search for filtered ontologies
yelenacox Oct 10, 2024
ada5d61
added fetch function for ols search
yelenacox Oct 10, 2024
ede8b8c
OLS ontology filters for mapping search
yelenacox Oct 15, 2024
02fa958
first pass at editing ontology filters
yelenacox Oct 15, 2024
77dbfe3
Delete preferred ontologies
yelenacox Oct 15, 2024
9b128e5
committing to switch branches
yelenacox Oct 15, 2024
79255a5
Newly added ontologies checking by default on load
yelenacox Oct 16, 2024
bd0e506
ontology filter for mappings search
yelenacox Oct 16, 2024
48cefbb
Removed unnecesary console logs
yelenacox Oct 16, 2024
895a02c
Rebased branch
yelenacox Oct 16, 2024
c4288c8
Merge branch 'main' into ontology-filter-search
yelenacox Oct 16, 2024
b171c4b
Merge branch 'main' of https://github.com/NIH-NCPI/map-dragon into on…
mhigbyflowers Oct 17, 2024
3f3c811
Merge branch 'ontology-filter-search' of https://github.com/NIH-NCPI/…
yelenacox Oct 17, 2024
a902065
Updated .gitignore
yelenacox Oct 17, 2024
3e80ca6
cleaned up .env
yelenacox Oct 17, 2024
91bf1c5
Committing to switch branch
yelenacox Oct 17, 2024
b71723e
Ran git rm -r --cached .
yelenacox Oct 17, 2024
bceb2ae
Merge pull request #116 from NIH-NCPI/ontology-filter-search
yelenacox Oct 17, 2024
f14accb
Committing changes to complete merge
yelenacox Oct 17, 2024
3771f7d
Ontologies with number of results on search page
yelenacox Oct 17, 2024
ba803a8
changed formatting for ontology counts for checkbox display
yelenacox Oct 17, 2024
0c470b2
[FD-1727]showing description in GetMappingsModal MappingRest and Mapp…
mhigbyflowers Oct 18, 2024
d1d0730
Working on updating ontologies for search by checkbox check
yelenacox Oct 18, 2024
afc0d9e
added pagesize select + remembering pagesize to TerminologyList
mhigbyflowers Oct 21, 2024
2c9a1ef
unchecked checkboxes remove ontology from api call
yelenacox Oct 21, 2024
e798b24
null check
mhigbyflowers Oct 21, 2024
a2e5e5f
fixes
mhigbyflowers Oct 21, 2024
43ebdff
Merge pull request #117 from NIH-NCPI/FD-1727/term_desc
mhigbyflowers Oct 21, 2024
1911029
code searching by terminology's filter ontologies
yelenacox Oct 21, 2024
2e5f106
Merge branch 'main' of https://github.com/NIH-NCPI/map-dragon into FD…
mhigbyflowers Oct 21, 2024
8824917
OntologyTable √
mhigbyflowers Oct 21, 2024
3beb65b
tableDetails √
mhigbyflowers Oct 21, 2024
945a800
Terminology √
mhigbyflowers Oct 21, 2024
234fe1e
default ontologies checking by default
yelenacox Oct 22, 2024
fe5ff4c
c2c
mhigbyflowers Oct 22, 2024
11bb27a
user and access the setmapping window from table
mhigbyflowers Oct 22, 2024
d4096f5
user and access the setmapping window from table
mhigbyflowers Oct 22, 2024
eec9f38
all ontologies listed with checkboxes
yelenacox Oct 22, 2024
644225b
Merge pull request #118 from NIH-NCPI/FD-1720/pagination-pagesize
mhigbyflowers Oct 22, 2024
6743206
checkboxes checking and updating apiPreferencesCode
yelenacox Oct 22, 2024
f0f3d9e
adding delete mapping from table
mhigbyflowers Oct 23, 2024
16832f2
adding ant icons
mhigbyflowers Oct 23, 2024
d0be76d
adding styling
mhigbyflowers Oct 23, 2024
7e22997
Get MappingS
mhigbyflowers Oct 23, 2024
7fb589c
updating comment
mhigbyflowers Oct 23, 2024
7624d02
Ontology filter payload for code
yelenacox Oct 23, 2024
1d567fe
sticky nav
mhigbyflowers Oct 23, 2024
04e6b32
Saving preferred ontologies for code
yelenacox Oct 23, 2024
b3c61bc
using pathname for labels
mhigbyflowers Oct 23, 2024
8286622
working breadcrumbs and redirect
mhigbyflowers Oct 24, 2024
953563b
redirects + styles
mhigbyflowers Oct 24, 2024
946e36e
style tweak
mhigbyflowers Oct 24, 2024
4b66f4d
revert style tweak
mhigbyflowers Oct 24, 2024
64ce09a
container style tweaks
mhigbyflowers Oct 24, 2024
78b1077
breadcrumb style tweaks
mhigbyflowers Oct 24, 2024
87aa209
Filter ontologies for terminology codes
yelenacox Oct 24, 2024
ccf1eac
crumb color
mhigbyflowers Oct 24, 2024
810ae2e
adding to terminology
mhigbyflowers Oct 24, 2024
954e277
margins
mhigbyflowers Oct 24, 2024
d431cd0
rm fixed ontology table
mhigbyflowers Oct 24, 2024
a046638
about_container margin
mhigbyflowers Oct 24, 2024
120e237
moved 'no results found' to still display any selected mappings
yelenacox Oct 24, 2024
db26d7b
Styling fix for FilterAPIs to stop results from appearing mid-page
yelenacox Oct 24, 2024
3070bb0
changed labels in nav bar for accuracy
yelenacox Oct 24, 2024
d7ee7c2
modified endpoint in .env
yelenacox Oct 24, 2024
fd63aee
Merge pull request #119 from NIH-NCPI/FD-1729/Update_mapping_GUI
mhigbyflowers Oct 24, 2024
292bc5d
adding /Study/:studyId/DataDictionary/:DDId/Table/:tableId/Terminolo…
mhigbyflowers Oct 24, 2024
5d2bdd4
Merge pull request #120 from NIH-NCPI/FD-1730/breadcrumbs
mhigbyflowers Oct 24, 2024
f81dc80
Merged main with new main
yelenacox Oct 24, 2024
f4822ff
CSS styling for footer and main content
yelenacox Oct 24, 2024
fed7c53
Merge branch 'main' into onto-filter-code/fd-1638
yelenacox Oct 24, 2024
cd0ae9b
Update Terminology.jsx
yelenacox Oct 24, 2024
b667d18
fixed it
mhigbyflowers Oct 24, 2024
2dc6803
Merge pull request #121 from NIH-NCPI/onto-filter-code/fd-1638
yelenacox Oct 24, 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
6 changes: 6 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
VITE_SEARCH_ENDPOINT = https://www.ebi.ac.uk/ols4/api/search?
VITE_MONARCH_SEARCH = https://api-v3.monarchinitiative.org/v3/api/search?
# VITE_VOCAB_ENDPOINT = http://127.0.0.1:5000/api # local
VITE_VOCAB_ENDPOINT = https://locutus-110109177269.us-central1.run.app/api # dev
# VITE_VOCAB_ENDPOINT = https://locutus-1066621297011.us-central1.run.app/api # uat
VITE_CLIENT_ID = 907694787484-36jr4oaf04mmniik6482batc87ejemm8.apps.googleusercontent.com
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ dist-ssr
.env.local
.env.qa
.env.dev
.env
15 changes: 8 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"preview": "vite preview"
},
"dependencies": {
"@ant-design/icons": "^5.5.1",
"@react-oauth/google": "^0.12.1",
"antd": "^5.15.2",
"jwt-decode": "^4.0.0",
Expand Down
3 changes: 2 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const myContext = createContext();

function App() {
const searchUrl = import.meta.env.VITE_SEARCH_ENDPOINT;
const monarchUrl = import.meta.env.VITE_MONARCH_SEARCH;
const vocabUrl = import.meta.env.VITE_VOCAB_ENDPOINT;
const clientId = import.meta.env.VITE_CLIENT_ID;

Expand Down Expand Up @@ -40,13 +41,13 @@ function App() {
top: '25vh',
});
return (

<GoogleOAuthProvider clientId={clientId}>
<myContext.Provider
value={{
results,
setResults,
searchUrl,
monarchUrl,
vocabUrl,
tablesDD,
setTablesDD,
Expand Down
3 changes: 3 additions & 0 deletions src/App.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
.approuter_div {
display: flex;
flex-direction: column;
justify-content: space-between;
}

.outlet_div {
height: 100%;
min-height: 100vh;
position: relative;
// top:-2.5rem;
}
26 changes: 21 additions & 5 deletions src/AppRouter.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { OntologySearch } from './components/Search/OntologySearch';
import { BrowserRouter, Outlet, Route, Routes } from 'react-router-dom';
import { BrowserRouter, Outlet, Route, Routes, Navigate } from 'react-router-dom';
import { NavBar } from './components/Nav/NavBar';
import { Breadcrumbs } from './components/Nav/Breadcrumbs.jsx';
import { Footer } from './components/Nav/Footer';
import { SearchResults } from './components/Search/SearchResults';
import { Terminology } from './components/Projects/Terminologies/Terminology';
Expand All @@ -27,6 +28,7 @@ export const AppRouter = () => {
<>
<div className="approuter_div">
<NavBar />
<Breadcrumbs />
<div className="outlet_div">
<Outlet />
</div>
Expand All @@ -41,17 +43,31 @@ export const AppRouter = () => {
<Route path="/404" element={<Error404 />} />
<Route path="/about" element={<OntologyInfo />} />
<Route path="/terminologies" element={<TerminologyList />} />
<Route path="/terminology" element={<Navigate to="/terminologies" />} />
<Route element={<MappingContextRoot />}>
<Route element={<SearchContextRoot />}>
<Route path="/studies" element={<StudyList />} />
<Route path="/study" element={<Navigate to="/studies" />} />
<Route path="/Study/:studyId">
<Route index element={<StudyDetails />} />
<Route path="/Study/:studyId/DataDictionary/:DDId">
<Route index element={<DDDetails />} />
<Route path="DataDictionary">
<Route index element={<StudyDetails />} />
<Route
path="/Study/:studyId/DataDictionary/:DDId/Table/:tableId"
element={<TableDetails />}
path="/Study/:studyId/DataDictionary/:DDId/Table/"
element={<DDDetails />}
/>
<Route path="/Study/:studyId/DataDictionary/:DDId">
<Route index element={<DDDetails />} />
<Route
path="/Study/:studyId/DataDictionary/:DDId/Table/:tableId"
element={<TableDetails />}
/>
<Route
path="/Study/:studyId/DataDictionary/:DDId/Table/:tableId/Terminology/:terminologyId"
element={<Terminology />}
/>
<Route path="/Study/:studyId/DataDictionary/:DDId/Table/:tableId/Terminology/" element={<Terminology />} />
</Route>
</Route>
</Route>
<Route
Expand Down
18 changes: 18 additions & 0 deletions src/Contexts/SearchContext.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ export function SearchContextRoot() {
const [apiResultsCount, setApiResultsCount] = useState();
const [apiPage, setApiPage] = useState(0);
const [apiTotalCount, setApiTotalCount] = useState();
const [apiPreferences, setApiPreferences] = useState({});
const [apiPreferencesCode, setApiPreferencesCode] = useState(undefined);
const [unformattedPref, setUnformattedPref] = useState([]);
const [facetCounts, setFacetCounts] = useState([]);
const [ontologyApis, setOntologyApis] = useState([]);

const defaultOntologies = 'mondo,hp,maxo,ncit';

const context = {
prefTerminologies,
Expand All @@ -30,6 +37,17 @@ export function SearchContextRoot() {
setApiPage,
apiTotalCount,
setApiTotalCount,
apiPreferences,
setApiPreferences,
apiPreferencesCode,
setApiPreferencesCode,
defaultOntologies,
facetCounts,
setFacetCounts,
unformattedPref,
setUnformattedPref,
ontologyApis,
setOntologyApis,
};

return (
Expand Down
4 changes: 1 addition & 3 deletions src/components/About/OntologyInfo.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import '../Styling/Variables';

.about_container {
margin: 17vh 10vw 10vh 10vw;
margin: 0 10vw;
line-height: 1.5rem;
}

Expand All @@ -13,7 +13,6 @@
.api_list {
width: 12vw;
height: fit-content;
position: fixed;
display: flex;
flex-flow: column wrap;
gap: 2px;
Expand All @@ -40,7 +39,6 @@
}
.ontology_list {
margin: 0 0 0 15vw;
position: fixed;
top: 20vh;
height: 20%;
width: 70vw;
Expand Down
19 changes: 18 additions & 1 deletion src/components/About/OntologyTable.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import { Button, Input, Space, Table } from 'antd';
import { SearchOutlined } from '@ant-design/icons';
import { useState } from 'react';
import { useState, useEffect } from 'react';

export const OntologyTable = ({ ontology }) => {
const [filter, setFilter] = useState(null);

const [pageSize, setPageSize] = useState(
parseInt(localStorage.getItem('pageSize'), 10) || 10);
const handleTableChange = (current, size) => {
setPageSize(size);
};
useEffect(() => {
localStorage.setItem('pageSize', pageSize);
}, [pageSize]);

const ontologyTitle = () => {
return (
<div className="ontology_filter">
Expand Down Expand Up @@ -85,13 +94,21 @@ export const OntologyTable = ({ ontology }) => {
}))
);



return (
<Table
columns={columns}
dataSource={dataSource}
scroll={{
y: 470,
}}
pagination={{
showSizeChanger: true,
pageSizeOptions: ['10', '20', '30'],
pageSize: pageSize, // Use the stored pageSize
onChange: handleTableChange, // Capture pagination changes
}}
/>
);
};
115 changes: 115 additions & 0 deletions src/components/Manager/FetchManager.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ontologyReducer } from './Utilitiy';

// Fetches all elements at an endpoint
export const getAll = (vocabUrl, name, navigate) => {
return fetch(`${vocabUrl}/${name}`, {
Expand Down Expand Up @@ -165,3 +167,116 @@ export const getOntologies = vocabUrl => {
}
});
};

export const olsFilterOntologiesSearch = (
searchUrl,
query,
ontologiesToSearch,
page,
entriesPerPage,
pageStart,
selectedBoxes,
setTotalCount,
setResults,
setFilteredResultsCount,
setResultsCount,
setLoading,
results,
setFacetCounts
) => {
setLoading(true);
return fetch(
`${searchUrl}q=${query}&ontology=${ontologiesToSearch}&rows=${entriesPerPage}&start=${pageStart}`,
{
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
}
)
.then(res => res.json())
.then(data => {
// filters results through the ontologyReducer function (defined in Manager/Utility.jsx)

let res = ontologyReducer(data?.response?.docs);
// if the page > 0 (i.e. if this is not the first batch of results), the new results
// are concatenated to the old
if (selectedBoxes) {
res.results = res.results.filter(
d => !selectedBoxes.some(box => box.obo_id === d.obo_id)
);
}

if (page > 0 && results.length > 0) {
res.results = results.concat(res.results);

// Apply filtering to remove results with obo_id in selectedBoxes
} else {
// Set the total number of search results for pagination
setTotalCount(data.response.numFound);
}

//the results are set to res (the filtered, concatenated results)

setResults(res.results);
setFilteredResultsCount(res?.filteredResults?.length);
// resultsCount is set to the length of the filtered, concatenated results for pagination
setResultsCount(res.results.length);
setFacetCounts(data?.facet_counts?.facet_fields?.ontologyPreferredPrefix);
})
.finally(() => setLoading(false));
};

export const getFiltersByCode = (
vocabUrl,
component,
mappingProp,
setApiPreferencesCode,
notification,
apiPreferencesCode,
setUnformattedPref,
table
) => {
return fetch(
`${vocabUrl}/${
component === table
? component?.terminology?.reference
: `Terminology/${component?.id}`
}/filter/${mappingProp}`,
{
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
}
)
.then(res => {
if (res.ok) {
return res.json();
} else {
throw new Error('An unknown error occurred.');
}
})
.then(data => {
setUnformattedPref(data);

// Dynamically derive the mappingProp based on a condition or the structure of the data
const codeToSearch = Object.keys(data)[0]; // Example: get the first key in the object
if (data?.[codeToSearch]?.api_preference?.ols) {
const joinedOntologies =
data[codeToSearch].api_preference.ols.join(',');
setApiPreferencesCode(joinedOntologies); // Set state to the comma-separated string
} else {
setApiPreferencesCode(''); // Fallback if no ols found
}
})
.catch(error => {
if (error) {
notification.error({
message: 'Error',
description: 'An error occurred loading the ontology preferences.',
});
}
return error;
});
};
Loading
Loading