Updated docs

This commit is contained in:
Nick Goupinets 2021-03-09 16:41:50 -05:00
parent 052919eb33
commit 9056c95865
4 changed files with 52 additions and 3 deletions

View File

@ -227,3 +227,52 @@ The UserRequestRetryVersionConflictsInterceptor allows clients to request that t
# JPA Server: Validate Data Being Stored # JPA Server: Validate Data Being Stored
The RepositoryValidatingInterceptor can be used to enforce validation rules on data stored in a HAPI FHIR JPA Repository. See [Repository Validating Interceptor](/docs/validation/repository_validating_interceptor.html) for more information. The RepositoryValidatingInterceptor can be used to enforce validation rules on data stored in a HAPI FHIR JPA Repository. See [Repository Validating Interceptor](/docs/validation/repository_validating_interceptor.html) for more information.
# Data Standardization
```StandardizingInterceptor``` handles data standardization (s13n) requirements. This interceptor applies standardization rules on all FHIR primitives as configured in the ```s13n.json``` file that should be made available on the classpath. This file contains FHIRPath definitions together with the standardizers that should be applied to that path. It comes with six per-build standardizers: NAME_FAMILY, NAME_GIVEN, EMAIL, TITLE, PHONE and TEXT. Custom standardizers can be developed by implementing ```ca.uhn.fhir.rest.server.interceptor.s13n.standardizers.IStandardizer``` interface.
A sample configuration file can be found below:
```json
{
"Person" : {
"Person.name.family" : "NAME_FAMILY",
"Person.name.given" : "NAME_GIVEN",
"Person.telecom.where(system='phone').value" : "PHONE"
},
"Patient" : {
"name.family" : "NAME_FAMILY",
"name.given" : "NAME_GIVEN",
"telecom.where(system='phone').value" : "PHONE"
},
"*" : {
"telecom.where(system='email').value" : "org.example.s13n.MyCustomStandardizer"
}
}
```
Standardization can be disabled for a given request by providing ```HAPI-Standardization-Disabled``` request header.
# Validation: Address Validation
```AddressValidatingInterceptor``` takes care of validation of addresses on all incoming resources through a 3rd party address validation service. Before a resource containing an Address field is stored, this interceptor invokes address validation service and then stores validation results as an extension on the address with ```https://hapifhir.org/AddressValidation/``` URL.
This interceptor is configured in ```address-validation.properties``` file that should be made available on the classpath. This file must contain ```validator.class``` property, which defines a fully qualified class implementing ```ca.uhn.fhir.rest.server.interceptor.validation.address.IAddressValidator``` interface. The specified implementation must provide service-specific logic for validating an Address instance. An example implementation can be found in ```ca.uhn.fhir.rest.server.interceptor.validation.address.impl.LoquateAddressValidator``` class which validates addresses by using Loquate Data Cleanse service.
Address validation can be disabled for a given request by providing ```HAPI-Address-Validation-Disabled``` request header.
# Validation: Field-Level Validation
```FieldValidatingInterceptor``` allows validating primitive fields on various FHIR resources. It expects validation rules to be provided via ```field-validation-rules.json``` file that should be available on the classpath. JSON in this file defines a mapping of FHIRPath expressions to validators that should be applied to those fields. Custom validators that implement ```ca.uhn.fhir.rest.server.interceptor.validation.fields.IValidator``` interface can be provided.
```json
{
"telecom.where(system='email').value" : "EMAIL",
"telecom.where(system='phone').value" : "org.example.validation.MyCustomValidator"
}
```
Field validation can be disabled for a given request by providing ```HAPI-Field-Validation-Disabled``` request header.

View File

@ -32,7 +32,7 @@ public class StandardizingInterceptor extends ServerOperationInterceptorAdapter
NAME_FAMILY, NAME_GIVEN, EMAIL, TITLE, PHONE, TEXT; NAME_FAMILY, NAME_GIVEN, EMAIL, TITLE, PHONE, TEXT;
} }
public static final String STANDARDIZATION_DISABLED_HEADER = "CDR-Standardization-Disabled"; public static final String STANDARDIZATION_DISABLED_HEADER = "HAPI-Standardization-Disabled";
private static final Logger ourLog = LoggerFactory.getLogger(StandardizingInterceptor.class); private static final Logger ourLog = LoggerFactory.getLogger(StandardizingInterceptor.class);

View File

@ -25,7 +25,7 @@ public class AddressValidatingInterceptor extends ServerOperationInterceptorAdap
public static final String ADDRESS_TYPE_NAME = "Address"; public static final String ADDRESS_TYPE_NAME = "Address";
public static final String PROPERTY_VALIDATOR_CLASS = "validator.class"; public static final String PROPERTY_VALIDATOR_CLASS = "validator.class";
public static final String ADDRESS_VALIDATION_DISABLED_HEADER = "CDR-Address-Validation-Disabled"; public static final String ADDRESS_VALIDATION_DISABLED_HEADER = "HAPI-Address-Validation-Disabled";
private ExtensionHelper myExtensionHelper = new ExtensionHelper(); private ExtensionHelper myExtensionHelper = new ExtensionHelper();

View File

@ -22,7 +22,7 @@ public class FieldValidatingInterceptor extends ServerOperationInterceptorAdapte
private static final Logger ourLog = LoggerFactory.getLogger(FieldValidatingInterceptor.class); private static final Logger ourLog = LoggerFactory.getLogger(FieldValidatingInterceptor.class);
public static final String VALIDATION_DISABLED_HEADER = "CDR-Field-Validation-Disabled"; public static final String VALIDATION_DISABLED_HEADER = "HAPI-Field-Validation-Disabled";
private IAddressValidator myAddressValidator; private IAddressValidator myAddressValidator;