Examples: System To System Data Exchange
This page contains example interceptors that can be registered with System-to-System Data Exchange.
The following interceptor can be used to implement custom patient matching algorithm for the $member-match operation.
/*-
* #%L
* Smile CDR - CDR
* %%
* Copyright (C) 2016 - 2025 Smile CDR, Inc.
* %%
* All rights reserved.
* #L%
*/
package com.smilecdr.demo.s2sdataexchange;
import ca.cdr.api.fhir.interceptor.CdrHook;
import ca.cdr.api.fhir.interceptor.CdrPointcut;
import ca.cdr.api.fhir.interceptor.MemberMatchRequest;
import ca.uhn.fhir.interceptor.api.Interceptor;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.util.StopWatch;
import org.hl7.fhir.r4.model.Patient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"unused", "EmptyTryBlock"})
@Interceptor
public class S2SDataExchangeInterceptorTemplate {
private static final Logger ourLog = LoggerFactory.getLogger(S2SDataExchangeInterceptorTemplate.class);
@CdrHook(CdrPointcut.MEMBER_MATCH)
public Patient channelImportMessagePreProcessed(
MemberMatchRequest theMemberMatchRequest, RequestDetails theRequestDetails) {
ourLog.info("Interceptor MEMBER_MATCH - started");
StopWatch stopWatch = new StopWatch();
try {
// your implementation goes here
} finally {
ourLog.info("Interceptor MEMBER_MATCH - ended, execution took {}", stopWatch);
}
// should return a Patient if matching patient is found or null otherwise
return null;
}
}
You are about to leave the Smile Digital Health documentation and navigate to the Open Source HAPI-FHIR Documentation.