Skip to content

Commit 722cb39

Browse files
test: Use Loinc Terminology Service (#92)
* loinc term * create core terminology service * update action yaml to use secret * only validate once * revert to false * update expected nuymber of validation errors * update expected number of validation errors
1 parent d238620 commit 722cb39

File tree

2 files changed

+35
-10
lines changed

2 files changed

+35
-10
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
concurrency:
1313
group: ${{ github.workflow }}-${{ github.ref }}
1414
cancel-in-progress: true
15-
15+
1616
jobs:
1717
unit-test-dotnet-fhir-converter-api:
1818
runs-on: ubuntu-latest
@@ -61,6 +61,8 @@ jobs:
6161
dotnet-version: "8.0.x"
6262
- name: Run tests
6363
run: dotnet test --filter FullyQualifiedName~Converter.FunctionalTests --logger "console;verbosity=detailed"
64+
env:
65+
VALIDATE_FHIR: false
6466

6567
unit-test-dotnet-fhir-converter-tool:
6668
runs-on: ubuntu-latest
@@ -84,4 +86,7 @@ jobs:
8486
with:
8587
dotnet-version: "8.0.x"
8688
- name: Run tests
87-
run: VALIDATE_FHIR=true dotnet test --filter FullyQualifiedName~Converter.FunctionalTests.ConvertDataTemplateDirectoryProviderFunctionalTests.GivenEcrDocument_WhenConverting_ExpectedFhirResourceShouldBeValid --logger "console;verbosity=detailed"
89+
run: dotnet test --filter FullyQualifiedName~Converter.FunctionalTests.ConvertDataTemplateDirectoryProviderFunctionalTests.GivenEcrDocument_WhenConverting_ExpectedFhirResourceShouldBeValid --logger "console;verbosity=detailed"
90+
env:
91+
VALIDATE_FHIR: true
92+
LOINC_AUTH: ${{ secrets.LOINC_AUTH }}

src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/BaseConvertDataFunctionalTests.cs

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,9 @@ public static IEnumerable<object[]> GetDataForEcr()
241241
// ]
242242
new[] { @"EICR", @"eCR_full.xml", @"eCR_full-expected.json", "validation", "9" },
243243
new[] { @"EICR", @"eCR_RR_combined_3_1.xml", @"eCR_RR_combined_3_1-expected.json", "validation", "13" },
244-
new[] { @"EICR", @"eCR_EveEverywoman.xml", @"eCR_EveEverywoman-expected.json", "validation", "51" },
244+
new[] { @"EICR", @"eCR_EveEverywoman.xml", @"eCR_EveEverywoman-expected.json", "validation", "37" },
245245
new[] { @"EICR", @"eicr04152020.xml", @"eicr04152020-expected.json", "validation", "19" },
246-
new[] { @"EICR", @"CDAR2_IG_PHCASERPT_R2_D2_SAMPLE.xml", @"CDAR2_IG_PHCASERPT_R2_D2_SAMPLE-expected.json", "validation", "25" },
246+
new[] { @"EICR", @"CDAR2_IG_PHCASERPT_R2_D2_SAMPLE.xml", @"CDAR2_IG_PHCASERPT_R2_D2_SAMPLE-expected.json", "validation", "21" },
247247
};
248248
return data.Select(item => new[]
249249
{
@@ -398,6 +398,9 @@ protected void ConvertCCDAMessageAndValidateExpectedResponse(ITemplateProvider t
398398

399399
protected void ValidateConvertCCDAMessageIsValidFHIR(ITemplateProvider templateProvider, string rootTemplate, string inputFile, string validationFailureStep, int numFailures)
400400
{
401+
System.Console.Out.WriteLine("#####################################################################################################");
402+
System.Console.Out.WriteLine(inputFile);
403+
System.Console.Out.WriteLine("-----------------------------------------------------------------------------------------------------");
401404
var validateFhir = Environment.GetEnvironmentVariable("VALIDATE_FHIR") ?? "false";
402405
if (validateFhir.Trim() == "false") return;
403406

@@ -420,17 +423,34 @@ protected void ValidateConvertCCDAMessageIsValidFHIR(ITemplateProvider templateP
420423
actualContent,
421424
serializerOptions
422425
);
423-
var packageSource = new FhirPackageSource(
426+
var ecrSource = new FhirPackageSource(
424427
ModelInfo.ModelInspector,
425428
"https://packages2.fhir.org/packages",
426-
new string[] {
427-
"hl7.fhir.us.ecr@2.1.2",
428-
}
429+
new string[] { "hl7.fhir.us.ecr@2.1.2", }
429430
);
430-
var profileSource = new CachedResolver(packageSource);
431+
var coreSource = FhirPackageSource.CreateCorePackageSource(
432+
ModelInfo.ModelInspector,
433+
FhirRelease.R4,
434+
"https://packages2.fhir.org/packages"
435+
);
436+
437+
var profileSource = new CachedResolver(ecrSource);
438+
var loincClient = new FhirClient("https://fhir.loinc.org");
439+
loincClient.RequestHeaders.Authorization =
440+
new System.Net.Http.Headers.AuthenticationHeaderValue(
441+
"Basic",
442+
"am55Z2FhcmQ6M1hTQCFld2NBQWVMc1pN"
443+
);
444+
var loincTerminologyService = new ExternalTerminologyService(loincClient);
431445
var terminologyService = new LocalTerminologyService(profileSource);
446+
var baseTermSer = LocalTerminologyService.CreateDefaultForCore(coreSource);
447+
var mulTermSer = new MultiTerminologyService(
448+
terminologyService,
449+
baseTermSer,
450+
loincTerminologyService
451+
);
432452

433-
var validator = new Validator(profileSource, terminologyService);
453+
var validator = new Validator(profileSource, mulTermSer);
434454
var result = validator.Validate(poco);
435455
var outcomeText = result.ToString();
436456
var numFailed = result.Issue.Count();

0 commit comments

Comments
 (0)