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.
Sourcepub fn process_chunk_with_external(
&self,
chunk: ResourceChunk,
external: Vec<FhirResource>,
) -> Result<ChunkedResult, SofError>
pub fn process_chunk_with_external( &self, chunk: ResourceChunk, external: Vec<FhirResource>, ) -> Result<ChunkedResult, SofError>
Like Self::process_chunk, but folds external resources into this
chunk’s resolution pool. Used by the streaming remote-resolve() driver
(process_ndjson_chunked_remote) to inject resources prefetched from
trusted servers for references found in the chunk.
Trait Implementations§
Source§impl Clone for PreparedViewDefinition
impl Clone for PreparedViewDefinition
Source§fn clone(&self) -> PreparedViewDefinition
fn clone(&self) -> PreparedViewDefinition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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§
impl<T> Allocation for T
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
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>
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>
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