Skip to main content

ViewDefinitionWhereTrait

Trait ViewDefinitionWhereTrait 

Source
pub trait ViewDefinitionWhereTrait {
    // Required method
    fn path(&self) -> Option<&str>;
}
Expand description

Trait for abstracting ViewDefinitionWhere across FHIR versions.

This trait provides version-agnostic access to where clause definitions, which filter resources before processing. Where clauses use FHIRPath expressions that must evaluate to boolean or boolean-coercible values.

§Filtering Logic

Resources are included in processing only if ALL where clauses evaluate to:

  • true (boolean)
  • Non-empty collections
  • Any other “truthy” value

Resources are excluded if ANY where clause evaluates to:

  • false (boolean)
  • Empty collections
  • Empty/null results

§Examples

use helios_sof::traits::ViewDefinitionWhereTrait;

fn check_where_clause<T: ViewDefinitionWhereTrait>(where_clause: &T) {
    if let Some(path) = where_clause.path() {
        println!("Filter condition: {}", path);
         
        // Example paths:
        // "active = true"                  // Boolean condition
        // "name.exists()"                 // Existence check  
        // "birthDate >= @1990-01-01"      // Date comparison
        // "telecom.where(system='email')" // Collection filtering
    }
}

Required Methods§

Source

fn path(&self) -> Option<&str>

Returns the FHIRPath expression that must evaluate to true for resource inclusion

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ViewDefinitionWhereTrait for ViewDefinitionWhere

Source§

fn path(&self) -> Option<&str>

Implementors§