Search in sources :

Example 1 with Source

use of org.hl7.fhir.utilities.validation.ValidationMessage.Source in project beneficiary-fhir-data by CMSgov.

the class InpatientClaimTransformerV2Test method shouldHaveClmSrcIpAdmsnCdSupInfo.

@Test
public void shouldHaveClmSrcIpAdmsnCdSupInfo() {
    SupportingInformationComponent sic = TransformerTestUtilsV2.findSupportingInfoByCode("https://bluebutton.cms.gov/resources/variables/clm_src_ip_admsn_cd", eob.getSupportingInfo());
    SupportingInformationComponent compare = TransformerTestUtilsV2.createSupportingInfo(// We don't care what the sequence number is here
    sic.getSequence(), // Category
    Arrays.asList(new Coding("http://terminology.hl7.org/CodeSystem/claiminformationcategory", "info", "Information"), new Coding("https://bluebutton.cms.gov/resources/codesystem/information", "https://bluebutton.cms.gov/resources/variables/clm_src_ip_admsn_cd", "Claim Source Inpatient Admission Code")), // Code
    new Coding("https://bluebutton.cms.gov/resources/variables/clm_src_ip_admsn_cd", "4", null));
    assertTrue(compare.equalsDeep(sic));
}
Also used : SupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent) Coding(org.hl7.fhir.r4.model.Coding) Test(org.junit.jupiter.api.Test)

Example 2 with Source

use of org.hl7.fhir.utilities.validation.ValidationMessage.Source in project beneficiary-fhir-data by CMSgov.

the class SNFClaimTransformerV2Test method shouldHaveClmSrcIpAdmsnCdSupInfo.

@Test
public void shouldHaveClmSrcIpAdmsnCdSupInfo() {
    SupportingInformationComponent sic = TransformerTestUtilsV2.findSupportingInfoByCode("https://bluebutton.cms.gov/resources/variables/clm_src_ip_admsn_cd", eob.getSupportingInfo());
    SupportingInformationComponent compare = TransformerTestUtilsV2.createSupportingInfo(// We don't care what the sequence number is here
    sic.getSequence(), // Category
    Arrays.asList(new Coding("http://terminology.hl7.org/CodeSystem/claiminformationcategory", "info", "Information"), new Coding("https://bluebutton.cms.gov/resources/codesystem/information", "https://bluebutton.cms.gov/resources/variables/clm_src_ip_admsn_cd", "Claim Source Inpatient Admission Code")), // Code
    new Coding("https://bluebutton.cms.gov/resources/variables/clm_src_ip_admsn_cd", "4", null));
    assertTrue(compare.equalsDeep(sic));
}
Also used : SupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent) Coding(org.hl7.fhir.r4.model.Coding) Test(org.junit.jupiter.api.Test)

Example 3 with Source

use of org.hl7.fhir.utilities.validation.ValidationMessage.Source in project kindling by HL7.

the class Publisher method stripXml.

private InputStream stripXml(InputStream source) throws Exception {
    XmlParser p = new XmlParser();
    Resource r = p.parse(source);
    minify(r);
    ByteArrayOutputStream bo = new ByteArrayOutputStream();
    p.compose(bo, r);
    bo.close();
    return new ByteArrayInputStream(bo.toByteArray());
}
Also used : XmlParser(org.hl7.fhir.r5.formats.XmlParser) ByteArrayInputStream(java.io.ByteArrayInputStream) Resource(org.hl7.fhir.r5.model.Resource) DomainResource(org.hl7.fhir.r5.model.DomainResource) CanonicalResource(org.hl7.fhir.r5.model.CanonicalResource) ByteArrayOutputStream(java.io.ByteArrayOutputStream)

Example 4 with Source

use of org.hl7.fhir.utilities.validation.ValidationMessage.Source in project kindling by HL7.

the class Publisher method minify.

private void minify(String srcFile, String dstFile) throws Exception {
    CloseProtectedZipInputStream source = new CloseProtectedZipInputStream(new FileInputStream(srcFile));
    ZipGenerator dest = new ZipGenerator(dstFile);
    ZipEntry entry = null;
    while ((entry = source.getNextEntry()) != null) {
        String name = entry.getName();
        if (name.endsWith(".xsd"))
            dest.addStream(entry.getName(), stripXsd(source), false);
        else if (name.endsWith(".json") && !name.endsWith(".schema.json"))
            dest.addStream(entry.getName(), stripJson(source), false);
        else if (name.endsWith(".xml"))
            dest.addStream(entry.getName(), stripXml(source), false);
        else
            dest.addStream(entry.getName(), source, false);
    }
    source.actualClose();
    dest.close();
}
Also used : ZipEntry(java.util.zip.ZipEntry) ZipGenerator(org.hl7.fhir.utilities.ZipGenerator) CSFileInputStream(org.hl7.fhir.utilities.CSFileInputStream) FileInputStream(java.io.FileInputStream) CloseProtectedZipInputStream(org.hl7.fhir.utilities.CloseProtectedZipInputStream)

Example 5 with Source

use of org.hl7.fhir.utilities.validation.ValidationMessage.Source in project kindling by HL7.

the class Publisher method cachePage.

private void cachePage(String filename, String source, String title, boolean includeInBook) throws Exception {
    try {
        // page.log("parse "+filename);
        XhtmlDocument src = new XhtmlParser().parse(source, "html");
        scanForFragments(filename, src);
        // book.getPages().put(filename, src);
        page.getHTMLChecker().registerFile(filename, title, HTMLLinkChecker.XHTML_TYPE, includeInBook);
    } catch (Exception e) {
        throw new Exception("error parsing page " + filename + ": " + e.getMessage() + " in source\r\n" + source, e);
    }
}
Also used : XhtmlParser(org.hl7.fhir.utilities.xhtml.XhtmlParser) TransformerException(javax.xml.transform.TransformerException) IOException(java.io.IOException) FHIRException(org.hl7.fhir.exceptions.FHIRException) FileNotFoundException(java.io.FileNotFoundException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) XhtmlDocument(org.hl7.fhir.utilities.xhtml.XhtmlDocument)

Aggregations

FHIRException (org.hl7.fhir.exceptions.FHIRException)125 FileInputStream (java.io.FileInputStream)59 FileOutputStream (java.io.FileOutputStream)55 IOException (java.io.IOException)55 ArrayList (java.util.ArrayList)48 File (java.io.File)45 CSFileInputStream (org.hl7.fhir.utilities.CSFileInputStream)45 TextFile (org.hl7.fhir.utilities.TextFile)41 CSFile (org.hl7.fhir.utilities.CSFile)35 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)35 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)30 XmlParser (org.hl7.fhir.r5.formats.XmlParser)28 Date (java.util.Date)27 HashMap (java.util.HashMap)26 Reference (org.hl7.fhir.r4.model.Reference)26 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)24 FHIRFormatError (org.hl7.fhir.exceptions.FHIRFormatError)24 Coding (org.hl7.fhir.r4.model.Coding)24 JsonObject (com.google.gson.JsonObject)22 NotImplementedException (org.apache.commons.lang3.NotImplementedException)22