generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
15223: generate empty in convert (#16137)
* 15223: generate empty report for garbled convert data * fixup! 15223: generate empty report for garbled convert data * fixup! 15223: generate empty report for garbled convert data * fixup! 15223: generate empty report for garbled convert data * fixup! 15223: generate empty report for garbled convert data * fixup! 15223: generate empty report for garbled convert data
- Loading branch information
Showing
5 changed files
with
116 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,6 +127,24 @@ OBX|4|CWE|95421-4^Resides in a congregate care setting^LN^^^^2.69||N^No^HL70136| | |
OBX|5|CWE|95419-8^Has symptoms related to condition of interest^LN^^^^2.69||N^No^HL70136||||||F|||202102090000-0600|||||||||||||||QST | ||
SPM|1|0cba76f5-35e0-4a28-803a-2f31308aae9b||258500001^Nasopharyngeal swab^SCT||||71836000^Nasopharyngeal structure (body structure)^SCT^^^^2020-09-01|||||||||202102090000-0600|202102090000-0600""" | ||
|
||
// This report is trying to contain two items, but the HL7 is garbled, the first is missing an MSH segment and the second | ||
// has a typo in its MSH segment | ||
@Suppress("ktlint:standard:max-line-length") | ||
const val garbledHL7Record = | ||
"""FT|Centers for Disease Control and Prevention|0.1-SNAPSHOT|PRIME ReportStream|0.1-SNAPSHOT||20210210 | ||
PID|1||2a14112c-ece1-4f82-915c-7b3a8d152eda^^^Avante at Ormond Beach^PI||Buckridge^Kareem^Millie^^^^L||19580810|F||2106-3^White^HL70005^^^^2.5.1|688 Leighann Inlet^^South Rodneychester^TX^67071^^^^48077||7275555555:1:^PRN^^[email protected]^1^211^2240784|||||||||U^Unknown^HL70189||||||||N | ||
ORC|RE|73a6e9bd-aaec-418e-813a-0ad33366ca85^6^7^8&F^9|73a6e9bd-aaec-418e-813a-0ad33366ca85|||||||||1629082607^Eddin^Husam^^^^^^CMS&2.16.840.1.113883.3.249&ISO^^^^NPI||^WPN^^^1^386^6825220|20210209||||||Avante at Ormond Beach|170 North King Road^^Ormond Beach^FL^32174^^^^12127|^WPN^^[email protected]^1^407^7397506|^^^^32174 | ||
OBR|1|73a6e9bd-aaec-418e-813a-0ad33366ca85|0cba76f5-35e0-4a28-803a-2f31308aae9b|94558-4^SARS-CoV-2 (COVID-19) Ag [Presence] in Respiratory specimen by Rapid immunoassay^LN|||202102090000-0600|202102090000-0600||||||||1629082607^Eddin^Husam^^^^^^CMS&2.16.840.1.113883.3.249&ISO^^^^NPI|^WPN^^^1^386^6825220|||||202102090000-0600|||F | ||
OBX|1|CWE|94558-4^SARS-CoV-2 (COVID-19) Ag [Presence] in Respiratory specimen by Rapid immunoassay^LN||260415000^Not detected^SCT|||N^Normal (applies to non-numeric results)^HL70078|||F|||202102090000-0600|||CareStart COVID-19 Antigen test_Access Bio, Inc._EUA^^99ELR||202102090000-0600||||Avante at Ormond Beach^^^^^CLIA&2.16.840.1.113883.4.7&ISO^^^^10D0876999^CLIA|170 North King Road^^Ormond Beach^FL^32174^^^^12127 | ||
OBX|2|CWE|95418-0^Whether patient is employed in a healthcare setting^LN^^^^2.69||Y^Yes^HL70136||||||F|||202102090000-0600|||||||||||||||QST | ||
OBX|3|CWE|95417-2^First test for condition of interest^LN^^^^2.69||Y^Yes^HL70136||||||F|||202102090000-0600|||||||||||||||QST | ||
OBX|4|CWE|95421-4^Resides in a congregate care setting^LN^^^^2.69||N^No^HL70136||||||F|||202102090000-0600|||||||||||||||QST | ||
OBX|5|CWE|95419-8^Has symptoms related to condition of interest^LN^^^^2.69||N^No^HL70136||||||F|||202102090000-0600|||||||||||||||QST | ||
SPM|1|0cba76f5-35e0-4a28-803a-2f31308aae9b||258500001^Nasopharyngeal swab^SCT||||71836000^Nasopharyngeal structure (body structure)^SCT^^^^2020-09-01|||||||||202102090000-0600|202102090000-0600 | ||
SH|^~\&#!|CDC PRIME - Atlanta, Georgia (Dekalb)^2.16.840.1.114222.4.1.237821^ISO|Avante at Ormond Beach^10D0876999^CLIA|PRIME_DOH|Prime ReportStream|20210210170737||ORU^R01^ORU_R01|371784|P|2.5.1|||NE|NE|USA||||PHLabReportNoAck^ELR_Receiver^2.16.840.1.113883.9.99^ISO | ||
SFT|Centers for Disease Control and Prevention|0.1-SNAPSHOT|PRIME ReportStream|0.1-SNAPSHOT||20210210 | ||
PID|1||2a14112c-ece1-4f82-915c-7b3a8d152eda^^^Avante at Ormond Beach^PI||Buckridge^Kareem^Millie^^^^L||19580810|F||2106-3^White^HL70005^^^^2.5.1|688 Leighann Inlet^^South Rodneychester^TX^67071^^^^48077||7275555555:1:^PRN^^[email protected]^1^211^2240784|||||||||U^Unknown^HL70189||||||||N""" | ||
|
||
@Suppress("ktlint:standard:max-line-length") | ||
const val validRadxMarsHL7Message = | ||
"""MSH|^~\&|MMTC.PROD^2.16.840.1.113883.3.8589.4.2.106.1^ISO|CAREEVOLUTION^00Z0000024^CLIA|AIMS.INTEGRATION.PRD^2.16.840.1.114222.4.3.15.1^ISO|AIMS.PLATFORM^2.16.840.1.114222.4.1.217446^ISO|20240403205305+0000||ORU^R01^ORU_R01|20240403205305_dba7572cc6334f1ea0744c5f235c823e|P|2.5.1|||NE|NE|||||PHLabReport-NoAck^ELR251R1_Rcvr_Prof^2.16.840.1.113883.9.11^ISO | ||
|
@@ -257,12 +275,13 @@ object UniversalPipelineTestUtils { | |
) | ||
|
||
/** | ||
* fetch child reports associated with a [parent] report and ensure we find an [expected] number of children | ||
* fetch child reports associated with a [parent] report and ensure we find an [expectedItems] number of children | ||
*/ | ||
fun fetchChildReports( | ||
parent: Report, | ||
txn: DataAccessTransaction, | ||
expected: Int? = null, | ||
expectedItems: Int? = null, | ||
expectedReports: Int = 1, | ||
): List<ReportFile> { | ||
val itemLineages = DSL | ||
.using(txn) | ||
|
@@ -271,15 +290,15 @@ object UniversalPipelineTestUtils { | |
.where(ItemLineage.ITEM_LINEAGE.PARENT_REPORT_ID.eq(parent.id)) | ||
.fetchInto(gov.cdc.prime.router.azure.db.tables.pojos.ItemLineage::class.java) | ||
|
||
if (expected != null) { | ||
assertThat(itemLineages).hasSize(expected) | ||
assertThat(itemLineages.map { it.childIndex }).isEqualTo(MutableList(expected) { 1 }) | ||
if (expectedItems != null) { | ||
assertThat(itemLineages).hasSize(expectedItems) | ||
assertThat(itemLineages.map { it.childIndex }).isEqualTo(MutableList(expectedItems) { 1 }) | ||
|
||
// itemCount is on the report created by the test. It will not be null. | ||
if (parent.itemCount > 1) { | ||
assertThat(itemLineages.map { it.parentIndex }).isEqualTo((1..expected).toList()) | ||
assertThat(itemLineages.map { it.parentIndex }).isEqualTo((1..expectedItems).toList()) | ||
} else { | ||
assertThat(itemLineages.map { it.parentIndex }).isEqualTo(MutableList(expected) { 1 }) | ||
assertThat(itemLineages.map { it.parentIndex }).isEqualTo(MutableList(expectedItems) { 1 }) | ||
} | ||
} | ||
|
||
|
@@ -290,9 +309,7 @@ object UniversalPipelineTestUtils { | |
.where(ReportLineage.REPORT_LINEAGE.PARENT_REPORT_ID.eq(parent.id)) | ||
.fetchInto(gov.cdc.prime.router.azure.db.tables.pojos.ReportLineage::class.java) | ||
|
||
if (expected != null) { | ||
assertThat(reportLineages).hasSize(expected) | ||
} | ||
assertThat(reportLineages).hasSize(expectedReports) | ||
|
||
val childReportIds = reportLineages.map { | ||
it.childReportId | ||
|
@@ -307,11 +324,13 @@ object UniversalPipelineTestUtils { | |
) | ||
) | ||
.fetchInto(ReportFile::class.java) | ||
if (expected != null) { | ||
assertThat(reportFiles).hasSize(expected) | ||
|
||
assertThat(reportFiles).hasSize(expectedReports) | ||
|
||
if (expectedItems != 0) { | ||
assertThat(itemLineages).transform { lineages -> lineages.map { it.childReportId }.sorted() } | ||
.isEqualTo(reportFiles.map { it.reportId }.sorted()) | ||
} | ||
assertThat(itemLineages).transform { lineages -> lineages.map { it.childReportId }.sorted() } | ||
.isEqualTo(reportFiles.map { it.reportId }.sorted()) | ||
|
||
return reportFiles | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters