use of org.ehrbase.fhirbridge.ehr.ResourceTemplateProvider in project fhir-bridge by ehrbase.
the class AbstractSetupIT method setup.
@BeforeAll
static void setup() throws URISyntaxException {
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("myuser", "myPassword432"));
CloseableHttpClient httpClient = HttpClientBuilder.create().setDefaultCredentialsProvider(credentialsProvider).build();
DefaultRestClient client = new DefaultRestClient(new OpenEhrClientConfig(new URI("http://localhost:8080/ehrbase/")), new ResourceTemplateProvider("classpath:/opt/*.opt"), httpClient);
PATIENT_ID = UUID.randomUUID().toString();
EhrStatus ehrStatus = new EhrStatus();
ehrStatus.setSubject(new PartySelf(new PartyRef(new HierObjectId(PATIENT_ID), "demographic", "PERSON")));
ehrStatus.setArchetypeNodeId("openEHR-EHR-EHR_STATUS.generic.v1");
ehrStatus.setName(new DvText("Integration tests status"));
client.ehrEndpoint().createEhr(ehrStatus);
}
use of org.ehrbase.fhirbridge.ehr.ResourceTemplateProvider in project fhir-bridge by ehrbase.
the class CompositionProducer method debugMapping.
private void debugMapping(CompositionEntity composition) {
ResourceTemplateProvider resourceTemplateProvider = new ResourceTemplateProvider("classpath:/opt/");
resourceTemplateProvider.afterPropertiesSet();
Unflattener unflattener = new Unflattener(resourceTemplateProvider);
RMObject rmObject = unflattener.unflatten(composition);
CanonicalJson canonicalJson = new CanonicalJson();
String compositionJson = canonicalJson.marshal(rmObject);
writeToFile(compositionJson);
}
use of org.ehrbase.fhirbridge.ehr.ResourceTemplateProvider in project fhir-bridge by ehrbase.
the class AbstractMappingTestSetupIT method compareCompositions.
public Diff compareCompositions(Javers javers, String paragonFilePath, CompositionEntity mappedComposition) throws IOException {
RMObject composition = new CanonicalJson().unmarshal(testFileLoader.loadResourceToString(paragonFilePath), com.nedap.archie.rm.composition.Composition.class);
ResourceTemplateProvider resourceTemplateProvider = new ResourceTemplateProvider("classpath:/opt/");
resourceTemplateProvider.afterPropertiesSet();
Flattener cut = new Flattener(resourceTemplateProvider);
CompositionEntity paragonComposition = cut.flatten(composition, mappedComposition.getClass());
Diff diff = javers.compare(paragonComposition, mappedComposition);
diff.getChanges().forEach(System.out::println);
return diff;
}
Aggregations