forked from google/fhir-data-pipes
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into isolate_fhir_sync
- Loading branch information
Showing
194 changed files
with
3,461,145 additions
and
1,336 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
30 changes: 30 additions & 0 deletions
30
bunsen/bunsen-avro/src/test/java/com/cerner/bunsen/avro/TestUtil.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,30 @@ | ||
package com.cerner.bunsen.avro; | ||
|
||
import ca.uhn.fhir.context.FhirContext; | ||
import ca.uhn.fhir.parser.IParser; | ||
import org.hl7.fhir.instance.model.api.IBaseResource; | ||
|
||
public class TestUtil { | ||
|
||
/** | ||
* This is used when we want to verify that no information is lost in the process of converting to | ||
* Avro records. The idea is to convert the resource to the JSON representation then parse it back | ||
* to a HAPI object and verify we get the original HAPI object. This is needed because HAPI adds | ||
* some information, like `resourceType` in `id` fields, when parsing from JSON but, we don't have | ||
* that in the `id` field of converted Avro fields. See: | ||
* https://github.com/google/fhir-data-pipes/issues/1003 Also see: | ||
* https://github.com/google/fhir-data-pipes/issues/1214 | ||
* | ||
* @param resource the resource which is created from an Avro record. | ||
* @param resourceClass the Class of the resource. | ||
* @param fhirContext the FHIR context. | ||
* @return a HAPI object created from parsing the encoded version of `resource`. | ||
*/ | ||
public static IBaseResource encodeThenParse( | ||
IBaseResource resource, | ||
Class<? extends IBaseResource> resourceClass, | ||
FhirContext fhirContext) { | ||
IParser jsonParser = fhirContext.newJsonParser(); | ||
return jsonParser.parseResource(resourceClass, jsonParser.encodeResourceToString(resource)); | ||
} | ||
} |
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
Oops, something went wrong.