Skip to content

Commit

Permalink
Update dates according to review spec
Browse files Browse the repository at this point in the history
  • Loading branch information
lmd59 committed May 9, 2024
1 parent cfe2ba5 commit d4bbd58
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ The measure repository app supports the withdraw operation by allowing the abili

### Review

The measure repository app supports the review operation by adding artifact comments to an existing draft artifact. The artifact comment is currently added to a draft artifact as a [CQFM Artifact Comment Extension]("http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-artifactComment"). This extension requires a type ("Documentation", "Review", "Guidance") which can be specified in the dropdown. Optionally, the extension can include an authoredOn date and the name of the user who endorsed the comment. The review operation is more formally defined in the [CRMI Review Operation Definition](https://build.fhir.org/ig/HL7/crmi-ig/OperationDefinition-crmi-review.html); however, creation of ArtifactAssessment resources in the repository is not yet supported.
The measure repository app supports the review operation by adding artifact comments to an existing draft artifact and updating the artifact's `date` and `lastReviewDate` fields. The artifact comment is currently added to a draft artifact as a [CQFM Artifact Comment Extension]("http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-artifactComment"). This extension requires a type ("Documentation", "Review", "Guidance") which can be specified in the dropdown. Optionally, the extension can include an authoredOn date and the name of the user who endorsed the comment. The review operation is more formally defined in the [CRMI Review Operation Definition](https://build.fhir.org/ig/HL7/crmi-ig/OperationDefinition-crmi-review.html). Creation of ArtifactAssessment resources in the repository is not yet available as this server supports HL7® FHIR® R4, and the ArtifactAssessment resource is only available in R5 or later versions.

<img src="./static/review.png" alt="Screenshot of review button for artifact" width="50"/>

Expand Down
36 changes: 23 additions & 13 deletions app/src/pages/review/[resourceType]/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import ArtifactTimeline from '@/components/ArtifactTimeline';

interface DraftArtifactUpdates {
extension?: fhir4.Extension[];
date?: string;
lastReviewDate?: string;
}

/**
Expand Down Expand Up @@ -100,6 +102,7 @@ export default function CommentPage() {
function parseUpdate(comment: string, type: string, userName: string, dateSelected: boolean) {
const additions: DraftArtifactUpdates = {};
const deletions: DraftArtifactUpdates = {};
const currentDate = new Date().toISOString();

const newExtension: fhir4.Extension[] = [];
newExtension.push({ url: 'type', valueCode: type }, { url: 'text', valueMarkdown: comment });
Expand All @@ -108,21 +111,28 @@ export default function CommentPage() {
newExtension.push({ url: 'user', valueString: userName });
}
if (dateSelected === true) {
const authoredDate = new Date();
newExtension.push({ url: 'authoredOn', valueDateTime: authoredDate.toISOString() });
newExtension.push({ url: 'authoredOn', valueDateTime: currentDate });
}

if (resource?.extension) {
resource.extension.push({
extension: newExtension,
url: 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-artifactComment'
});
additions['extension'] = resource.extension;
} else if (resource && !resource.extension) {
resource.extension = [
{ extension: newExtension, url: 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-artifactComment' }
];
additions['extension'] = resource.extension;
if(resource){
if (resource.extension) {
resource.extension.push({
extension: newExtension,
url: 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-artifactComment'
});
additions.extension = resource.extension;
} else{
resource.extension = [
{ extension: newExtension, url: 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-artifactComment' }
];
additions.extension = resource.extension;
}
// update resource dates

resource.date = currentDate;
additions.date = resource.date;
resource.lastReviewDate = currentDate;
additions.lastReviewDate = resource.lastReviewDate;
}
return [additions, deletions];
}
Expand Down

0 comments on commit d4bbd58

Please sign in to comment.