diff --git a/README.md b/README.md index d0bfb4e..e45047f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Measure Repository -A prototype implementation of a [FHIR Measure Repository Service](http://hl7.org/fhir/us/cqfmeasures/measure-repository-service.html) and associated frontend application. The Measure Repository Service is a specific case of the more general [Artifact Repository Service](https://hl7.org/fhir/uv/crmi/artifact-repository-service.html#artifact-repository-service) that supports measures and libraries that exist in the CRMI Artifact Lifecycle as [CRMIShareableMeasure](https://hl7.org/fhir/uv/crmi/StructureDefinition-crmi-shareablemeasure.html) and [CRMIShareableLibrary](https://hl7.org/fhir/uv/crmi/StructureDefinition-crmi-shareablelibrary.html) artifacts. This repository is a monorepo that consists of: +A prototype implementation of a [FHIR Measure Repository Service](http://hl7.org/fhir/us/cqfmeasures/measure-repository-service.html) and associated frontend application. The Measure Repository Service is a specific case of the more general [Artifact Repository Service](https://hl7.org/fhir/uv/crmi/artifact-repository-service.html#artifact-repository-service) that supports measures and libraries that exist in the CRMI Artifact Lifecycle as artifacts implementing [CRMIShareableMeasure](https://hl7.org/fhir/uv/crmi/StructureDefinition-crmi-shareablemeasure.html)/[CRMIPublishableMeasure](https://hl7.org/fhir/uv/crmi/StructureDefinition-crmi-publishablemeasure.html) and [CRMIShareableLibrary](https://hl7.org/fhir/uv/crmi/StructureDefinition-crmi-shareablelibrary.html)/[CRMIPublishableLibrary](https://hl7.org/fhir/uv/crmi/StructureDefinition-crmi-publishablelibrary.html) . This repository is a monorepo that consists of: - [Measure Repository Service](https://github.com/projecttacoma/measure-repository/blob/main/service/README.md) - Implements portions of the [FHIR Measure Repository Service](http://hl7.org/fhir/us/cqfmeasures/measure-repository-service.html) specification diff --git a/app/src/pages/[resourceType]/[id].tsx b/app/src/pages/[resourceType]/[id].tsx index 9776dfd..50c8035 100644 --- a/app/src/pages/[resourceType]/[id].tsx +++ b/app/src/pages/[resourceType]/[id].tsx @@ -17,7 +17,7 @@ import { import { notifications } from '@mantine/notifications'; import React, { useEffect, useMemo, useState } from 'react'; import { GetServerSideProps, InferGetServerSidePropsType } from 'next'; -import { CRMIShareableLibrary, FhirArtifact } from '@/util/types/fhir'; +import { CRMIRepositoryLibrary, FhirArtifact } from '@/util/types/fhir'; import CQLRegex from '../../util/prismCQL'; import { Prism as PrismRenderer } from 'prism-react-renderer'; import parse from 'html-react-parser'; @@ -299,7 +299,7 @@ export default function ResourceIDPage({ jsonData }: InferGetServerSidePropsType */ function decode(link: string, jsonData: FhirArtifact) { if (jsonData.resourceType === 'Measure') return null; - const encodedLanguage = (jsonData as CRMIShareableLibrary).content?.find(e => e.contentType === link)?.data; + const encodedLanguage = (jsonData as CRMIRepositoryLibrary).content?.find(e => e.contentType === link)?.data; return encodedLanguage ? Buffer.from(encodedLanguage, 'base64').toString() : null; } diff --git a/app/src/server/trpc/routers/draft.ts b/app/src/server/trpc/routers/draft.ts index 63c9929..e18cff2 100644 --- a/app/src/server/trpc/routers/draft.ts +++ b/app/src/server/trpc/routers/draft.ts @@ -1,4 +1,4 @@ -import { CRMIShareableMeasure, FhirArtifact } from '@/util/types/fhir'; +import { CRMIRepositoryMeasure, FhirArtifact } from '@/util/types/fhir'; import { z } from 'zod'; import { publicProcedure, router } from '../trpc'; import { Bundle, OperationOutcome } from 'fhir/r4'; @@ -71,7 +71,7 @@ export const draftRouter = router({ resource.title = input.values.title; resource.description = input.values.description; if (input.resourceType === 'Measure') { - (resource as CRMIShareableMeasure).library = input.values.library; + (resource as CRMIRepositoryMeasure).library = input.values.library; } const res = await fetch(`${process.env.MRS_SERVER}/${input.resourceType}/${input.id}`, { method: 'PUT', diff --git a/app/src/server/trpc/routers/service.ts b/app/src/server/trpc/routers/service.ts index ed1f0bd..c699644 100644 --- a/app/src/server/trpc/routers/service.ts +++ b/app/src/server/trpc/routers/service.ts @@ -1,5 +1,5 @@ import { publicProcedure, router } from '../trpc'; -import { CRMIShareableLibrary, FhirArtifact } from '@/util/types/fhir'; +import { CRMIRepositoryLibrary, FhirArtifact } from '@/util/types/fhir'; import { z } from 'zod'; import { TRPCError } from '@trpc/server'; import { Bundle, OperationOutcome } from 'fhir/r4'; @@ -58,7 +58,7 @@ export const serviceRouter = router({ message: resource?.issue[0]?.details?.text }); } - return resource as CRMIShareableLibrary; + return resource as CRMIRepositoryLibrary; }), getArtifactById: publicProcedure diff --git a/app/src/util/authoringFixtures.ts b/app/src/util/authoringFixtures.ts index ab61095..98bf995 100644 --- a/app/src/util/authoringFixtures.ts +++ b/app/src/util/authoringFixtures.ts @@ -1,16 +1,17 @@ -import { CRMIShareableLibrary, CRMIShareableMeasure } from './types/fhir'; +import { CRMIRepositoryLibrary, CRMIRepositoryMeasure } from './types/fhir'; -export const MeasureSkeleton: CRMIShareableMeasure = { +export const MeasureSkeleton: CRMIRepositoryMeasure = { id: 'tempMeasureId', resourceType: 'Measure', status: 'draft', version: '0.0.1', url: 'http://example.com', title: 'Sample title', - description: 'Sample description' + description: 'Sample description', + date: '2025-01-01T00:00:00.000Z' }; -export const LibrarySkeleton: CRMIShareableLibrary = { +export const LibrarySkeleton: CRMIRepositoryLibrary = { id: 'tempLibraryId', resourceType: 'Library', status: 'draft', @@ -24,5 +25,6 @@ export const LibrarySkeleton: CRMIShareableLibrary = { }, url: 'http://example.com', title: 'Sample title', - description: 'Sample description' + description: 'Sample description', + date: '2025-01-01T00:00:00.000Z' }; diff --git a/app/src/util/types/fhir.ts b/app/src/util/types/fhir.ts index 94f74ad..d5ef31f 100644 --- a/app/src/util/types/fhir.ts +++ b/app/src/util/types/fhir.ts @@ -1,21 +1,25 @@ -export interface CRMIShareableMeasure extends fhir4.Measure { +// CRMIRepository* types implement both CRMIShareable and CRMIPublishable required fields +export interface CRMIRepositoryMeasure extends fhir4.Measure { id: string; url: string; version: string; title: string; description: string; + date: string; } -export interface CRMIShareableLibrary extends fhir4.Library { +export interface CRMIRepositoryLibrary extends fhir4.Library { id: string; url: string; version: string; title: string; description: string; + date: string; + type: fhir4.CodeableConcept; } // type representing the resource types that are relevant to the Measure Repository Service -export type FhirArtifact = CRMIShareableMeasure | CRMIShareableLibrary; +export type FhirArtifact = CRMIRepositoryMeasure | CRMIRepositoryLibrary; export type ArtifactResourceType = FhirArtifact['resourceType']; /** diff --git a/service/scripts/dbSetup.ts b/service/scripts/dbSetup.ts index b8f7c83..7bdb20e 100644 --- a/service/scripts/dbSetup.ts +++ b/service/scripts/dbSetup.ts @@ -5,7 +5,7 @@ import { MongoError } from 'mongodb'; import { v4 as uuidv4 } from 'uuid'; import path from 'path'; import { addIsOwnedExtension, addLibraryIsOwned } from '../src/util/baseUtils'; -import { CRMIShareableLibrary, FhirArtifact } from '../src/types/service-types'; +import { CRMIRepositoryLibrary, FhirArtifact } from '../src/types/service-types'; dotenv.config(); const DB_URL = process.env.DATABASE_URL || 'mongodb://localhost:27017/measure-repository'; @@ -351,10 +351,10 @@ export function modifyEntriesForUpload(entries: fhir4.BundleEntry('Library'); console.log(`Inserting Library/${fhirModelInfoLibrary.id} into database`); diff --git a/service/src/db/dbOperations.ts b/service/src/db/dbOperations.ts index 0c929a7..15a9143 100644 --- a/service/src/db/dbOperations.ts +++ b/service/src/db/dbOperations.ts @@ -1,7 +1,7 @@ import { loggers } from '@projecttacoma/node-fhir-server-core'; import { Filter, MongoServerError } from 'mongodb'; import { Connection } from './Connection'; -import { ArtifactResourceType, CRMIShareableLibrary, FhirArtifact } from '../types/service-types'; +import { ArtifactResourceType, CRMIRepositoryLibrary, FhirArtifact } from '../types/service-types'; import { BadRequestError } from '../util/errorUtils'; const logger = loggers.get('default'); @@ -78,8 +78,8 @@ export async function findResourceElementsWithQuery( // if the resourceType is Library, then we want to include type in the projection const projection: any = resourceType === 'Library' - ? { id: 1, status: 1, resourceType: 1, type: 1, url: 1, title: 1, description: 1, version: 1 } - : { id: 1, status: 1, resourceType: 1, url: 1, title: 1, description: 1, version: 1 }; + ? { id: 1, status: 1, resourceType: 1, type: 1, url: 1, title: 1, description: 1, version: 1, date: 1 } + : { id: 1, status: 1, resourceType: 1, url: 1, title: 1, description: 1, version: 1, date: 1 }; (query._elements as string[]).forEach(elem => { projection[elem] = 1; @@ -132,7 +132,7 @@ export async function findResourceCountWithQuery(query: Filter, resourceTyp /** * searches the database for the data requirements Library resource of the desired artifact and parameters */ -export async function findDataRequirementsWithQuery(query: Filter) { +export async function findDataRequirementsWithQuery(query: Filter) { const collection = Connection.db.collection('Library'); return collection.findOne({ _dataRequirements: query }, { projection: { _id: 0, _dataRequirements: 0, url: 0 } }); } diff --git a/service/src/services/LibraryService.ts b/service/src/services/LibraryService.ts index c3e7649..d8b7fb3 100644 --- a/service/src/services/LibraryService.ts +++ b/service/src/services/LibraryService.ts @@ -48,7 +48,7 @@ import { v4 as uuidv4 } from 'uuid'; import { Calculator } from 'fqm-execution'; const logger = loggers.get('default'); import { Filter } from 'mongodb'; -import { CRMIShareableLibrary, FhirLibraryWithDR } from '../types/service-types'; +import { CRMIRepositoryLibrary, FhirLibraryWithDR } from '../types/service-types'; import { createArtifactComment, getChildren, @@ -60,7 +60,7 @@ import { * Implementation of a service for the `Library` resource * The Service interface contains all possible functions */ -export class LibraryService implements Service { +export class LibraryService implements Service { /** * result of sending a GET request to {BASE_URL}/4_0_1/Library?{QUERY} * searches for all libraries that match the included query and returns a FHIR searchset Bundle @@ -80,13 +80,13 @@ export class LibraryService implements Service { (parsedQuery._count && parsedQuery._count === '0') ) { const count = await findResourceCountWithQuery(mongoQuery, 'Library'); - return createSummarySearchsetBundle(count); + return createSummarySearchsetBundle(count); } // if the _elements parameter with a comma-separated string is included // then return a searchset bundle that includes only those elements // on those resource entries else if (parsedQuery._elements) { - const result = await findResourceElementsWithQuery(mongoQuery, 'Library'); + const result = await findResourceElementsWithQuery(mongoQuery, 'Library'); // add the SUBSETTED tag to the resources returned by the _elements parameter result.data.map(e => { if (e.meta) { @@ -115,7 +115,7 @@ export class LibraryService implements Service { } return bundle; } else { - const result = await findResourcesWithQuery(mongoQuery, 'Library'); + const result = await findResourcesWithQuery(mongoQuery, 'Library'); const bundle = createSearchsetBundle(result.data); if (parsedQuery._count) { bundle.link = createPaginationLinks( @@ -138,7 +138,7 @@ export class LibraryService implements Service { */ async searchById(args: RequestArgs) { logger.info(`GET /Library/${args.id}`); - const result = await findResourceById(args.id, 'Library'); + const result = await findResourceById(args.id, 'Library'); if (!result) { throw new ResourceNotFoundError(`No resource found in collection: Library, with id: ${args.id}`); } @@ -178,7 +178,7 @@ export class LibraryService implements Service { if (resource.id !== args.id) { throw new BadRequestError('Argument id must match request body id for PUT request'); } - const oldResource = (await findResourceById(resource.id, resource.resourceType)) as CRMIShareableLibrary | null; + const oldResource = (await findResourceById(resource.id, resource.resourceType)) as CRMIRepositoryLibrary | null; // note: the distance between this database call and the update resource call, could cause a race condition if (oldResource) { checkFieldsForUpdate(resource, oldResource); @@ -213,7 +213,7 @@ export class LibraryService implements Service { * requires id parameter */ async remove(args: RequestArgs) { - const library = await findResourceById(args.id, 'Library'); + const library = await findResourceById(args.id, 'Library'); if (!library) { throw new ResourceNotFoundError(`No resource found in collection: Library, with id: ${args.id}`); } @@ -259,7 +259,7 @@ export class LibraryService implements Service { const parsedParams = parseRequestSchema({ ...params, ...query }, DraftArgs); - const activeLibrary = await findResourceById(parsedParams.id, 'Library'); + const activeLibrary = await findResourceById(parsedParams.id, 'Library'); if (!activeLibrary) { throw new ResourceNotFoundError(`No resource found in collection: Library, with id: ${args.id}`); } @@ -305,7 +305,7 @@ export class LibraryService implements Service { const parsedParams = parseRequestSchema({ ...params, ...query }, CloneArgs); - const library = await findResourceById(parsedParams.id, 'Library'); + const library = await findResourceById(parsedParams.id, 'Library'); if (!library) { throw new ResourceNotFoundError(`No resource found in collection: Library, with id: ${parsedParams.id}`); } @@ -353,7 +353,7 @@ export class LibraryService implements Service { const parsedParams = parseRequestSchema({ ...params, ...query }, ApproveArgs); - const library = await findResourceById(parsedParams.id, 'Library'); + const library = await findResourceById(parsedParams.id, 'Library'); if (!library) { throw new ResourceNotFoundError(`No resource found in collection: Library, with id: ${parsedParams.id}`); } @@ -429,7 +429,7 @@ export class LibraryService implements Service { const parsedParams = parseRequestSchema({ ...params, ...query }, ReviewArgs); - const library = await findResourceById(parsedParams.id, 'Library'); + const library = await findResourceById(parsedParams.id, 'Library'); if (!library) { throw new ResourceNotFoundError(`No resource found in collection: Library, with id: ${parsedParams.id}`); } @@ -502,7 +502,7 @@ export class LibraryService implements Service { const query = extractIdentificationForQuery(args, params); const parsedParams = parseRequestSchema({ ...params, ...query }, ReleaseArgs); - const library = await findResourceById(parsedParams.id, 'Library'); + const library = await findResourceById(parsedParams.id, 'Library'); if (!library) { throw new ResourceNotFoundError(`No resource found in collection: Library, with id: ${parsedParams.id}`); } diff --git a/service/src/services/MeasureService.ts b/service/src/services/MeasureService.ts index d523ad6..2c3df56 100644 --- a/service/src/services/MeasureService.ts +++ b/service/src/services/MeasureService.ts @@ -47,7 +47,7 @@ import { } from '../requestSchemas'; import { v4 as uuidv4 } from 'uuid'; import { Filter } from 'mongodb'; -import { CRMIShareableMeasure, FhirLibraryWithDR } from '../types/service-types'; +import { CRMIRepositoryMeasure, FhirLibraryWithDR } from '../types/service-types'; import { createArtifactComment, getChildren, @@ -61,7 +61,7 @@ const logger = loggers.get('default'); * Implementation of a service for the `Measure` resource * The Service interface contains all possible functions */ -export class MeasureService implements Service { +export class MeasureService implements Service { /** * result of sending a GET request to {BASE_URL}/4_0_1/Measure?{QUERY} * searches for all measures that match the included query and returns a FHIR searchset Bundle @@ -81,13 +81,13 @@ export class MeasureService implements Service { (parsedQuery._count && parsedQuery._count === '0') ) { const count = await findResourceCountWithQuery(mongoQuery, 'Measure'); - return createSummarySearchsetBundle(count); + return createSummarySearchsetBundle(count); } // if the _elements parameter with a comma-separated string is included // then return a searchset bundle that includes only those elements // on those resource entries else if (parsedQuery._elements) { - const result = await findResourceElementsWithQuery(mongoQuery, 'Measure'); + const result = await findResourceElementsWithQuery(mongoQuery, 'Measure'); // add the SUBSETTED tag to the resources returned by the _elements parameter result.data.map(e => { if (e.meta) { @@ -118,7 +118,7 @@ export class MeasureService implements Service { } return bundle; } else { - const result = await findResourcesWithQuery(mongoQuery, 'Measure'); + const result = await findResourcesWithQuery(mongoQuery, 'Measure'); const bundle = createSearchsetBundle(result.data); if (parsedQuery._count) { if (parsedQuery._count) { @@ -143,7 +143,7 @@ export class MeasureService implements Service { */ async searchById(args: RequestArgs) { logger.info(`GET /Measure/${args.id}`); - const result = await findResourceById(args.id, 'Measure'); + const result = await findResourceById(args.id, 'Measure'); if (!result) { throw new ResourceNotFoundError(`No resource found in collection: Measure, with id: ${args.id}`); } @@ -182,7 +182,7 @@ export class MeasureService implements Service { if (resource.id !== args.id) { throw new BadRequestError('Argument id must match request body id for PUT request'); } - const oldResource = (await findResourceById(resource.id, resource.resourceType)) as CRMIShareableMeasure | null; + const oldResource = (await findResourceById(resource.id, resource.resourceType)) as CRMIRepositoryMeasure | null; // note: the distance between this database call and the update resource call, could cause a race condition if (oldResource) { checkFieldsForUpdate(resource, oldResource); @@ -217,7 +217,7 @@ export class MeasureService implements Service { * requires id parameter */ async remove(args: RequestArgs) { - const measure = await findResourceById(args.id, 'Measure'); + const measure = await findResourceById(args.id, 'Measure'); if (!measure) { throw new ResourceNotFoundError(`No resource found in collection: Measure, with id: ${args.id}`); } @@ -263,7 +263,7 @@ export class MeasureService implements Service { const parsedParams = parseRequestSchema({ ...params, ...query }, DraftArgs); - const activeMeasure = await findResourceById(parsedParams.id, 'Measure'); + const activeMeasure = await findResourceById(parsedParams.id, 'Measure'); if (!activeMeasure) { throw new ResourceNotFoundError(`No resource found in collection: Measure, with id: ${args.id}`); } @@ -309,7 +309,7 @@ export class MeasureService implements Service { const parsedParams = parseRequestSchema({ ...params, ...query }, CloneArgs); - const measure = await findResourceById(parsedParams.id, 'Measure'); + const measure = await findResourceById(parsedParams.id, 'Measure'); if (!measure) { throw new ResourceNotFoundError(`No resource found in collection: Measure, with id: ${args.id}`); } @@ -357,7 +357,7 @@ export class MeasureService implements Service { const parsedParams = parseRequestSchema({ ...params, ...query }, ApproveArgs); - const measure = await findResourceById(parsedParams.id, 'Measure'); + const measure = await findResourceById(parsedParams.id, 'Measure'); if (!measure) { throw new ResourceNotFoundError(`No resource found in collection: Measure, with id: ${parsedParams.id}`); } @@ -433,7 +433,7 @@ export class MeasureService implements Service { const parsedParams = parseRequestSchema({ ...params, ...query }, ReviewArgs); - const measure = await findResourceById(parsedParams.id, 'Measure'); + const measure = await findResourceById(parsedParams.id, 'Measure'); if (!measure) { throw new ResourceNotFoundError(`No resource found in collection: Measure, with id: ${parsedParams.id}`); } @@ -506,7 +506,7 @@ export class MeasureService implements Service { const query = extractIdentificationForQuery(args, params); const parsedParams = parseRequestSchema({ ...params, ...query }, ReleaseArgs); - const measure = await findResourceById(parsedParams.id, 'Measure'); + const measure = await findResourceById(parsedParams.id, 'Measure'); if (!measure) { throw new ResourceNotFoundError(`No resource found in collection: Measure, with id: ${parsedParams.id}`); } diff --git a/service/src/types/service-types.ts b/service/src/types/service-types.ts index b5e5186..2eac7d2 100644 --- a/service/src/types/service-types.ts +++ b/service/src/types/service-types.ts @@ -1,25 +1,29 @@ import { Filter } from 'mongodb'; -export type FhirLibraryWithDR = CRMIShareableLibrary & { +export type FhirLibraryWithDR = CRMIRepositoryLibrary & { _dataRequirements?: Filter; }; -export interface CRMIShareableMeasure extends fhir4.Measure { +// CRMIRepository* types implement both CRMIShareable and CRMIPublishable required fields +export interface CRMIRepositoryMeasure extends fhir4.Measure { id: string; url: string; version: string; title: string; description: string; + date: string; } -export interface CRMIShareableLibrary extends fhir4.Library { +export interface CRMIRepositoryLibrary extends fhir4.Library { id: string; url: string; version: string; title: string; description: string; + date: string; + type: fhir4.CodeableConcept; } // type representing the resource types that are relevant to the Measure Repository Service -export type FhirArtifact = CRMIShareableMeasure | CRMIShareableLibrary; +export type FhirArtifact = CRMIRepositoryMeasure | CRMIRepositoryLibrary; export type ArtifactResourceType = FhirArtifact['resourceType']; diff --git a/service/src/util/bundleUtils.ts b/service/src/util/bundleUtils.ts index 2d363d3..f4f46bc 100644 --- a/service/src/util/bundleUtils.ts +++ b/service/src/util/bundleUtils.ts @@ -8,7 +8,7 @@ import { PackageArgs } from '../requestSchemas'; import fs from 'fs'; import { getMongoQueryFromRequest } from './queryUtils'; import { z } from 'zod'; -import { CRMIShareableLibrary, CRMIShareableMeasure, FhirArtifact } from '../types/service-types'; +import { CRMIRepositoryLibrary, CRMIRepositoryMeasure, FhirArtifact } from '../types/service-types'; const logger = loggers.get('default'); @@ -134,7 +134,7 @@ export async function createMeasurePackageBundle( params: z.infer ): Promise> { const mongoQuery = getMongoQueryFromRequest(query); - const measure = (await findResourcesWithQuery(mongoQuery, 'Measure')).data; + const measure = (await findResourcesWithQuery(mongoQuery, 'Measure')).data; if (!measure || !(measure.length > 0)) { throw new ResourceNotFoundError( `No resource found in collection: Measure, with ${Object.keys(query) @@ -156,7 +156,7 @@ export async function createMeasurePackageBundle( if (measureForPackaging.library && measureForPackaging.library.length > 0) { const [mainLibraryRef] = measureForPackaging.library; const mainLibQuery = getQueryFromReference(mainLibraryRef); - const libs = (await findResourcesWithQuery(mainLibQuery, 'Library')).data; + const libs = (await findResourcesWithQuery(mainLibQuery, 'Library')).data; if (!libs || libs.length < 1) { throw new ResourceNotFoundError( `Could not find Library ${mainLibraryRef} referenced by Measure ${measureForPackaging.id}` @@ -182,7 +182,7 @@ export async function createLibraryPackageBundle( params: z.infer ): Promise<{ libraryBundle: fhir4.Bundle; rootLibRef?: string }> { const mongoQuery = getMongoQueryFromRequest(query); - const library = (await findResourcesWithQuery(mongoQuery, 'Library')).data; + const library = (await findResourcesWithQuery(mongoQuery, 'Library')).data; if (!library || !(library.length > 0)) { throw new ResourceNotFoundError( `No resource found in collection: Library, with ${Object.keys(query) @@ -217,7 +217,7 @@ export async function createLibraryPackageBundle( * and returns a bundle of all the dependent libraries */ export async function createDepLibraryBundle( - mainLib: CRMIShareableLibrary, + mainLib: CRMIRepositoryLibrary, includeTerminology?: boolean ): Promise> { const allLibsDups = await getAllDependentLibraries(mainLib); @@ -252,7 +252,7 @@ export function getQueryFromReference(reference: string): Filter { } } -function hasNoDependencies(lib: CRMIShareableLibrary) { +function hasNoDependencies(lib: CRMIRepositoryLibrary) { return !lib.relatedArtifact || (Array.isArray(lib.relatedArtifact) && lib.relatedArtifact.length === 0); } @@ -260,7 +260,7 @@ function hasNoDependencies(lib: CRMIShareableLibrary) { * Resolves ValueSets listed in the relatedArtifact property of a library * Optionally uses a file-system cache to grab ValueSets that have been resolved previously */ -export async function getDependentValueSets(lib: CRMIShareableLibrary, useFileCache = true) { +export async function getDependentValueSets(lib: CRMIRepositoryLibrary, useFileCache = true) { if (hasNoDependencies(lib)) { return []; } @@ -337,7 +337,7 @@ export async function getDependentValueSets(lib: CRMIShareableLibrary, useFileCa /* * Updates the bundle entry array in-place to include any resolved ValueSets */ -async function addValueSetsToBundle(rootLibrary: CRMIShareableLibrary, currentBundle: fhir4.Bundle) { +async function addValueSetsToBundle(rootLibrary: CRMIRepositoryLibrary, currentBundle: fhir4.Bundle) { const valueSets = await getDependentValueSets(rootLibrary); currentBundle.entry?.push( @@ -350,7 +350,7 @@ async function addValueSetsToBundle(rootLibrary: CRMIShareableLibrary, currentBu /** * Iterate through relatedArtifact of library and return list of all dependent libraries used */ -export async function getAllDependentLibraries(lib: CRMIShareableLibrary): Promise { +export async function getAllDependentLibraries(lib: CRMIRepositoryLibrary): Promise { logger.debug(`Retrieving all dependent libraries for library: ${lib.id}`); const results = [lib]; @@ -366,7 +366,7 @@ export async function getAllDependentLibraries(lib: CRMIShareableLibrary): Promi // Obtain all libraries referenced in the related artifact, and recurse on their dependencies const libraryGets = depLibUrls.map(async url => { const libQuery = getQueryFromReference(url); - const libs = (await findResourcesWithQuery(libQuery, 'Library')).data; + const libs = (await findResourcesWithQuery(libQuery, 'Library')).data; if (!libs || libs.length < 1) { throw new ResourceNotFoundError( `Failed to find dependent library with ${ @@ -374,7 +374,7 @@ export async function getAllDependentLibraries(lib: CRMIShareableLibrary): Promi }${libQuery.version ? ` and version: ${libQuery.version}` : ''}` ); } - return getAllDependentLibraries(libs[0] as CRMIShareableLibrary); + return getAllDependentLibraries(libs[0] as CRMIRepositoryLibrary); }); const allDeps = await Promise.all(libraryGets); diff --git a/service/test/services/BaseService.test.ts b/service/test/services/BaseService.test.ts index 4fea8a4..2422b78 100644 --- a/service/test/services/BaseService.test.ts +++ b/service/test/services/BaseService.test.ts @@ -137,7 +137,8 @@ const LIBRARY_BASE = { type: { coding: [{ code: 'logic-library' }] }, version: '1', title: 'Sample title', - description: 'Sample description' + description: 'Sample description', + date: '2025-01-01T00:00:00.000Z' }; describe('BaseService', () => { diff --git a/service/test/services/LibraryService.test.ts b/service/test/services/LibraryService.test.ts index 637e54d..6214819 100644 --- a/service/test/services/LibraryService.test.ts +++ b/service/test/services/LibraryService.test.ts @@ -3,7 +3,7 @@ import { serverConfig } from '../../src/config/serverConfig'; import { cleanUpTestDatabase, setupTestDatabase, createTestResource, removeTestResource } from '../utils'; import supertest from 'supertest'; import { Calculator } from 'fqm-execution'; -import { CRMIShareableLibrary } from '../../src/types/service-types'; +import { CRMIRepositoryLibrary } from '../../src/types/service-types'; let server: Server; @@ -11,10 +11,11 @@ const LIBRARY_BASE = { type: { coding: [{ code: 'logic-library' }] }, version: '1', title: 'Sample title', - description: 'Sample description' + description: 'Sample description', + date: '2025-01-01T00:00:00.000Z' }; -const ACTIVE_LIBRARY: CRMIShareableLibrary = { +const ACTIVE_LIBRARY: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'testActiveLibrary', url: 'http://example.com/testActiveLibrary', @@ -23,7 +24,7 @@ const ACTIVE_LIBRARY: CRMIShareableLibrary = { ...LIBRARY_BASE }; -const ACTIVE_LIBRARY_2: CRMIShareableLibrary = { +const ACTIVE_LIBRARY_2: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'testActiveLibrary2', url: 'http://example.com/testActiveLibrary2', @@ -32,7 +33,7 @@ const ACTIVE_LIBRARY_2: CRMIShareableLibrary = { ...LIBRARY_BASE }; -const ACTIVE_LIBRARY_NO_NAME: CRMIShareableLibrary = { +const ACTIVE_LIBRARY_NO_NAME: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'testActiveLibrary', url: 'http://example.com/testActiveLibrary', @@ -48,7 +49,7 @@ const ACTIVE_LIBRARY_NO_NAME: CRMIShareableLibrary = { ...LIBRARY_BASE }; -const NEW_ACTIVE_LIBRARY: CRMIShareableLibrary = { +const NEW_ACTIVE_LIBRARY: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'newTestActiveLibrary', url: 'http://example.com/newTestActiveLibrary', @@ -56,7 +57,7 @@ const NEW_ACTIVE_LIBRARY: CRMIShareableLibrary = { ...LIBRARY_BASE }; -const DRAFT_LIBRARY: CRMIShareableLibrary = { +const DRAFT_LIBRARY: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'testDraftLibrary', url: 'http://example.com/testDraftLibrary', @@ -64,7 +65,7 @@ const DRAFT_LIBRARY: CRMIShareableLibrary = { ...LIBRARY_BASE }; -const DRAFT_LIBRARY_2: CRMIShareableLibrary = { +const DRAFT_LIBRARY_2: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'testDraftLibrary2', url: 'http://example.com/testDraftLibrary2', @@ -72,7 +73,7 @@ const DRAFT_LIBRARY_2: CRMIShareableLibrary = { ...LIBRARY_BASE }; -const LIBRARY_WITH_IDENTIFIER_VALUE: CRMIShareableLibrary = { +const LIBRARY_WITH_IDENTIFIER_VALUE: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'libraryWithIdentifierValue', url: 'http://example.com/libraryWithIdentifierValue', @@ -81,7 +82,7 @@ const LIBRARY_WITH_IDENTIFIER_VALUE: CRMIShareableLibrary = { ...LIBRARY_BASE }; -const LIBRARY_WITH_IDENTIFIER_SYSTEM: CRMIShareableLibrary = { +const LIBRARY_WITH_IDENTIFIER_SYSTEM: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'libraryWithIdentifierSystem', url: 'http://example.com/libraryWithIdentifierSystem', @@ -90,7 +91,7 @@ const LIBRARY_WITH_IDENTIFIER_SYSTEM: CRMIShareableLibrary = { ...LIBRARY_BASE }; -const LIBRARY_WITH_IDENTIFIER_SYSTEM_AND_VALUE: CRMIShareableLibrary = { +const LIBRARY_WITH_IDENTIFIER_SYSTEM_AND_VALUE: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'libraryWithIdentifierSystemAndValue', url: 'http://example.com/libraryWithIdentifierSystemAndValue', @@ -101,7 +102,7 @@ const LIBRARY_WITH_IDENTIFIER_SYSTEM_AND_VALUE: CRMIShareableLibrary = { ...LIBRARY_BASE }; -const LIBRARY_WITH_DEPS: CRMIShareableLibrary = { +const LIBRARY_WITH_DEPS: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'testActiveLibraryWithDeps', url: 'http://example.com/testActiveLibraryWithDeps', @@ -115,7 +116,7 @@ const LIBRARY_WITH_DEPS: CRMIShareableLibrary = { ...LIBRARY_BASE }; -const LIBRARY_WITH_NESTED_DEPS: CRMIShareableLibrary = { +const LIBRARY_WITH_NESTED_DEPS: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'testActiveLibraryWithDeps2', url: 'http://example.com/testActiveLibraryWithDeps2', @@ -124,6 +125,7 @@ const LIBRARY_WITH_NESTED_DEPS: CRMIShareableLibrary = { type: { coding: [{ code: 'logic-library' }] }, title: 'Sample title', description: 'Sample description', + date: '2025-01-01T00:00:00.000Z', relatedArtifact: [ { type: 'depends-on', @@ -132,7 +134,7 @@ const LIBRARY_WITH_NESTED_DEPS: CRMIShareableLibrary = { ] }; -const LIBRARY_WITH_SAME_SYSTEM: CRMIShareableLibrary = { +const LIBRARY_WITH_SAME_SYSTEM: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'libraryWithSameSystem', url: 'http://example.com/libraryWithSameSystem', @@ -141,7 +143,7 @@ const LIBRARY_WITH_SAME_SYSTEM: CRMIShareableLibrary = { ...LIBRARY_BASE }; -const LIBRARY_WITH_SAME_SYSTEM2: CRMIShareableLibrary = { +const LIBRARY_WITH_SAME_SYSTEM2: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'libraryWithSameSystem2', url: 'http://example.com/libraryWithSameSystem2', @@ -150,7 +152,7 @@ const LIBRARY_WITH_SAME_SYSTEM2: CRMIShareableLibrary = { ...LIBRARY_BASE }; -const PARENT_ACTIVE_LIBRARY: CRMIShareableLibrary = { +const PARENT_ACTIVE_LIBRARY: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'parentLibrary', url: 'http://parent-library.com', @@ -170,7 +172,7 @@ const PARENT_ACTIVE_LIBRARY: CRMIShareableLibrary = { ...LIBRARY_BASE }; -const CHILD_ACTIVE_LIBRARY: CRMIShareableLibrary = { +const CHILD_ACTIVE_LIBRARY: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'childLibrary', url: 'http://child-library.com', @@ -1610,7 +1612,8 @@ describe('LibraryService', () => { type: { coding: [{ code: 'logic-library' }] }, version: 'collision', //collision version title: 'Sample title', - description: 'Sample description' + description: 'Sample description', + date: '2025-01-01T00:00:00.000Z' }, 'Library' ); diff --git a/service/test/services/MeasureService.test.ts b/service/test/services/MeasureService.test.ts index ab035af..578ba91 100644 --- a/service/test/services/MeasureService.test.ts +++ b/service/test/services/MeasureService.test.ts @@ -3,7 +3,7 @@ import { serverConfig } from '../../src/config/serverConfig'; import { cleanUpTestDatabase, createTestResource, removeTestResource, setupTestDatabase } from '../utils'; import supertest from 'supertest'; import { Calculator } from 'fqm-execution'; -import { CRMIShareableLibrary, CRMIShareableMeasure } from '../../src/types/service-types'; +import { CRMIRepositoryLibrary, CRMIRepositoryMeasure } from '../../src/types/service-types'; let server: Server; // boiler plate required fields @@ -11,16 +11,18 @@ const LIBRARY_BASE = { type: { coding: [{ code: 'logic-library' }] }, version: '1', title: 'Sample title', - description: 'Sample description' + description: 'Sample description', + date: '2025-01-01T00:00:00.000Z' }; const MEASURE_BASE = { version: '1', title: 'Sample title', - description: 'Sample description' + description: 'Sample description', + date: '2025-01-01T00:00:00.000Z' }; -const ACTIVE_MEASURE: CRMIShareableMeasure = { +const ACTIVE_MEASURE: CRMIRepositoryMeasure = { resourceType: 'Measure', id: 'testActiveMeasure', url: 'http://example.com/testActiveMeasure', @@ -28,7 +30,7 @@ const ACTIVE_MEASURE: CRMIShareableMeasure = { ...MEASURE_BASE }; -const EXTRA_ACTIVE_MEASURE: CRMIShareableMeasure = { +const EXTRA_ACTIVE_MEASURE: CRMIRepositoryMeasure = { resourceType: 'Measure', id: 'testExtraActiveMeasure', url: 'http://example.com/testExtraActiveMeasure', @@ -36,7 +38,7 @@ const EXTRA_ACTIVE_MEASURE: CRMIShareableMeasure = { ...MEASURE_BASE }; -const ACTIVE_MEASURE_2: CRMIShareableMeasure = { +const ACTIVE_MEASURE_2: CRMIRepositoryMeasure = { resourceType: 'Measure', id: 'testActiveMeasure2', url: 'http://example.com/testActiveMeasure2', @@ -44,7 +46,7 @@ const ACTIVE_MEASURE_2: CRMIShareableMeasure = { ...MEASURE_BASE }; -const ACTIVE_MEASURE_NO_NAME: CRMIShareableMeasure = { +const ACTIVE_MEASURE_NO_NAME: CRMIRepositoryMeasure = { resourceType: 'Measure', id: 'testActiveMeasure', url: 'http://example.com/testActiveMeasure', @@ -60,7 +62,7 @@ const ACTIVE_MEASURE_NO_NAME: CRMIShareableMeasure = { ...MEASURE_BASE }; -const NEW_ACTIVE_MEASURE: CRMIShareableMeasure = { +const NEW_ACTIVE_MEASURE: CRMIRepositoryMeasure = { resourceType: 'Measure', id: 'newTestActiveMeasure', url: 'http://example.com/newTestActiveMeasure', @@ -68,7 +70,7 @@ const NEW_ACTIVE_MEASURE: CRMIShareableMeasure = { ...MEASURE_BASE }; -const DRAFT_MEASURE: CRMIShareableMeasure = { +const DRAFT_MEASURE: CRMIRepositoryMeasure = { resourceType: 'Measure', id: 'testDraftMeasure', url: 'http://example.com/testDraftMeasure', @@ -76,7 +78,7 @@ const DRAFT_MEASURE: CRMIShareableMeasure = { ...MEASURE_BASE }; -const MEASURE_WITH_IDENTIFIER_VALUE_ROOT_LIB: CRMIShareableMeasure = { +const MEASURE_WITH_IDENTIFIER_VALUE_ROOT_LIB: CRMIRepositoryMeasure = { resourceType: 'Measure', id: 'measureWithIdentifierValueRootLib', url: 'http://example.com/measureWithIdentifierValueRootLib', @@ -86,7 +88,7 @@ const MEASURE_WITH_IDENTIFIER_VALUE_ROOT_LIB: CRMIShareableMeasure = { ...MEASURE_BASE }; -const MEASURE_WITH_IDENTIFIER_SYSTEM_ROOT_LIB: CRMIShareableMeasure = { +const MEASURE_WITH_IDENTIFIER_SYSTEM_ROOT_LIB: CRMIRepositoryMeasure = { resourceType: 'Measure', id: 'measureWithIdentifierSystemRootLib', url: 'http://example.com/measureWithIdentifierSystemRootLib', @@ -96,7 +98,7 @@ const MEASURE_WITH_IDENTIFIER_SYSTEM_ROOT_LIB: CRMIShareableMeasure = { ...MEASURE_BASE }; -const MEASURE_WITH_IDENTIFIER_SYSTEM_AND_VALUE_ROOT_LIB: CRMIShareableMeasure = { +const MEASURE_WITH_IDENTIFIER_SYSTEM_AND_VALUE_ROOT_LIB: CRMIRepositoryMeasure = { resourceType: 'Measure', id: 'measureWithIdentifierSystemAndValueRootLib', url: 'http://example.com/measureWithIdentifierSystemAndValueRootLib', @@ -111,7 +113,7 @@ const MEASURE_WITH_IDENTIFIER_SYSTEM_AND_VALUE_ROOT_LIB: CRMIShareableMeasure = ...MEASURE_BASE }; -const MEASURE_WITH_ROOT_LIB: CRMIShareableMeasure = { +const MEASURE_WITH_ROOT_LIB: CRMIRepositoryMeasure = { resourceType: 'Measure', id: 'testMeasureWithRootLib', url: 'http://example.com/testMeasureWithRootLib', @@ -120,7 +122,7 @@ const MEASURE_WITH_ROOT_LIB: CRMIShareableMeasure = { ...MEASURE_BASE }; -const MEASURE_WITH_ROOT_LIB_AND_DEPS: CRMIShareableMeasure = { +const MEASURE_WITH_ROOT_LIB_AND_DEPS: CRMIRepositoryMeasure = { resourceType: 'Measure', id: 'testMeasureWithRootLibAndDeps', url: 'http://example.com/testMeasureWithRootLibAndDeps', @@ -129,7 +131,7 @@ const MEASURE_WITH_ROOT_LIB_AND_DEPS: CRMIShareableMeasure = { ...MEASURE_BASE }; -const ACTIVE_LIBRARY: CRMIShareableLibrary = { +const ACTIVE_LIBRARY: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'testActiveLibraryWithNoDeps', url: 'http://example.com/testActiveLibraryWithNoDeps', @@ -137,7 +139,7 @@ const ACTIVE_LIBRARY: CRMIShareableLibrary = { ...LIBRARY_BASE }; -const ACTIVE_LIBRARY_WITH_DEPS: CRMIShareableLibrary = { +const ACTIVE_LIBRARY_WITH_DEPS: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'testActiveLibraryWithDeps', url: 'http://example.com/testActiveLibraryWithDeps', @@ -151,7 +153,7 @@ const ACTIVE_LIBRARY_WITH_DEPS: CRMIShareableLibrary = { ...LIBRARY_BASE }; -const PARENT_ACTIVE_MEASURE: CRMIShareableMeasure = { +const PARENT_ACTIVE_MEASURE: CRMIRepositoryMeasure = { resourceType: 'Measure', status: 'active', id: 'parentMeasure', @@ -170,10 +172,11 @@ const PARENT_ACTIVE_MEASURE: CRMIShareableMeasure = { url: 'http://parent-measure.com', version: '1', description: 'Example description', - title: 'Parent Active Measure' + title: 'Parent Active Measure', + date: '2025-01-01T00:00:00.000Z' }; -const CHILD_ACTIVE_LIBRARY: CRMIShareableLibrary = { +const CHILD_ACTIVE_LIBRARY: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'childLibrary', type: { coding: [{ code: 'logic-library' }] }, @@ -187,7 +190,8 @@ const CHILD_ACTIVE_LIBRARY: CRMIShareableLibrary = { version: '1', url: 'http://child-library.com', description: 'Example description', - title: 'Child Active Library' + title: 'Child Active Library', + date: '2025-01-01T00:00:00.000Z' }; describe('MeasureService', () => { @@ -284,7 +288,7 @@ describe('MeasureService', () => { .then(response => { expect(response.body.resourceType).toEqual('Bundle'); expect(response.body.total).toEqual(1); - expect(response.body.entry[0].resource).toEqual(ACTIVE_MEASURE_NO_NAME); + expect(response.body.entry[0].resource).toEqual(ACTIVE_MEASURE_NO_NAME);// }); }); @@ -1158,7 +1162,8 @@ describe('MeasureService', () => { ], version: '1', description: 'Example description', - title: 'Parent Active Measure' + title: 'Parent Active Measure', + date: '2025-01-01T00:00:00.000Z' }, 'Measure' ); @@ -1355,7 +1360,8 @@ describe('MeasureService', () => { ], version: '1', description: 'Example description', - title: 'Parent Active Measure' + title: 'Parent Active Measure', + date: '2025-01-01T00:00:00.000Z' }, 'Measure' ); @@ -1716,7 +1722,8 @@ describe('MeasureService', () => { status: 'draft', version: 'collision', //collision version title: 'Sample title', - description: 'Sample description' + description: 'Sample description', + date: '2025-01-01T00:00:00.000Z' }, 'Measure' ); diff --git a/service/test/util/bundleUtils.test.ts b/service/test/util/bundleUtils.test.ts index 9c4df63..2d6a86f 100644 --- a/service/test/util/bundleUtils.test.ts +++ b/service/test/util/bundleUtils.test.ts @@ -8,19 +8,21 @@ import { getQueryFromReference } from '../../src/util/bundleUtils'; import { cleanUpTestDatabase, setupTestDatabase } from '../utils'; -import { CRMIShareableLibrary, CRMIShareableMeasure } from '../../src/types/service-types'; +import { CRMIRepositoryLibrary, CRMIRepositoryMeasure } from '../../src/types/service-types'; const LIBRARY_BASE = { type: { coding: [{ code: 'logic-library' }] }, version: '1', title: 'Sample title', - description: 'Sample description' + description: 'Sample description', + date: '2025-01-01T00:00:00.000Z' }; const MEASURE_BASE = { version: '1', title: 'Sample title', - description: 'Sample description' + description: 'Sample description', + date: '2025-01-01T00:00:00.000Z' }; const MOCK_VS_1: fhir4.ValueSet = { @@ -41,7 +43,7 @@ const MOCK_VS_3: fhir4.ValueSet = { url: 'http://example.com/ValueSet/4' }; -const LIB_WITH_NO_DEPS: CRMIShareableLibrary = { +const LIB_WITH_NO_DEPS: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'LibWithNoDeps', url: 'http://example.com/LibraryWithNoDeps', @@ -49,7 +51,7 @@ const LIB_WITH_NO_DEPS: CRMIShareableLibrary = { ...LIBRARY_BASE }; -const LIB_WITH_DEPS: CRMIShareableLibrary = { +const LIB_WITH_DEPS: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'LibraryWithDeps', url: 'http://example.com/LibraryWithDeps', @@ -71,10 +73,11 @@ const LIB_WITH_DEPS: CRMIShareableLibrary = { } ], title: 'Sample title', - description: 'Sample description' + description: 'Sample description', + date: '2025-01-01T00:00:00.000Z' }; -const LIB_WITH_VALUESET: CRMIShareableLibrary = { +const LIB_WITH_VALUESET: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'LibraryWithValueSet', url: 'http://example.com/LibraryWithVS', @@ -96,7 +99,7 @@ const LIB_WITH_VALUESET: CRMIShareableLibrary = { ...LIBRARY_BASE }; -const LIB_WITH_EXTRA_VALUESET: CRMIShareableLibrary = { +const LIB_WITH_EXTRA_VALUESET: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'LibraryWithExtraValueSet', url: 'http://example.com/LibraryWithExtraVS', @@ -110,7 +113,7 @@ const LIB_WITH_EXTRA_VALUESET: CRMIShareableLibrary = { ...LIBRARY_BASE }; -const LIB_WITH_MISSING_DEPS: CRMIShareableLibrary = { +const LIB_WITH_MISSING_DEPS: CRMIRepositoryLibrary = { resourceType: 'Library', id: 'LibraryWithMissingDeps', url: 'http://example.com/LibraryWithMissingDeps', @@ -124,7 +127,7 @@ const LIB_WITH_MISSING_DEPS: CRMIShareableLibrary = { ...LIBRARY_BASE }; -const MEASURE_WITH_MISSING_LIBRARY: CRMIShareableMeasure = { +const MEASURE_WITH_MISSING_LIBRARY: CRMIRepositoryMeasure = { resourceType: 'Measure', id: 'MeasureMissingLib', url: 'http://example.com/MeasureMissingLib', @@ -133,7 +136,7 @@ const MEASURE_WITH_MISSING_LIBRARY: CRMIShareableMeasure = { ...MEASURE_BASE }; -const MEASURE_WITH_NO_LIBRARY: CRMIShareableMeasure = { +const MEASURE_WITH_NO_LIBRARY: CRMIRepositoryMeasure = { resourceType: 'Measure', id: 'MeasureNoLib', url: 'http://example.com/MeasureNoLib', @@ -142,7 +145,7 @@ const MEASURE_WITH_NO_LIBRARY: CRMIShareableMeasure = { ...MEASURE_BASE }; -const MEASURE_WITH_LIBRARY: CRMIShareableMeasure = { +const MEASURE_WITH_LIBRARY: CRMIRepositoryMeasure = { resourceType: 'Measure', id: 'MeasureWithLib', url: 'http://example.com/MeasureWithLib', diff --git a/service/test/util/serviceUtils.test.ts b/service/test/util/serviceUtils.test.ts index 9b9f1f4..c3b63a3 100644 --- a/service/test/util/serviceUtils.test.ts +++ b/service/test/util/serviceUtils.test.ts @@ -1,4 +1,4 @@ -import { CRMIShareableLibrary } from '../../src/types/service-types'; +import { CRMIRepositoryLibrary } from '../../src/types/service-types'; import { cleanUpTestDatabase, setupTestDatabase } from '../utils'; import { getChildren, modifyResourcesForDraft } from '../../src/util/serviceUtils'; @@ -15,7 +15,7 @@ const PARENT_RELATED_ARTIFACTS: fhir4.RelatedArtifact[] = [ } ]; -const CHILD_LIBRARY_1: CRMIShareableLibrary = { +const CHILD_LIBRARY_1: CRMIRepositoryLibrary = { resourceType: 'Library', status: 'active', type: { coding: [{ code: 'logic-library' }] }, @@ -30,6 +30,7 @@ const CHILD_LIBRARY_1: CRMIShareableLibrary = { version: '1', title: 'Child Library 1', description: 'Child Library 1 description', + date: '2025-01-01T00:00:00.000Z', relatedArtifact: [ { type: 'composed-of', @@ -44,7 +45,7 @@ const CHILD_LIBRARY_1: CRMIShareableLibrary = { ] }; -const CHILD_LIBRARY_2: CRMIShareableLibrary = { +const CHILD_LIBRARY_2: CRMIRepositoryLibrary = { resourceType: 'Library', status: 'active', type: { coding: [{ code: 'logic-library' }] }, @@ -58,7 +59,8 @@ const CHILD_LIBRARY_2: CRMIShareableLibrary = { url: 'http://child-library-2.com', version: '1', title: 'Child Library 2', - description: 'Child Library 2 description' + description: 'Child Library 2 description', + date: '2025-01-01T00:00:00.000Z' }; describe('serviceUtils', () => {