Skip to content

Commit

Permalink
Merge pull request #12 from samply/feature/empty-request
Browse files Browse the repository at this point in the history
allowing empty list of sites in request
  • Loading branch information
enola-dkfz authored Apr 3, 2024
2 parents bce53a7 + 74b8f26 commit 66c43db
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions resources/body_bbmri.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"group": [
{
"code": {
"text": "patients"
"text": "patient"
},
"population": [
{
Expand All @@ -44,7 +44,7 @@
"stratifier": [
{
"code": {
"text": "Gender"
"text": "gender"
},
"criteria": {
"expression": "Gender",
Expand Down
2 changes: 1 addition & 1 deletion resources/body_dktk.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"stratifier": [
{
"code": {
"text": "Gender"
"text": "gender"
},
"criteria": {
"expression": "Gender",
Expand Down
2 changes: 1 addition & 1 deletion resources/body_gbn.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"stratifier": [
{
"code": {
"text": "Gender"
"text": "gender"
},
"criteria": {
"expression": "Gender",
Expand Down
2 changes: 1 addition & 1 deletion resources/query_bbmri.cql
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ BBMRI_STRAT_CUSTODIAN_STRATIFIER

BBMRI_STRAT_DIAGNOSIS_STRATIFIER

PRISM_BBMRI_STRAT_AGE_STRATIFIER
PRISM_STRAT_AGE_STRATIFIER_BBMRI

BBMRI_STRAT_DEF_IN_INITIAL_POPULATION
true
10 changes: 9 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,15 @@ async fn handle_get_criteria(
) -> Result<Response, (StatusCode, String)> {
let mut criteria_groups: CriteriaGroups = CriteriaGroups::new(); // this is going to be aggregated criteria for all the sites

for site in query.clone().sites {
let mut sites = query.sites;

// allowing empty list of sites in the request because Spot is going to query with the empty list and expect response for the sites in Prism's config

if sites.is_empty() {
sites = CONFIG.sites.clone();
}

for site in sites {
debug!("Request for site {}", &site);
let criteria_groups_from_cache =
match shared_state.criteria_cache.lock().await.cache.get(&site) {
Expand Down

0 comments on commit 66c43db

Please sign in to comment.