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

refact(utils): support new Katsu private overview response format #79

Merged
merged 2 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 7 additions & 4 deletions bento_beacon/utils/beacon_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,15 @@ def add_overview_stats_to_response():


def package_biosample_and_experiment_stats(stats):
biosamples = stats.get("biosamples", {})
experiments = stats.get("experiments", {})
phenopacket_dts_stats = stats.get("phenopacket", {}).get("data_type_specific", {})
experiment_stats = stats.get("experiment", {}).get("data_type_specific", {}).get("experiments", {})

biosamples = phenopacket_dts_stats.get("biosamples", {})
biosamples_count = biosamples.get("count", 0)
experiments_count = experiments.get("count", 0)
sampled_tissue = biosamples.get("sampled_tissue", {})
experiment_type = experiments.get("experiment_type", {})

experiments_count = experiment_stats.get("count", 0)
experiment_type = experiment_stats.get("experiment_type", {})

# convert to bento_public response format
sampled_tissue_data = [{"label": key, "value": value} for key, value in sampled_tissue.items()]
Expand Down
2 changes: 1 addition & 1 deletion bento_beacon/utils/katsu_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def search_summary_statistics(ids):


def overview_statistics():
return katsu_get(current_app.config["KATSU_PRIVATE_OVERVIEW"]).get("data_type_specific", {})
return katsu_get(current_app.config["KATSU_PRIVATE_OVERVIEW"])


def katsu_censorship_settings() -> tuple[int | None, int | None]:
Expand Down