Search in sources :

Example 1 with IParser

use of org.hl7.fhir.r4b.formats.IParser in project beneficiary-fhir-data by CMSgov.

the class DMEClaimTransformerV2Test method before.

@BeforeEach
public void before() {
    claim = generateClaim();
    ExplanationOfBenefit genEob = DMEClaimTransformerV2.transform(new MetricRegistry(), claim, Optional.empty());
    IParser parser = fhirContext.newJsonParser();
    String json = parser.encodeResourceToString(genEob);
    eob = parser.parseResource(ExplanationOfBenefit.class, json);
}
Also used : MetricRegistry(com.codahale.metrics.MetricRegistry) ExplanationOfBenefit(org.hl7.fhir.r4.model.ExplanationOfBenefit) IParser(ca.uhn.fhir.parser.IParser) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with IParser

use of org.hl7.fhir.r4b.formats.IParser in project beneficiary-fhir-data by CMSgov.

the class CarrierClaimTransformerV2Test method before.

@BeforeEach
public void before() {
    claim = generateClaim();
    ExplanationOfBenefit genEob = CarrierClaimTransformerV2.transform(new MetricRegistry(), claim, Optional.empty());
    IParser parser = fhirContext.newJsonParser();
    String json = parser.encodeResourceToString(genEob);
    eob = parser.parseResource(ExplanationOfBenefit.class, json);
}
Also used : MetricRegistry(com.codahale.metrics.MetricRegistry) ExplanationOfBenefit(org.hl7.fhir.r4.model.ExplanationOfBenefit) IParser(ca.uhn.fhir.parser.IParser) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with IParser

use of org.hl7.fhir.r4b.formats.IParser in project beneficiary-fhir-data by CMSgov.

the class HospiceClaimTransformerV2Test method createEOB.

private void createEOB(Optional<Boolean> includeTaxNumber) {
    ExplanationOfBenefit genEob = HospiceClaimTransformerV2.transform(new MetricRegistry(), claim, includeTaxNumber);
    IParser parser = fhirContext.newJsonParser();
    String json = parser.encodeResourceToString(genEob);
    eob = parser.parseResource(ExplanationOfBenefit.class, json);
}
Also used : MetricRegistry(com.codahale.metrics.MetricRegistry) ExplanationOfBenefit(org.hl7.fhir.r4.model.ExplanationOfBenefit) IParser(ca.uhn.fhir.parser.IParser)

Example 4 with IParser

use of org.hl7.fhir.r4b.formats.IParser in project beneficiary-fhir-data by CMSgov.

the class InpatientClaimTransformerV2Test method before.

@BeforeEach
public void before() {
    claim = generateClaim();
    ExplanationOfBenefit genEob = InpatientClaimTransformerV2.transform(new MetricRegistry(), claim, Optional.empty());
    IParser parser = fhirContext.newJsonParser();
    String json = parser.encodeResourceToString(genEob);
    eob = parser.parseResource(ExplanationOfBenefit.class, json);
}
Also used : MetricRegistry(com.codahale.metrics.MetricRegistry) ExplanationOfBenefit(org.hl7.fhir.r4.model.ExplanationOfBenefit) IParser(ca.uhn.fhir.parser.IParser) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with IParser

use of org.hl7.fhir.r4b.formats.IParser in project kindling by HL7.

the class Publisher method resource2Json.

private String resource2Json(Resource r) throws Exception {
    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    IParser json = new JsonParser().setOutputStyle(OutputStyle.PRETTY);
    json.setSuppressXhtml("Snipped for Brevity");
    json.compose(bytes, r);
    bytes.close();
    return new String(bytes.toByteArray());
}
Also used : ByteArrayOutputStream(java.io.ByteArrayOutputStream) IParser(org.hl7.fhir.r5.formats.IParser) JsonParser(org.hl7.fhir.r5.formats.JsonParser)

Aggregations

IParser (ca.uhn.fhir.parser.IParser)89 FhirContext (ca.uhn.fhir.context.FhirContext)43 IOException (java.io.IOException)35 ByteArrayOutputStream (java.io.ByteArrayOutputStream)30 Test (org.junit.Test)24 InputStream (java.io.InputStream)22 IParser (org.hl7.fhir.r5.formats.IParser)19 JsonParser (org.hl7.fhir.r5.formats.JsonParser)18 Test (org.junit.jupiter.api.Test)18 FHIRException (org.hl7.fhir.exceptions.FHIRException)17 ByteArrayInputStream (java.io.ByteArrayInputStream)16 File (java.io.File)16 FileInputStream (java.io.FileInputStream)16 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)15 Bundle (org.hl7.fhir.r4.model.Bundle)14 FileOutputStream (java.io.FileOutputStream)12 Bundle (org.hl7.fhir.dstu3.model.Bundle)12 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)12 XmlParser (org.hl7.fhir.r5.formats.XmlParser)12 ArrayList (java.util.ArrayList)11