mirror of
https://github.com/pcvolkmer/osc-variant.git
synced 2025-04-19 19:56:50 +00:00
Add static transformation for DNPM forms to use UKW variant
This commit is contained in:
parent
193b01dc92
commit
c43f12c95f
@ -1,8 +1,8 @@
|
||||
= OSC-Variant
|
||||
# OSC-Variant
|
||||
|
||||
Anwendung zum Anpassen einer OSC-Datei an einen Standort.
|
||||
|
||||
== Funktion
|
||||
## Funktion
|
||||
|
||||
Diese Anwendung passt eine OSC-Datei so an, dass (standortbezogene) Formularvarianten für Formularverweise
|
||||
verwendet werden.
|
||||
|
@ -58,7 +58,9 @@ fn main() {
|
||||
let contents = fs::read_to_string(cli.input)
|
||||
.expect("Should have been able to read the file");
|
||||
|
||||
let xml: OnkostarEditor = from_str(contents.as_str()).unwrap();
|
||||
let mut xml: OnkostarEditor = from_str(contents.as_str()).unwrap();
|
||||
|
||||
xml.apply_variant();
|
||||
|
||||
let mut buf = String::new();
|
||||
|
||||
|
@ -144,6 +144,22 @@ pub struct DataForm {
|
||||
ansichten: Option<Ansichten>
|
||||
}
|
||||
|
||||
impl DataForm {
|
||||
pub fn apply_variant(&mut self) {
|
||||
if self.name.starts_with("DNPM") {
|
||||
self.entries.entry.iter_mut().for_each(|mut entry| {
|
||||
if entry.type_ == "formReference" {
|
||||
if let Some(referenced_data_form) = &entry.referenced_data_form {
|
||||
if referenced_data_form == "OS.Tumorkonferenz" {
|
||||
entry.referenced_data_form = Some("OS.Tumorkonferenz.VarianteUKW".to_string())
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct DataCatalogues {
|
||||
#[serde(rename = "DataCatalogue")]
|
||||
|
@ -37,6 +37,17 @@ pub struct OnkostarEditor {
|
||||
editor: Editor
|
||||
}
|
||||
|
||||
impl OnkostarEditor {
|
||||
pub fn apply_variant(&mut self) {
|
||||
self.editor.data_form.iter_mut().for_each(|data_form| {
|
||||
data_form.apply_variant();
|
||||
});
|
||||
self.editor.unterformular.iter_mut().for_each(|data_form| {
|
||||
data_form.apply_variant();
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct InfoXML {
|
||||
#[serde(rename = "DatumXML")]
|
||||
|
@ -152,6 +152,22 @@ pub struct Unterformular {
|
||||
ansichten: Option<Ansichten>
|
||||
}
|
||||
|
||||
impl Unterformular {
|
||||
pub fn apply_variant(&mut self) {
|
||||
if self.name.starts_with("DNPM") {
|
||||
self.entries.entry.iter_mut().for_each(|mut entry| {
|
||||
if entry.type_ == "formReference" {
|
||||
if let Some(referenced_data_form) = &entry.referenced_data_form {
|
||||
if referenced_data_form == "OS.Tumorkonferenz" {
|
||||
entry.referenced_data_form = Some("OS.Tumorkonferenz.VarianteUKW".to_string())
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct DataCatalogues {
|
||||
#[serde(rename = "DataCatalogue")]
|
||||
|
Loading…
x
Reference in New Issue
Block a user