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

Adding /browse view. #295

Open
wants to merge 86 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
e7a2c7d
Adding /browse view
dmichaels-harvard Nov 20, 2024
b7b6de6
Adding /browse view
dmichaels-harvard Nov 20, 2024
d39c93c
comments in CHANGELOG.rst
dmichaels-harvard Nov 20, 2024
a39073b
udpate version
dmichaels-harvard Nov 20, 2024
3c7a0cf
merge from main
dmichaels-harvard Nov 21, 2024
2abecfa
merge from main
dmichaels-harvard Nov 22, 2024
566ff2a
changes for new /recent_files_summary endpoint for C4-1192
dmichaels-harvard Dec 6, 2024
3ef3916
merge from main
dmichaels-harvard Dec 6, 2024
6148956
debugging
dmichaels-harvard Dec 7, 2024
fdcca3d
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 7, 2024
300ae14
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 7, 2024
0650d8d
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 7, 2024
f598c3f
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 7, 2024
b30dd87
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 8, 2024
6da8961
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 8, 2024
c507835
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 8, 2024
b36eb83
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 8, 2024
911808b
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 8, 2024
7bde707
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 8, 2024
e59840a
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 8, 2024
d772ec1
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 9, 2024
8ddcd24
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 9, 2024
81ae204
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 9, 2024
021f0b0
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 9, 2024
099b525
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 10, 2024
eac4384
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 10, 2024
6f24487
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 10, 2024
1a36263
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 10, 2024
828ae52
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 11, 2024
df7c33c
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 11, 2024
fdbe871
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 11, 2024
e21a5c7
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 11, 2024
4ed1041
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 11, 2024
b5c99ce
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 11, 2024
e7420cc
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 11, 2024
da2a211
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 11, 2024
8be133e
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 12, 2024
713f50f
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 12, 2024
cc4f8f1
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 12, 2024
c8f3ba9
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 12, 2024
a854653
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 12, 2024
9860674
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 12, 2024
56a72f4
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 12, 2024
60b541d
merge from main
dmichaels-harvard Dec 12, 2024
1fe7fbf
minor /recent_files_summary refactor mostly for troubleshooting
dmichaels-harvard Dec 12, 2024
f84340a
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 12, 2024
45917f5
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 12, 2024
fed57eb
merge from main
dmichaels-harvard Dec 12, 2024
975f297
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 12, 2024
6eba0a8
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 12, 2024
77a0171
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 13, 2024
2b0ad4b
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 13, 2024
66cec6e
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 13, 2024
0c1195f
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 13, 2024
c546ca2
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 13, 2024
77f0537
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 14, 2024
3448c9a
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 14, 2024
414dfde
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 14, 2024
c6e595d
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 14, 2024
b87d83a
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 14, 2024
c4f97f9
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 15, 2024
18ceaa0
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 15, 2024
567f685
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 15, 2024
2f45e8c
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 15, 2024
203228c
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 15, 2024
82daa17
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 15, 2024
db2cc99
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 15, 2024
e8280d6
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 15, 2024
3a1f19f
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 15, 2024
a383ceb
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 16, 2024
847aaa5
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 16, 2024
a092124
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 16, 2024
8e534f4
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 16, 2024
fb7ba9b
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 16, 2024
57af5b1
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 16, 2024
4a212d1
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 16, 2024
bbddc5c
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 16, 2024
142626b
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 16, 2024
dde4db5
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 16, 2024
397aeb1
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 16, 2024
c27f1a5
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 16, 2024
c5e275a
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 16, 2024
56ec435
refactoring /recent_files_summary endpoint
dmichaels-harvard Dec 17, 2024
05bff6a
merge from maingd
dmichaels-harvard Dec 18, 2024
59d4424
merge from main
dmichaels-harvard Dec 23, 2024
bf7ed2b
merge from main
dmichaels-harvard Jan 6, 2025
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
27 changes: 27 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,32 @@ smaht-portal
Change Log
----------

0.124.0
=======

* 2024-11-20/dmichaels - branch: dmichaels-20241119-browse-view (PR-295)

* Added module browse.py for /browse; adapted from fourfront/.../search.py/browse.
This is for ticket: https://hms-dbmi.atlassian.net/browse/C4-1184

* New endpoint /recent_files_summary which, by default, returns info for files released
within the past three months grouped by release-date, cell-line or donor, and
ile-description. The specific fields used for these groupings are:
- release-date: file_status_tracking.released
- cell-line: file_sets.libraries.analytes.samples.sample_sources.cell_line.code
- donor: donors.display_title
- file-dsecription: release_tracker_description
Note that release_tracker_description is a newer (2024-12) calcprop (PR-298/sn_file_release_tracker);
and included in this branch are these files from the branch sn_file_release_tracker:
- src/encoded/item_utils/file.py
- src/encoded/types/file.py
Added these new modules to support this new endpoint:
- src/encoded/recent_files_summary.py
- src/encoded/elasticsearch_utils.py (maybe move to dcicutils eventually)
- src/encoded/endpoint_utils.py (maybe move to dcicutils eventually)
This is for ticket: https://hms-dbmi.atlassian.net/browse/C4-1192


0.123.0
=======
`PR 310 SN Add liquid category <https://github.com/smaht-dac/smaht-portal/pull/310>`
Expand All @@ -23,6 +49,7 @@ Change Log
* Assay and sequencer codes value set to XX for DSA fasta files and chain files
* For Supplementary Files, use `haplotype`, `target_assembly`, and `source_assembly` properties to create annotated filenames for chain and fasta files


0.121.0
=======
`PR 300 SN Remove basecalling <https://github.com/smaht-dac/smaht-portal/pull/300>`
Expand Down
17 changes: 16 additions & 1 deletion poetry.lock

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

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "encoded"
version = "0.123.0"
version = "0.123.0.1b1" # TODO: To become 0.124.0
description = "SMaHT Data Analysis Portal"
authors = ["4DN-DCIC Team <[email protected]>"]
license = "MIT"
Expand Down Expand Up @@ -99,6 +99,7 @@ structlog = ">=19.2.0,<20"
subprocess-middleware = "^0.3.0"
supervisor = "^4.2.4"
# Useful for picking apart pyproject.toml
termcolor = "^2.4.0"
toml = ">=0.10.1,<1"
tqdm = "^4.59.0"
transaction = "^3.0.0"
Expand Down
1 change: 1 addition & 0 deletions src/encoded/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ def main(global_config, **local_config):
if 'elasticsearch.server' in config.registry.settings:
config.include('snovault.elasticsearch')
config.include('snovault.search.search')
config.include('encoded.browse')
config.include('snovault.search.compound_search')

# this contains fall back url, so make sure it comes just before static_resoruces
Expand Down
66 changes: 66 additions & 0 deletions src/encoded/browse.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
from pyramid.httpexceptions import HTTPFound
from pyramid.security import Authenticated
from pyramid.view import view_config
import structlog
from webob.multidict import MultiDict
from urllib.parse import urlencode
from snovault.search.search import search
from snovault.util import debug_log
from encoded.endpoints.recent_files_summary.recent_files_summary import recent_files_summary_endpoint

log = structlog.getLogger(__name__)

# 2024-11-19/dmichaels: Adapted from fourfront for C4-1184.

def includeme(config):
config.add_route('browse', '/browse{slash:/?}')
config.add_route("recent_files_summary", "/recent_files_summary")
config.scan(__name__)


# DEFAULT_BROWSE_TYPE = "FileSet"
# DEFAULT_BROWSE_TYPE = "UnalignedReads"
# DEFAULT_BROWSE_TYPE = "OutputFile"

DEFAULT_BROWSE_TYPE = "File"
DEFAULT_BROWSE_FACETS = ["file_size"]

DEFAULT_BROWSE_PARAM_LISTS = {
"type": [DEFAULT_BROWSE_TYPE],
"additional_facet": DEFAULT_BROWSE_FACETS
}

@view_config(route_name='browse', request_method='GET', permission='search')
@debug_log
def browse(context, request, search_type=DEFAULT_BROWSE_TYPE, return_generator=False):
"""
Simply use search results for browse view
Redirect to proper URL w. params if needed
"""
orig_params = request.params
for k,vals in DEFAULT_BROWSE_PARAM_LISTS.items():
if k not in orig_params or orig_params[k] not in vals:
# Redirect to DEFAULT_BROWSE_PARAM_LISTS URL
next_qs = MultiDict()
for k2, v2list in DEFAULT_BROWSE_PARAM_LISTS.items():
for v2 in v2list:
next_qs.add(k2, v2)
# Preserve other keys that arent in DEFAULT_BROWSE_PARAM_LISTS
for k2, v2 in orig_params.items():
if k2 not in DEFAULT_BROWSE_PARAM_LISTS:
next_qs.add(k2, v2)
# next_qs.add("redirected_from", str(request.path_qs))
return HTTPFound(
location=str(request.path) + '?' + urlencode(next_qs),
detail="Redirected from " + str(request.path_info)
)

# TODO
# No real /browse specific UI yet; initially just basically copied static/components/SearchView.js to BrowseView.js.
return search(context, request, search_type, return_generator, forced_type="Browse")


@view_config(route_name="recent_files_summary", request_method=["GET"], effective_principals=Authenticated)
@debug_log
def recent_files_summary(context, request):
return recent_files_summary_endpoint(context, request)
Loading
Loading