feat: ignore non oBDS 2.x messages

This commit is contained in:
Paul-Christian Volkmer 2024-07-24 13:26:27 +02:00
parent f48a96e64d
commit fb60cb5042
6 changed files with 19 additions and 0 deletions

View File

@ -62,6 +62,8 @@ pub enum SubCommand {
year: String, year: String,
#[arg(long, value_parser = value_is_date, help = "Ignoriere LKR-Exporte seit Datum")] #[arg(long, value_parser = value_is_date, help = "Ignoriere LKR-Exporte seit Datum")]
ignore_exports_since: Option<String>, ignore_exports_since: Option<String>,
#[arg(long, help = "Ignoriere Meldungen, die nicht im oBDS 2.x Format sind")]
ignore_non_obds_2: bool,
#[arg(long, help = "Meldungen mit externer Diagnose einschließen")] #[arg(long, help = "Meldungen mit externer Diagnose einschließen")]
include_extern: bool, include_extern: bool,
#[arg( #[arg(
@ -103,6 +105,8 @@ pub enum SubCommand {
year: String, year: String,
#[arg(long, value_parser = value_is_date, help = "Ignoriere LKR-Exporte seit Datum")] #[arg(long, value_parser = value_is_date, help = "Ignoriere LKR-Exporte seit Datum")]
ignore_exports_since: Option<String>, ignore_exports_since: Option<String>,
#[arg(long, help = "Ignoriere Meldungen, die nicht im oBDS 2.x Format sind")]
ignore_non_obds_2: bool,
#[arg(long, help = "Export mit Trennzeichen ';' für Excel")] #[arg(long, help = "Export mit Trennzeichen ';' für Excel")]
xls_csv: bool, xls_csv: bool,
#[arg(long, help = "Meldungen mit externer Diagnose einschließen")] #[arg(long, help = "Meldungen mit externer Diagnose einschließen")]
@ -142,6 +146,8 @@ pub enum SubCommand {
year: String, year: String,
#[arg(long, value_parser = value_is_date, help = "Ignoriere LKR-Exporte seit Datum")] #[arg(long, value_parser = value_is_date, help = "Ignoriere LKR-Exporte seit Datum")]
ignore_exports_since: Option<String>, ignore_exports_since: Option<String>,
#[arg(long, help = "Ignoriere Meldungen, die nicht im oBDS 2.x Format sind")]
ignore_non_obds_2: bool,
#[arg(long, help = "Meldungen mit externer Diagnose einschließen")] #[arg(long, help = "Meldungen mit externer Diagnose einschließen")]
include_extern: bool, include_extern: bool,
#[arg( #[arg(

View File

@ -55,6 +55,7 @@ impl DatabaseSource {
&self, &self,
year: &str, year: &str,
ignore_exports_since: &str, ignore_exports_since: &str,
ignore_non_obds_2: bool,
include_extern: bool, include_extern: bool,
include_histo_zyto: bool, include_histo_zyto: bool,
schema_versions: bool, schema_versions: bool,
@ -62,6 +63,7 @@ impl DatabaseSource {
let params = params! { let params = params! {
"year" => year, "year" => year,
"ignore_exports_since" => ignore_exports_since, "ignore_exports_since" => ignore_exports_since,
"ignore_non_obds_2" => if ignore_non_obds_2 { 1 } else { 0 },
"include_extern" => if include_extern { 1 } else { 0 }, "include_extern" => if include_extern { 1 } else { 0 },
"include_histo_zyto" => if include_histo_zyto { 1 } else { 0 } "include_histo_zyto" => if include_histo_zyto { 1 } else { 0 }
}; };
@ -97,6 +99,7 @@ impl DatabaseSource {
&self, &self,
year: &str, year: &str,
ignore_exports_since: &str, ignore_exports_since: &str,
ignore_non_obds_2: bool,
use_pat_id: bool, use_pat_id: bool,
include_extern: bool, include_extern: bool,
include_histo_zyto: bool, include_histo_zyto: bool,
@ -109,6 +112,7 @@ impl DatabaseSource {
params! { params! {
"year" => year, "year" => year,
"ignore_exports_since" => ignore_exports_since, "ignore_exports_since" => ignore_exports_since,
"ignore_non_obds_2" => if ignore_non_obds_2 { 1 } else { 0 },
"include_extern" => if include_extern { 1 } else { 0 }, "include_extern" => if include_extern { 1 } else { 0 },
"include_histo_zyto" => if include_histo_zyto { 1 } else { 0 } "include_histo_zyto" => if include_histo_zyto { 1 } else { 0 }
}, },

View File

@ -129,6 +129,7 @@ fn main() -> Result<(), Box<dyn Error>> {
user, user,
year, year,
ignore_exports_since, ignore_exports_since,
ignore_non_obds_2,
include_extern, include_extern,
include_histo_zyto, include_histo_zyto,
schema_versions, schema_versions,
@ -148,6 +149,7 @@ fn main() -> Result<(), Box<dyn Error>> {
.check( .check(
&year, &year,
&ignore_exports_since.unwrap_or("9999-12-31".into()), &ignore_exports_since.unwrap_or("9999-12-31".into()),
ignore_non_obds_2,
include_extern, include_extern,
include_histo_zyto, include_histo_zyto,
schema_versions, schema_versions,
@ -169,6 +171,7 @@ fn main() -> Result<(), Box<dyn Error>> {
output, output,
year, year,
ignore_exports_since, ignore_exports_since,
ignore_non_obds_2,
xls_csv, xls_csv,
include_extern, include_extern,
include_histo_zyto, include_histo_zyto,
@ -188,6 +191,7 @@ fn main() -> Result<(), Box<dyn Error>> {
.export( .export(
&year, &year,
&ignore_exports_since.unwrap_or("9999-12-31".into()), &ignore_exports_since.unwrap_or("9999-12-31".into()),
ignore_non_obds_2,
pat_id, pat_id,
include_extern, include_extern,
include_histo_zyto, include_histo_zyto,
@ -232,6 +236,7 @@ fn main() -> Result<(), Box<dyn Error>> {
file, file,
year, year,
ignore_exports_since, ignore_exports_since,
ignore_non_obds_2,
include_extern, include_extern,
include_histo_zyto, include_histo_zyto,
} => { } => {
@ -250,6 +255,7 @@ fn main() -> Result<(), Box<dyn Error>> {
.export( .export(
&year, &year,
&ignore_exports_since.unwrap_or("9999-12-31".into()), &ignore_exports_since.unwrap_or("9999-12-31".into()),
ignore_non_obds_2,
pat_id, pat_id,
include_extern, include_extern,
include_histo_zyto, include_histo_zyto,

View File

@ -39,6 +39,7 @@ FROM (
AND (lme.xml_daten LIKE '%<cTNM%' OR lme.xml_daten LIKE '%<pTNM%' OR lme.xml_daten LIKE '%<Menge_Histologie>%' OR lme.xml_daten LIKE '%<Menge_Weitere_Klassifikation>%') AND (lme.xml_daten LIKE '%<cTNM%' OR lme.xml_daten LIKE '%<pTNM%' OR lme.xml_daten LIKE '%<Menge_Histologie>%' OR lme.xml_daten LIKE '%<Menge_Weitere_Klassifikation>%')
AND (lme.xml_daten NOT LIKE '%histologie_zytologie%' OR 1 = :include_histo_zyto) AND (lme.xml_daten NOT LIKE '%histologie_zytologie%' OR 1 = :include_histo_zyto)
AND (EXTRACTVALUE(lme.xml_daten, '//Meldende_Stelle') NOT LIKE '%9999%' OR 1 <= :include_extern) AND (EXTRACTVALUE(lme.xml_daten, '//Meldende_Stelle') NOT LIKE '%9999%' OR 1 <= :include_extern)
AND (EXTRACTVALUE(lme.xml_daten, '//ADT_GEKID/@Schema_Version') LIKE '2.%' OR 1 = :ignore_non_obds_2)
) o1 ) o1
LEFT OUTER JOIN ( LEFT OUTER JOIN (

View File

@ -125,6 +125,7 @@ FROM (
AND (lme.xml_daten LIKE '%<cTNM%' OR lme.xml_daten LIKE '%<pTNM%' OR lme.xml_daten LIKE '%<Menge_Histologie>%' OR lme.xml_daten LIKE '%<Menge_Weitere_Klassifikation>%') AND (lme.xml_daten LIKE '%<cTNM%' OR lme.xml_daten LIKE '%<pTNM%' OR lme.xml_daten LIKE '%<Menge_Histologie>%' OR lme.xml_daten LIKE '%<Menge_Weitere_Klassifikation>%')
AND (lme.xml_daten NOT LIKE '%histologie_zytologie%' OR 1 = :include_histo_zyto) AND (lme.xml_daten NOT LIKE '%histologie_zytologie%' OR 1 = :include_histo_zyto)
AND (EXTRACTVALUE(lme.xml_daten, '//Meldende_Stelle') NOT LIKE '%9999%' OR 1 <= :include_extern) AND (EXTRACTVALUE(lme.xml_daten, '//Meldende_Stelle') NOT LIKE '%9999%' OR 1 <= :include_extern)
AND (EXTRACTVALUE(lme.xml_daten, '//ADT_GEKID/@Schema_Version') LIKE '2.%' OR 1 = :ignore_non_obds_2)
) o1 ) o1
LEFT OUTER JOIN ( LEFT OUTER JOIN (
SELECT DISTINCT SELECT DISTINCT

View File

@ -125,6 +125,7 @@ FROM (
AND (lme.xml_daten LIKE '%<cTNM%' OR lme.xml_daten LIKE '%<pTNM%' OR lme.xml_daten LIKE '%<Menge_Histologie>%' OR lme.xml_daten LIKE '%<Menge_Weitere_Klassifikation>%') AND (lme.xml_daten LIKE '%<cTNM%' OR lme.xml_daten LIKE '%<pTNM%' OR lme.xml_daten LIKE '%<Menge_Histologie>%' OR lme.xml_daten LIKE '%<Menge_Weitere_Klassifikation>%')
AND (lme.xml_daten NOT LIKE '%histologie_zytologie%' OR 1 = :include_histo_zyto) AND (lme.xml_daten NOT LIKE '%histologie_zytologie%' OR 1 = :include_histo_zyto)
AND (EXTRACTVALUE(lme.xml_daten, '//Meldende_Stelle') NOT LIKE '%9999%' OR 1 <= :include_extern) AND (EXTRACTVALUE(lme.xml_daten, '//Meldende_Stelle') NOT LIKE '%9999%' OR 1 <= :include_extern)
AND (EXTRACTVALUE(lme.xml_daten, '//ADT_GEKID/@Schema_Version') LIKE '2.%' OR 1 = :ignore_non_obds_2)
) o1 ) o1
LEFT OUTER JOIN ( LEFT OUTER JOIN (
SELECT DISTINCT SELECT DISTINCT