-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/LNK-3102' into LNK-3102
- Loading branch information
Showing
21 changed files
with
496 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
.../main/java/com/lantanagroup/link/measureeval/repositories/LinkInMemoryFhirRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.lantanagroup.link.measureeval.repositories; | ||
|
||
import ca.uhn.fhir.context.FhirContext; | ||
import org.hl7.fhir.instance.model.api.IBaseBundle; | ||
import org.hl7.fhir.r4.model.Bundle; | ||
import org.opencds.cqf.fhir.utility.repository.InMemoryFhirRepository; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* This class extends the InMemoryFhirRepository to provide a transaction method that will update the resources in the repository. | ||
* This implementation is primarily used to avoid the exception stack trace that is thrown when the InMemoryFhirRepository.transaction method is called by measure eval, but is not implemented | ||
* in the default InMemoryFhirRepository. | ||
*/ | ||
public class LinkInMemoryFhirRepository extends InMemoryFhirRepository { | ||
private static final Logger logger = LoggerFactory.getLogger(LinkInMemoryFhirRepository.class); | ||
|
||
public LinkInMemoryFhirRepository(FhirContext context) { | ||
super(context); | ||
} | ||
|
||
public LinkInMemoryFhirRepository(FhirContext context, IBaseBundle bundle) { | ||
super(context, bundle); | ||
} | ||
|
||
@Override | ||
public <B extends IBaseBundle> B transaction(B transaction, Map<String, String> headers) { | ||
if (!(transaction instanceof Bundle)) { | ||
return transaction; | ||
} | ||
|
||
Bundle bundle = (Bundle) transaction; | ||
|
||
if (bundle.getEntry() == null || bundle.getEntry().size() == 0) { | ||
return transaction; | ||
} | ||
|
||
for (Bundle.BundleEntryComponent entry : bundle.getEntry()) { | ||
if (entry != null && entry.hasResource()) { | ||
try { | ||
// Ensure each resource has an ID, or create a GUID for them | ||
if (!entry.getResource().hasId()) { | ||
entry.getResource().setId(java.util.UUID.randomUUID().toString()); | ||
} | ||
|
||
this.update(entry.getResource()); | ||
} catch (Exception ex) { | ||
logger.warn("Failed to process resource in transaction", ex); | ||
} | ||
} | ||
} | ||
|
||
return transaction; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...measureeval/src/main/java/com/lantanagroup/link/measureeval/services/LibraryResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.lantanagroup.link.measureeval.services; | ||
|
||
import org.hl7.fhir.r4.model.Library; | ||
|
||
public interface LibraryResolver { | ||
Library resolve(String libraryId); | ||
} |
Oops, something went wrong.