pub struct PreparedViewDefinition { /* private fields */ }Expand description
Pre-validated ViewDefinition for efficient reuse across multiple chunks.
This struct caches the validation and constant extraction from a ViewDefinition, allowing efficient processing of multiple chunks without re-validating each time.
§Examples
use helios_sof::{PreparedViewDefinition, SofViewDefinition, ResourceChunk};
// Parse and prepare ViewDefinition once
let view_json: serde_json::Value = serde_json::from_str(r#"{
"resourceType": "ViewDefinition",
"resource": "Patient",
"select": [{"column": [{"name": "id", "path": "id"}]}]
}"#).unwrap();
let view_def: helios_fhir::r4::ViewDefinition = serde_json::from_value(view_json).unwrap();
let sof_view = SofViewDefinition::R4(view_def);
let prepared = PreparedViewDefinition::new(sof_view).unwrap();
// Process multiple chunks efficiently
// for chunk in chunk_iterator {
// let result = prepared.process_chunk(chunk)?;
// // ... handle result
// }Implementations§
Source§impl PreparedViewDefinition
impl PreparedViewDefinition
Sourcepub fn new(view_definition: SofViewDefinition) -> Result<Self, SofError>
pub fn new(view_definition: SofViewDefinition) -> Result<Self, SofError>
Create a new PreparedViewDefinition by validating and extracting metadata.
This performs all validation upfront so that chunk processing is efficient.
Sourcepub fn columns(&self) -> &[String]
pub fn columns(&self) -> &[String]
Get the column names that will be produced by this ViewDefinition.
Sourcepub fn target_resource_type(&self) -> &str
pub fn target_resource_type(&self) -> &str
Get the target resource type for this ViewDefinition.
Sourcepub fn process_chunk(
&self,
chunk: ResourceChunk,
) -> Result<ChunkedResult, SofError>
pub fn process_chunk( &self, chunk: ResourceChunk, ) -> Result<ChunkedResult, SofError>
Process a chunk of resources through this ViewDefinition.
Returns a ChunkedResult containing the rows generated from the chunk.
Uses parallel processing via rayon for improved throughput.
Trait Implementations§
Source§impl Clone for PreparedViewDefinition
impl Clone for PreparedViewDefinition
Source§fn clone(&self) -> PreparedViewDefinition
fn clone(&self) -> PreparedViewDefinition
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PreparedViewDefinition
impl RefUnwindSafe for PreparedViewDefinition
impl Send for PreparedViewDefinition
impl Sync for PreparedViewDefinition
impl Unpin for PreparedViewDefinition
impl UnsafeUnpin for PreparedViewDefinition
impl UnwindSafe for PreparedViewDefinition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more