Skip to content

Commit

Permalink
Load automatic dependencies for FHIR R6 versions
Browse files Browse the repository at this point in the history
R6 prerelease versions of FHIR are available, but R6 versions of the
terminology and extension packages are not yet available. Load the R5
versions of this packages when an R6 version of FHIR is used.
  • Loading branch information
mint-thompson committed Nov 1, 2024
1 parent d83c0df commit 3871a90
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/Processing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const AUTOMATIC_DEPENDENCIES: AutomaticDependency[] = [
{
packageId: 'hl7.terminology.r5',
version: 'latest',
fhirVersions: ['R5']
fhirVersions: ['R5', 'R6']
},
{
packageId: 'hl7.fhir.uv.extensions.r4',
Expand All @@ -80,7 +80,7 @@ export const AUTOMATIC_DEPENDENCIES: AutomaticDependency[] = [
{
packageId: 'hl7.fhir.uv.extensions.r5',
version: 'latest',
fhirVersions: ['R5']
fhirVersions: ['R5', 'R6']
}
];

Expand Down
27 changes: 27 additions & 0 deletions test/utils/Processing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1339,6 +1339,19 @@ describe('Processing', () => {
});
});

it('should load each automatic dependency for FHIR R6 prerelease', () => {
const config = cloneDeep(minimalConfig);
config.dependencies = [{ packageId: 'hl7.fhir.us.core', version: '3.1.0' }];
const defs = new FHIRDefinitions();
return loadAutomaticDependencies('6.0.0-ballot2', config.dependencies, defs).then(() => {
expect(loadedPackages).toHaveLength(3);
expect(loadedPackages).toContain('hl7.fhir.uv.tools#current');
expect(loadedPackages).toContain('hl7.terminology.r5#1.2.3-test');
expect(loadedPackages).toContain('hl7.fhir.uv.extensions.r5#4.5.6-test');
expect(loggerSpy.getAllMessages('warn')).toHaveLength(0);
});
});

it('should should use the package server query to get the terminology version', () => {
// Change the version to 2.4.6-test just to be sure
nock.removeInterceptor(termR4NockScope);
Expand Down Expand Up @@ -1552,6 +1565,20 @@ describe('Processing', () => {
});
});

it('should load each automatic dependency for FHIR R6 prerelease from a custom registry', () => {
process.env.FPL_REGISTRY = 'https://custom-registry.example.org';
const config = cloneDeep(minimalConfig);
config.dependencies = [{ packageId: 'hl7.fhir.us.core', version: '3.1.0' }];
const defs = new FHIRDefinitions();
return loadAutomaticDependencies('6.0.0-ballot2', config.dependencies, defs).then(() => {
expect(loadedPackages).toHaveLength(3);
expect(loadedPackages).toContain('hl7.fhir.uv.tools#current');
expect(loadedPackages).toContain('hl7.terminology.r5#1.2.3-test');
expect(loadedPackages).toContain('hl7.fhir.uv.extensions.r5#4.5.6-test');
expect(loggerSpy.getAllMessages('warn')).toHaveLength(0);
});
});

it('should should use the package server query to get the terminology version', () => {
process.env.FPL_REGISTRY = 'https://custom-registry.example.org';
// Change the version to 2.4.6-test just to be sure
Expand Down

0 comments on commit 3871a90

Please sign in to comment.