Skip to content

Commit

Permalink
fix: refactored ILCD parsing functions and added more test cases for …
Browse files Browse the repository at this point in the history
…ILCD files
  • Loading branch information
ocni-dtu committed Feb 3, 2024
1 parent b4fa5c1 commit 35256b6
Show file tree
Hide file tree
Showing 14 changed files with 23,876 additions and 155 deletions.
26 changes: 26 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ schemars = { version = "0.8.16", features = ["chrono"] }
serde = { version = "1.0.195", features = ["derive"] }
serde_json = "1.0.111"
pyo3 = { version = "0.20.2", features = ["abi3-py310"], optional = true }
pkg-version = "1.0.0"

# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires
Expand Down
317 changes: 175 additions & 142 deletions src/epd.rs

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions src/ilcd.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#[allow(dead_code)]
use serde::{Deserialize};
use serde::Serialize;


#[derive(Deserialize)]
Expand All @@ -24,7 +25,7 @@ pub struct Exchanges {
#[serde(rename_all = "camelCase")]
pub struct Exchange {
pub reference_to_flow_data_set: ReferenceToDescription,
pub mean_amount: f64,
pub mean_amount: Option<f64>,
pub resulting_amount: Option<f64>,
#[serde(alias = "dataSetInternalID")]
pub data_set_internal_id: Option<u32>,
Expand Down Expand Up @@ -52,13 +53,13 @@ pub struct FlowProperty {
pub unit_group_uuid: Option<String>
}

#[derive(Deserialize)]
#[derive(Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct MaterialProperty {
pub name: String,
pub value: String,
pub unit: String,
pub unit_description: String,
pub unit_description: Option<String>,
}

#[derive(Deserialize)]
Expand Down Expand Up @@ -87,7 +88,7 @@ pub struct ReferenceToDescription {
pub short_description: Vec<ValueLang>,
pub _type: String,
pub ref_object_id: String,
pub version: String
pub version: Option<String>
}


Expand Down
1,955 changes: 1,955 additions & 0 deletions tests/datafixtures/00c28f1f-1d49-4c81-9208-138922a1dd6c.json

Large diffs are not rendered by default.

2,120 changes: 2,120 additions & 0 deletions tests/datafixtures/0b488798-140f-4efa-96e2-55aa46ed129a.json

Large diffs are not rendered by default.

0 comments on commit 35256b6

Please sign in to comment.