Skip to content

Commit

Permalink
initial DTR tests (#499)
Browse files Browse the repository at this point in the history
  • Loading branch information
JPercival authored Dec 1, 2023
1 parent e235ae3 commit b2a82fc
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"cSpell.words": [
"acceleratorkit",
"ANCM",
"ASLP",
"Careand",
"conceptmap",
"pagecontent",
"plandefinition",
"testng"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
public class ANCMiniContentTest extends BaseContentTest {

public ANCMiniContentTest() {
super(new Spreadsheet(){{
super(new Spreadsheet() {
{
path = "acceleratorkit/ANC Test Cases-mini.xlsx";
dataDictionarySheets = "ANC.A. Registration,ANC.B5 Quick check,ANC.End End";
scope = "ANCM";
}});
dataElementPages = "ANC.A. Registration,ANC.B5 Quick check,ANC.End End";
}
});
}

@Test
Expand All @@ -28,7 +30,7 @@ public void validateContentCount() {
assertFalse(extensionsPath().toFile().exists());
assertFalse(resourcesPath().toFile().exists());
assertFalse(testsPath().toFile().exists());
assertEquals(vocabularyPath().toFile().listFiles().length, 1);
assertEquals(vocabularyPath().resolve("codesystem").toFile().listFiles().length, 1);
}

@Test
Expand All @@ -44,8 +46,8 @@ public void validateCQLContent() throws IOException {
@Test
public void validateCodeSystem() {
var codeSystem = resourceAtPath(
CodeSystem.class,
vocabularyPath().resolve("codesystem/codesystem-activity-codes.json"));
CodeSystem.class,
vocabularyPath().resolve("codesystem/codesystem-activity-codes.json"));
assertEquals(codeSystem.getTitle(), "ANCM Activity Codes");
}

Expand All @@ -57,7 +59,6 @@ public void exampleIssue628() throws IOException {
// assertEquals(cqlLines.get(20), "// @fluentFunction");
}


@Test
public void validateElm() {
// TODO: Helpers to compile CQL to ELM and validate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected BaseContentTest(Spreadsheet spreadsheet) {
protected BaseContentTest(Spreadsheet spreadsheet, FhirVersionEnum fhirVersion) {
Objects.requireNonNull(spreadsheet, "spreadsheet is required");
Objects.requireNonNull(spreadsheet.path, "spreadsheet path is required");
Objects.requireNonNull(spreadsheet.dataDictionarySheets, "data dictionary sheets are required");
Objects.requireNonNull(spreadsheet.dataElementPages, "data element pages are required");
Objects.requireNonNull(spreadsheet.scope, "scope is required");

Objects.requireNonNull(fhirVersion, "fhir version is required");
Expand Down Expand Up @@ -68,7 +68,6 @@ protected String command() {
*/
protected static class Spreadsheet {
String path;
String dataDictionarySheets;
String encoding;
String scope;
String dataElementPages;
Expand All @@ -79,7 +78,7 @@ protected String[] params() {
return new String[] {
"-s", scope(),
"-pts", spreadsheetPath().toAbsolutePath().toString(),
"-dep", dataDictionarySheets(),
"-dep", dataElementPages(),
"-op", outputPath().toAbsolutePath().toString(),
"-e", encoding(),
"-tc", testCases()};
Expand Down Expand Up @@ -124,8 +123,8 @@ protected Path spreadsheetPath() {
return Path.of(resourcesPath, spreadsheet.path);
}

protected String dataDictionarySheets() {
return spreadsheet.dataDictionarySheets;
protected String dataElementPages() {
return spreadsheet.dataElementPages;
}

// FHIR context accessors
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.opencds.cqf.tooling.acceleratorkit;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;

import org.testng.annotations.Test;

public class DTRContentTest extends BaseContentTest {

public DTRContentTest() {
super(new Spreadsheet() {
{
path = "acceleratorkit/DTR.xlsx";
scope = "ASLP";
dataElementPages = "ASLP.A1 Adult Sleep Studies";
}
});
}

@Test
public void validateContentCount() {
assertEquals(cqlPath().toFile().listFiles().length, 4);
assertEquals(examplesPath().toFile().listFiles().length, 8);
assertFalse(extensionsPath().toFile().exists());
assertEquals(profilesPath().toFile().listFiles().length, 8);
assertEquals(resourcesPath().toFile().listFiles().length, 1);
assertFalse(testsPath().toFile().exists());
assertEquals(vocabularyPath().resolve("codesystem").toFile().listFiles().length, 2);
assertEquals(vocabularyPath().resolve("conceptmap").toFile().listFiles().length, 2);
assertEquals(vocabularyPath().resolve("valueset").toFile().listFiles().length, 4);
}
}
Binary file not shown.

0 comments on commit b2a82fc

Please sign in to comment.