use of gov.cms.qpp.conversion.api.model.Metadata in project qpp-conversion-tool by CMSgov.
the class MetadataHelperTest method testExtractsNpiFromChild.
@Test
void testExtractsNpiFromChild() {
Node node = new Node();
Node child = new Node();
child.setType(TemplateId.CLINICAL_DOCUMENT);
child.putValue(ClinicalDocumentDecoder.NATIONAL_PROVIDER_IDENTIFIER, MOCK_STRING);
node.addChildNode(child);
Metadata metadata = MetadataHelper.generateMetadata(node, MetadataHelper.Outcome.SUCCESS);
assertThat(metadata.getNpi()).isEqualTo(MOCK_STRING);
}
use of gov.cms.qpp.conversion.api.model.Metadata in project qpp-conversion-tool by CMSgov.
the class MetadataHelperTest method testExtractsTin.
@Test
void testExtractsTin() {
Node node = new Node();
node.putValue(ClinicalDocumentDecoder.TAX_PAYER_IDENTIFICATION_NUMBER, MOCK_STRING);
Metadata metadata = MetadataHelper.generateMetadata(node, MetadataHelper.Outcome.SUCCESS);
assertThat(metadata.getTin()).isEqualTo(MOCK_STRING);
}
use of gov.cms.qpp.conversion.api.model.Metadata in project qpp-conversion-tool by CMSgov.
the class MetadataHelperTest method testChildLacksTin.
@Test
void testChildLacksTin() {
Node node = new Node();
Node child = new Node();
child.setType(TemplateId.CLINICAL_DOCUMENT);
node.addChildNode(child);
Metadata metadata = MetadataHelper.generateMetadata(node, MetadataHelper.Outcome.SUCCESS);
assertThat(metadata.getTin()).isNull();
}
use of gov.cms.qpp.conversion.api.model.Metadata in project qpp-conversion-tool by CMSgov.
the class MetadataHelperTest method testExtractsCpcProgramType.
@Test
void testExtractsCpcProgramType() {
Node node = new Node();
node.putValue(ClinicalDocumentDecoder.RAW_PROGRAM_NAME, "CPCPLUS");
Metadata metadata = MetadataHelper.generateMetadata(node, MetadataHelper.Outcome.SUCCESS);
assertThat(metadata.getCpc()).startsWith(Constants.CPC_DYNAMO_PARTITION_START);
}
use of gov.cms.qpp.conversion.api.model.Metadata in project qpp-conversion-tool by CMSgov.
the class AuditServiceImpl method failValidation.
/**
* Audit a failed submission validation.
*
* @param conversionReport report of the conversion
* @return future
*/
@Override
public CompletableFuture<Void> failValidation(ConversionReport conversionReport) {
if (noAudit()) {
return null;
}
API_LOG.info("Writing audit information for a validation failure scenario");
Source qrdaSource = conversionReport.getQrdaSource();
Source qppSource = conversionReport.getQppSource();
Source validationErrorSource = conversionReport.getValidationErrorsSource();
Source rawValidationErrorSource = conversionReport.getRawValidationErrorsOrEmptySource();
Metadata metadata = initMetadata(conversionReport, Outcome.VALIDATION_ERROR);
CompletableFuture<Void> allWrites = CompletableFuture.allOf(storeContent(rawValidationErrorSource).thenAccept(metadata::setRawValidationErrorLocator), storeContent(validationErrorSource).thenAccept(metadata::setValidationErrorLocator), storeContent(qppSource).thenAccept(metadata::setQppLocator), storeContent(qrdaSource).thenAccept(metadata::setSubmissionLocator));
return allWrites.whenComplete((nada, thrown) -> persist(metadata, thrown));
}
Aggregations