Skip to content

Commit

Permalink
Added queue archive filter for studies.
Browse files Browse the repository at this point in the history
  • Loading branch information
tblock79 committed Jul 24, 2024
1 parent 0691346 commit f2c35b8
Show file tree
Hide file tree
Showing 21 changed files with 8,919 additions and 13 deletions.
7 changes: 6 additions & 1 deletion bookkeeping/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,15 @@ async def get_task_process_logs(request) -> JSONResponse:
@requires("authenticated")
async def find_task(request) -> JSONResponse:
search_term = request.query_params.get("search_term", "")
study_filter = request.query_params.get("study_filter", "false")
filter_term = ""
if search_term:
filter_term = f"""and ((tag_accessionnumber ilike '{search_term}%') or (tag_patientid ilike '{search_term}%') or (tag_patientname ilike '%{search_term}%'))"""

study_filter_term = ""
if study_filter=="true":
study_filter_term = "and tasks.study_uid is not null"

query = sqlalchemy.text(
f""" select tasks.id as task_id,
tag_accessionnumber as acc,
Expand All @@ -176,7 +181,7 @@ async def find_task(request) -> JSONResponse:
tasks.time as time
from tasks
left join dicom_series on dicom_series.series_uid = tasks.series_uid
where parent_id is null {filter_term}
where parent_id is null {filter_term} {study_filter_term}
order by date_trunc('second', tasks.time) desc, tasks.id desc
limit 256 """
)
Expand Down
4 changes: 2 additions & 2 deletions common/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ async def get_tests() -> Any:
return await get("query/tests")


async def find_tasks(search_term="") -> Any:
return await get("query/find_task", {"search_term": search_term})
async def find_tasks(search_term="", study_filter="false") -> Any:
return await get("query/find_task", {"search_term": search_term, "study_filter": study_filter})


async def task_process_logs(task_id="") -> Any:
Expand Down
3 changes: 2 additions & 1 deletion webinterface/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ async def get_tests(request):
@requires(["authenticated"])
async def find_tasks(request):
search_term = request.query_params.get("search_term", "")
study_filter = request.query_params.get("study_filter", "false")
try:
return JSONResponse(await monitor.find_tasks(search_term))
return JSONResponse(await monitor.find_tasks(search_term, study_filter))
except monitor.MonitorHTTPError as e:
return JSONResponse({"error": e.status_code}, status_code=e.status_code)

Expand Down
5 changes: 5 additions & 0 deletions webinterface/statics/css/all.min.css

Large diffs are not rendered by default.

Binary file added webinterface/statics/webfonts/fa-brands-400.eot
Binary file not shown.
3,442 changes: 3,442 additions & 0 deletions webinterface/statics/webfonts/fa-brands-400.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added webinterface/statics/webfonts/fa-brands-400.ttf
Binary file not shown.
Binary file added webinterface/statics/webfonts/fa-brands-400.woff
Binary file not shown.
Binary file added webinterface/statics/webfonts/fa-brands-400.woff2
Binary file not shown.
Binary file added webinterface/statics/webfonts/fa-regular-400.eot
Binary file not shown.
803 changes: 803 additions & 0 deletions webinterface/statics/webfonts/fa-regular-400.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added webinterface/statics/webfonts/fa-regular-400.ttf
Binary file not shown.
Binary file added webinterface/statics/webfonts/fa-regular-400.woff
Binary file not shown.
Binary file not shown.
Binary file added webinterface/statics/webfonts/fa-solid-900.eot
Binary file not shown.
4,649 changes: 4,649 additions & 0 deletions webinterface/statics/webfonts/fa-solid-900.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added webinterface/statics/webfonts/fa-solid-900.ttf
Binary file not shown.
Binary file added webinterface/statics/webfonts/fa-solid-900.woff
Binary file not shown.
Binary file added webinterface/statics/webfonts/fa-solid-900.woff2
Binary file not shown.
2 changes: 1 addition & 1 deletion webinterface/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<script defer src="{{ url_for('static', path='/js/fontawesome-5.9.js') }}"></script>
<script src="{{ url_for('static', path='/js/jquery-3.5.1.min.js') }}"></script>
<script src="{{ url_for('static', path='/js/htmx.min.js') }}"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css" integrity="sha512-q3eWabyZPc1XTCmF+8/LuE1ozpg5xxn7iO89yfSOd5/oKvyqLngoNGsx8jq92Y8eXJ/IRxQbEC+FGSYxtk2oiw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link href="{{ url_for('static', path='/css/all.min.css') }}" rel="stylesheet">
<link rel="stylesheet" href="{{ url_for('static', path='/css/bulma-extensions.min.css') }}">
<link href="{{ url_for('static', path='/css/tooltip.css') }}" rel="stylesheet">
<script type="text/javascript" src="{{ url_for('static', path='/js/bulma-extensions.min.js') }}"></script>
Expand Down
17 changes: 9 additions & 8 deletions webinterface/templates/queue.html
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ <h5 class="title is-5 configtitle" style="margin-top: 60px;"><i

<script>

var archiveFilterQueue = false;

function update() {
update_status();
update_jobs();
Expand Down Expand Up @@ -731,10 +733,6 @@ <h5 class="title is-5 configtitle" style="margin-top: 60px;"><i
timeout: 3000
});
})




}
}
],
Expand Down Expand Up @@ -811,16 +809,19 @@ <h5 class="title is-5 configtitle" style="margin-top: 60px;"><i
buttons: [
{
extend: 'collection',
autoClose: true,
text: '<i class="fas fa-filter"></i>',
className: 'queueArchiveFilter',
buttons: [
{
text: 'Show only STUDY tasks',
className: 'queueArchiveFilterButton',
action: function (e, dt, node, config, cb) {
// Toggles class when pressed
$(e.currentTarget).toggleClass("queueArchiveFilterButton-Checked")
}
// Toggles class when pressed
$(e.currentTarget).toggleClass("queueArchiveFilterButton-Checked");
archiveFilterQueue = !archiveFilterQueue;
archiveSearch();
}
}
]
},
Expand Down Expand Up @@ -928,7 +929,7 @@ <h5 class="title is-5 configtitle" style="margin-top: 60px;"><i
$.ajax({
type: 'GET',
url: '/api/find-tasks',
data: {'search_term': searchTerm },
data: {'search_term': searchTerm, 'study_filter': archiveFilterQueue },
dataType: 'json',
error: function () {
$('#erroralert').show();
Expand Down

0 comments on commit f2c35b8

Please sign in to comment.