haste_fhir_terminology/
lib.rs1use haste_fhir_generated_ops::generated::{CodeSystemLookup, ValueSetExpand, ValueSetValidateCode};
2use haste_fhir_operation_error::{OperationOutcomeError, derive::OperationOutcomeError};
3
4pub mod client;
5pub mod resolvers;
6
7#[derive(OperationOutcomeError, Debug)]
8pub enum TerminologyError {
9 #[error(code = "processing", diagnostic = "Failed to expand value set")]
10 ExpansionError,
11 #[error(code = "processing", diagnostic = "Failed to validate code")]
12 ValidationError,
13 #[error(code = "processing", diagnostic = "Failed to lookup code system")]
14 LookupError,
15}
16
17pub trait FHIRTerminology {
18 fn expand(
19 &self,
20 input: ValueSetExpand::Input,
21 ) -> impl Future<Output = Result<ValueSetExpand::Output, OperationOutcomeError>> + Send;
22 fn validate(
23 &self,
24
25 input: ValueSetValidateCode::Input,
26 ) -> impl Future<Output = Result<ValueSetValidateCode::Output, OperationOutcomeError>> + Send;
27 fn lookup(
28 &self,
29 input: CodeSystemLookup::Input,
30 ) -> impl Future<Output = Result<CodeSystemLookup::Output, OperationOutcomeError>> + Send;
31}