Skip to content

Commit 8501a2b

Browse files
committed
formatting
1 parent 2962af9 commit 8501a2b

4 files changed

Lines changed: 32 additions & 36 deletions

File tree

src/cql.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ fn generate_cql(ast: ast::Ast, cql_flavour: Flavour) -> Result<String, FocusErro
6161
lists += format!(
6262
"codesystem {}: '{}'\n",
6363
code_system,
64-
cql_flavour.get_code_lists().get(code_system).unwrap_or(&(""))
64+
cql_flavour
65+
.get_code_lists()
66+
.get(code_system)
67+
.unwrap_or(&(""))
6568
)
6669
.as_str();
6770
}
@@ -294,12 +297,14 @@ pub fn process(
294297

295298
match condition.value {
296299
ast::ConditionValue::StringArray(string_array) => {
297-
let mut string_array_with_workarounds= if *cql_flavour == Flavour::Miabis { //empty, codes get replaced
298-
Default::default()
299-
} else {
300-
string_array.clone()
301-
};
302-
300+
let mut string_array_with_workarounds =
301+
if *cql_flavour == Flavour::Miabis {
302+
//empty, codes get replaced
303+
Default::default()
304+
} else {
305+
string_array.clone()
306+
};
307+
303308
for value in string_array {
304309
if let Some(additional_values) =
305310
cql_flavour.get_code_workarounds().get(value.as_str())
@@ -350,8 +355,7 @@ pub fn process(
350355
ast::ConditionType::Equals => match condition.value {
351356
ast::ConditionValue::String(string) => {
352357
let operator_str = " or ";
353-
let mut string_array_with_workarounds =
354-
vec![string.clone()];
358+
let mut string_array_with_workarounds = vec![string.clone()];
355359
if let Some(additional_values) =
356360
cql_flavour.get_code_workarounds().get(string.as_str())
357361
{

src/flavours/miabis/mod.rs

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,21 @@ use indexmap::IndexSet;
66

77
use super::CriterionRole;
88

9-
pub static CODE_LISTS: LazyLock<HashMap<&'static str, &'static str>> =
10-
LazyLock::new(|| {
11-
HashMap::new()
12-
});
9+
pub static CODE_LISTS: LazyLock<HashMap<&'static str, &'static str>> =
10+
LazyLock::new(|| HashMap::new());
1311

1412
pub static OBSERVATION_LOINC_CODES: LazyLock<HashMap<&'static str, &'static str>> =
15-
LazyLock::new(|| {
16-
HashMap::new()
17-
});
13+
LazyLock::new(|| HashMap::new());
1814

1915
pub static CRITERION_CODE_LISTS: LazyLock<HashMap<&'static str, Vec<&'static str>>> =
20-
LazyLock::new(|| {
21-
HashMap::new()
22-
});
16+
LazyLock::new(|| HashMap::new());
2317

2418
pub static CQL_SNIPPETS: LazyLock<HashMap<(&'static str, CriterionRole), &'static str>> =
25-
LazyLock::new(|| {
26-
HashMap::new()
27-
});
19+
LazyLock::new(|| HashMap::new());
2820

2921
pub static MANDATORY_CODE_LISTS: LazyLock<IndexSet<&'static str>> =
30-
LazyLock::new(|| {
31-
IndexSet::new()
32-
});
33-
34-
pub static CODE_WORKAROUNDS: LazyLock<HashMap<&'static str, Vec<&'static str>>> = // both sample type and storage temperature replacement codes
35-
LazyLock::new(|| {
36-
HashMap::new()
37-
});
22+
LazyLock::new(|| IndexSet::new());
23+
24+
pub static CODE_WORKAROUNDS: LazyLock<HashMap<&'static str, Vec<&'static str>>> =
25+
// both sample type and storage temperature replacement codes
26+
LazyLock::new(|| HashMap::new());

src/flavours/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ mod cce;
99
mod dhki;
1010
mod dktk;
1111
mod itcc;
12+
mod miabis;
1213
mod nngm;
1314
mod pscc;
14-
mod miabis;
1515

1616
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Copy)]
1717
pub enum CriterionRole {
@@ -20,15 +20,16 @@ pub enum CriterionRole {
2020
}
2121

2222
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
23-
pub enum Flavour { //not 1:1 with project anymore
23+
pub enum Flavour {
24+
//not 1:1 with project anymore
2425
Bbmri,
2526
Dktk,
2627
Cce,
2728
Dhki,
2829
Nngm,
2930
Itcc,
3031
Pscc,
31-
Miabis
32+
Miabis,
3233
}
3334

3435
impl FromStr for Flavour {
@@ -76,7 +77,8 @@ impl Flavour {
7677
}
7778
}
7879

79-
pub fn get_code_workarounds(&self) -> &'static HashMap<&'static str, Vec<&'static str>> { // used for all code workarounds, different criteria do not contain overlapping codes
80+
pub fn get_code_workarounds(&self) -> &'static HashMap<&'static str, Vec<&'static str>> {
81+
// used for all code workarounds, different criteria do not contain overlapping codes
8082
match self {
8183
Flavour::Bbmri => &bbmri::CODE_WORKAROUNDS,
8284
Flavour::Dktk => &dktk::CODE_WORKAROUNDS,

src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ mod logger;
1111
mod eucaim_api;
1212
mod eucaim_beacon;
1313
mod exporter;
14+
mod flavours;
1415
mod intermediate_rep;
1516
mod mr;
16-
mod flavours;
1717
mod task_processing;
1818
mod transformed;
1919
mod util;
@@ -330,7 +330,8 @@ async fn process_task(
330330
}
331331
Language::Ast(ast_query) => {
332332
generated_from_ast = true;
333-
let cql_flavour = if let Some(cql_flavour) = &CONFIG.cql_flavour { //same FEs query blazes with different FHIR profiles
333+
let cql_flavour = if let Some(cql_flavour) = &CONFIG.cql_flavour {
334+
//same FEs query blazes with different FHIR profiles
334335
cql_flavour
335336
} else {
336337
&metadata.project

0 commit comments

Comments
 (0)