Use TryFrom to handle enum errors, get definition loading working with demo definitions

This commit is contained in:
Michael Pivato
2023-12-24 16:48:14 +10:30
parent c1771b66c4
commit 7e866141e7
3 changed files with 199 additions and 97 deletions

View File

@@ -10,7 +10,10 @@ use polars::lazy::dsl::*;
use polars::prelude::*;
use serde::Serialize;
use super::csv::{read_definitions, BuildFrom, Component, ConstraintType, Definition, SourceType};
use super::csv::{
read_definitions, BuildFrom, Component, ComponentSourceType, ConstraintType, Definition,
SourceType,
};
// TODO: Polars suggests this, but docs suggest it doesn't have very good platform support
//use jemallocator::Jemalloc;
@@ -251,7 +254,7 @@ pub fn build_encounters_polars(
.iter()
.any(|f| f.source_type == SourceType::Patient)
|| definition.components.iter().any(|c| match c {
Component::Field(source, _) => source == "P",
Component::Field(source, _) => *source == ComponentSourceType::Patient,
_ => false,
})
{