Search in sources :

Example 31 with Metadata

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);
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Metadata(gov.cms.qpp.conversion.api.model.Metadata) Test(org.junit.jupiter.api.Test)

Example 32 with Metadata

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);
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Metadata(gov.cms.qpp.conversion.api.model.Metadata) Test(org.junit.jupiter.api.Test)

Example 33 with Metadata

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();
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Metadata(gov.cms.qpp.conversion.api.model.Metadata) Test(org.junit.jupiter.api.Test)

Example 34 with Metadata

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);
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Metadata(gov.cms.qpp.conversion.api.model.Metadata) Test(org.junit.jupiter.api.Test)

Example 35 with Metadata

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));
}
Also used : Metadata(gov.cms.qpp.conversion.api.model.Metadata) Source(gov.cms.qpp.conversion.Source)

Aggregations

Metadata (gov.cms.qpp.conversion.api.model.Metadata)40 Test (org.junit.jupiter.api.Test)24 Node (gov.cms.qpp.conversion.model.Node)16 Source (gov.cms.qpp.conversion.Source)5 ConversionReport (gov.cms.qpp.conversion.ConversionReport)4 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)3 ResponseEntity (org.springframework.http.ResponseEntity)3 InvalidFileTypeException (gov.cms.qpp.conversion.api.exceptions.InvalidFileTypeException)2 NoFileInDatabaseException (gov.cms.qpp.conversion.api.exceptions.NoFileInDatabaseException)2 Outcome (gov.cms.qpp.conversion.api.helper.MetadataHelper.Outcome)2 AcceptanceTest (gov.cms.qpp.test.annotations.AcceptanceTest)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 InputStreamSupplierSource (gov.cms.qpp.conversion.InputStreamSupplierSource)1 AuditException (gov.cms.qpp.conversion.api.exceptions.AuditException)1 InvalidPurposeException (gov.cms.qpp.conversion.api.exceptions.InvalidPurposeException)1 UncheckedInterruptedException (gov.cms.qpp.conversion.api.exceptions.UncheckedInterruptedException)1 MetadataHelper (gov.cms.qpp.conversion.api.helper.MetadataHelper)1 Constants (gov.cms.qpp.conversion.api.model.Constants)1 UnprocessedCpcFileData (gov.cms.qpp.conversion.api.model.UnprocessedCpcFileData)1 InputStream (java.io.InputStream)1