Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
fix: handling non-english EPDs
Browse files Browse the repository at this point in the history
  • Loading branch information
ocni-dtu committed Feb 22, 2024
1 parent 0ddca51 commit 87fe672
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/epd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,12 @@ impl<'de> Deserialize<'de> for EPD {

fn get_ilcd_standard(helper: &ILCD) -> Standard {
for compliance in &helper.modelling_and_validation.compliance_declarations.compliance {
match compliance.reference_to_compliance_system.short_description.iter().find(|&description| description.lang == "en") {
Some(description) => return Standard::from(&description.value),
_ => continue
for description in &compliance.reference_to_compliance_system.short_description {
match Standard::from(&description.value) {
Standard::UNKNOWN => continue,
standard => return standard
}

}
}

Expand Down Expand Up @@ -312,13 +315,13 @@ fn collect_from_lcia_result(lcia_result: &Vec<LCIAResult>) -> (Option<ImpactCate
for description in &lcia_result.reference_to_lcia_method_dataset.short_description {
let impact_value = Some(ImpactCategory::from(&lcia_result.other.anies));
match &description.value {
value if value.as_str() == "Global warming potential (GWP)" => gwp = impact_value,
value if value.as_str() == "Depletion potential of the stratospheric ozone layer (ODP)" => odp = impact_value,
value if value.as_str() == "Acidification potential of soil and water (AP)" => ap = impact_value,
value if value.as_str() == "Eutrophication potential (EP)" => ep = impact_value,
value if value.as_str() == "Formation potential of tropospheric ozone (POCP)" => pocp = impact_value,
value if value.as_str() == "Abiotic depletion potential for non fossil resources (ADPE))" => adpe = impact_value,
value if value.as_str() == "Abiotic depletion potential for fossil resources (ADPF)" => adpf = impact_value,
value if value.contains("(GWP)") || value.contains("(GWP-total)") => gwp = impact_value,
value if value.contains("(ODP)") => odp = impact_value,
value if value.contains("(AP)") => ap = impact_value,
value if value.contains("(EP)") => ep = impact_value,
value if value.contains("(POCP)") => pocp = impact_value,
value if value.contains("(ADPE)") => adpe = impact_value,
value if value.contains("(ADPF)") => adpf = impact_value,
_ => continue
}
}
Expand Down

0 comments on commit 87fe672

Please sign in to comment.