use of org.hl7.fhir.r5.formats.IParser in project gpconnect-demonstrator by nhsconnect.
the class ValueSetValidator method findValueSet.
private ValueSet findValueSet(String systemUrl) {
int valueSetNamePos = systemUrl.lastIndexOf("/") + 1;
String valueSetFilename = String.format("%s.xml", systemUrl.substring(valueSetNamePos));
ValueSet valSet = null;
String xmlContent = null;
if (fhirValueSetsCheckWebFirst == true) {
xmlContent = readValueSetFromWeb(valueSetFilename);
}
if (xmlContent == null) {
xmlContent = readValueSetFromDisk(valueSetFilename);
}
if (fhirValueSetsCheckWebFirst == false && xmlContent == null) {
xmlContent = readValueSetFromWeb(valueSetFilename);
}
if (xmlContent != null) {
try {
FhirContext fhirCtx = FhirContext.forDstu3();
IParser parser = fhirCtx.newXmlParser();
valSet = parser.parseResource(ValueSet.class, xmlContent);
} catch (DataFormatException ex) {
LOG.error(String.format("Error parsing valueSetFilename: %s", valueSetFilename));
}
}
if (valSet == null) {
throw OperationOutcomeFactory.buildOperationOutcomeException(new UnprocessableEntityException(String.format("Could not find or parse Value Set [SystemUrl: %s] at: %s. See system log for details.", systemUrl, valueSetFilename)), SystemCode.REFERENCE_NOT_FOUND, IssueType.NOTFOUND);
}
return valSet;
}
use of org.hl7.fhir.r5.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);
}
use of org.hl7.fhir.r5.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);
}
use of org.hl7.fhir.r5.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);
}
use of org.hl7.fhir.r5.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);
}
Aggregations