Skip to content

Commit

Permalink
Add clone operation for draft artifacts (#95)
Browse files Browse the repository at this point in the history
* Add clone operation for draft artifacts

* Fixed button formatting

* Clone and other operation descriptions added to the README

* Remove docker-compose content in README
  • Loading branch information
elsaperelli authored May 7, 2024
1 parent 4b8c793 commit cfe2ba5
Show file tree
Hide file tree
Showing 18 changed files with 272 additions and 144 deletions.
61 changes: 14 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 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. 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. 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
- Acts as a FHIR server and shared source of truth for measures and libraries
Expand Down Expand Up @@ -33,9 +34,11 @@ npm install --workspace=<app-or-service> <package-name>
```

Make a copy of `.env` files:

```bash
cp app/.env.example app/.env.local
```

```bash
cp service/.env.example service/.env
```
Expand All @@ -47,20 +50,25 @@ Make any changes to point to the measure repository service, Mongo database, and
Use the mongodb configuration file to configure the single node replica set. For more information about the configuration file and system location, see the mongodb [configuration file documentation](https://www.mongodb.com/docs/manual/reference/configuration-options/).

1. First shutdown any currently running mongodb standalone instances: `brew services stop mongodb-community`.
2. Locate your [Mongo Configuration File](https://www.mongodb.com/docs/compass/current/settings/config-file/#:~:text=For%20macOS%20and%20Linux%2C%20the,%5Cmongodb%2Dcompass.). *System dependent but may be found at `/usr/local/etc/mongod.conf`*.
2. Locate your [Mongo Configuration File](https://www.mongodb.com/docs/compass/current/settings/config-file/#:~:text=For%20macOS%20and%20Linux%2C%20the,%5Cmongodb%2Dcompass.). _System dependent but may be found at `/usr/local/etc/mongod.conf`_.
3. Add this replication set configuration to the mongo configuration file:

```
replication:
replSetName: rs0
```

4. Start mongodb again using homebrew: `brew services restart mongodb-community`.
5. Initialize the replica set using mongosh:

```bash
mongosh
```

```bash
rs.initiate()
```

6. From here you can continue to use the replica set, and in the future, you can do a normal start of the server using homebrew: `brew services start mongodb-community` (without need to reinitialize the replica set).

Further information on standalone to replica set conversion can be found in the mongodb [replica set conversion documentation](https://www.mongodb.com/docs/manual/tutorial/convert-standalone-to-replica-set/).
Expand Down Expand Up @@ -94,61 +102,20 @@ To run `lint` and `prettier` in both the frontend and backend and unit tests in
```bash
npm run check:all
```
> Note: You may recieve a workspace error. This does not prevent the service from running, to remove the error for future builds, run `npx next telemetry disable`

> Note: You may receive a workspace error. This does not prevent the service from running, to remove the error for future builds, run `npx next telemetry disable`
### Docker

To start the app and repository service in parallel, run
To start the app and repository service in parallel, run

```bash
docker compose up --build
```

#### Deploying/Running with Docker Prebuilt Images

If you wish to run pre-built images from [Docker Hub](https://hub.docker.com/u/tacoma), create a `docker-compose.yml` in your environment with the content below. This file is also found at `docker-compose.example.yml`.

```
version: '3'
services:
measure-service:
depends_on:
- mongo
image: tacoma/measure-repository-service
environment:
DATABASE_URL: 'mongodb://mongo:27017/measure-repository'
ports:
- "3000:3000"
stdin_open: true
tty: true
measure-service-app:
depends_on:
- mongo
- measure-service
image: tacoma/measure-repository-app
environment:
# Change this for public location of measure-service this should be the FQDN and location of where the
# measure-service container is made public to users with `4_0_1` appended. ex. https://abacus.example.com/mrs/4_0_1
PUBLIC_MRS_SERVER: http://localhost:3000/4_0_1
MRS_SERVER: http://measure-service:3000/4_0_1
MONGODB_URI: mongodb://mongo:27017/draft-repository
ports:
- '3001:3001'
stdin_open: true
tty: true
mongo:
image: mongo:7.0
expose:
- "27017:27017"
volumes:
- mongo_data:/data/db
volumes:
mongo_data:
```
If you wish to run pre-built images from [Docker Hub](https://hub.docker.com/u/tacoma), create a `docker-compose.yml` in your environment with the content in `docker-compose.example.yml`.

Make sure to change the `PUBLIC_MRS_SERVER` environment variable in this file to match the location of where the FHIR server application will be accessible, this will be `http://localhost:3000/4_0_1` when connecting directly to the container running locally.

Expand Down
86 changes: 61 additions & 25 deletions app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The application is divided into two main sets of functionality, _Repository_ and

<img src="./static/tabs.png" alt="Screenshot of tabs" width="200"/>

The Repository tab provides functionality for accessing and interacting with artifacts that are in the FHIR Measure Repository Service. The Authoring tab focuses on artifacts that are in the process of being drafted. Artifact content can be copied or moved between these two spaces through _draft_ and _release_ actions, described in the [Viewing](#viewing) and [Editing](#editing) sections.
The Repository tab provides functionality for accessing and interacting with artifacts that are in the FHIR Measure Repository Service. The Authoring tab focuses on artifacts that are in the process of being drafted. Artifact content can be copied or moved between these two spaces through _draft_ and _release_ actions, described in the [Draft](#draft) and [Release](#release) sections.

Within these tabs, the left panel navigation allows for selecting artifact types or searching (Repository only) for artifacts so that they can be browsed for viewing or actions.

Expand All @@ -61,46 +61,82 @@ Within these tabs, the left panel navigation allows for selecting artifact types

The landing page can be accessed on first load or by clicking the Measure Repository home button in the top left corner. This page links to resources to learn more about the Measure Repository and shows existing FHIR service capabilities.

## Repository Tab
# Repository Tab

The Repository tab displays sets of artifacts from the FHIR Measure Repository Service. Options allow for viewing resource details or reviewing the resource.

<img src="./static/repository-options.png" alt="Screenshot of repository options" width="75"/>

### Viewing
- Measure: Resource details show the JSON as well as options to see the Narrative, Data Requirements, and Dependencies, if they exist.
- Library: Resource details show the JSON as well as options to see the ELM, CQL, Narrative, Data Requirements, and Dependencies, if they exist.
- Drafting: Both resource views allow the user to create a draft from the artifact. This action copies the existing artifact and any children it owns to the draft Authoring space with a draft status and an incremented version to logically differentiate it from the original artifact. See the [draft operation specification](http://hl7.org/fhir/us/cqfmeasures/measure-repository-service.html#draft).

### Reviewing
- Measure: Resource details show the JSON as well as options to see the Narrative, Data Requirements, and Dependencies, if they exist.
- Library: Resource details show the JSON as well as options to see the ELM, CQL, Narrative, Data Requirements, and Dependencies, if they exist.
- Drafting: Both resource views allow the user to create a draft from the artifact. This action copies the existing artifact and any children it owns to the draft Authoring space with a draft status and an incremented version to logically differentiate it from the original artifact. See the [draft operation specification](http://hl7.org/fhir/us/cqfmeasures/measure-repository-service.html#draft).

Reviewing a resource provides options for viewing existing comments on the resource or adding a new comment. (Note: this is currently partially implemented and requires updates for viewing comments.)
### Review

## Authoring Tab
While the Quality Measure IG is not yet entirely clear on the role of a review operation on active artifacts in a published measure repository, the frontend currently supports the temporary functionality of adding artifact comments on active artifacts due to the [review operation definition](https://build.fhir.org/ig/HL7/crmi-ig/OperationDefinition-crmi-review.html) including "regardless of status". However, this is not currently supported as an update to the artifact: artifact comments on active artifacts may be viewed in the frontend, but they may not yet be added to the artifact on the published measure repository through an update interaction.

The Authoring tab gives options for creating a new draft artifact from scratch or starting from a copy of an existing artifact from the FHIR Measure Repository.
# Authoring Tab

The Authoring tab gives options for creating a new draft artifact from scratch or starting from a copy of an existing artifact from the FHIR Measure Repository. The Authoring tab also displays options for revising, reviewing, cloning, releasing, or withdrawing a draft artifact.

<img src="./static/draft-repository-options.png" alt="Screenshot of draft repository options" width="200"/>

## Supported Authoring Measure Repository Capabilities

The following capabilities are supported in the measure repository authoring frontend as currently defined by the [Quality Measure Implementation Guide](https://build.fhir.org/ig/HL7/cqf-measures/measure-repository-service.html#authoring-measure-repository). Note that these implementations are subject to change as the Measure Repository Service specification in the [QMIG](https://build.fhir.org/ig/HL7/cqf-measures/measure-repository-service.html#measure-repository-service) and the Artifact Repository Service in the [Canonical Resource Management Infrastructure Implementation Guide](https://hl7.org/fhir/uv/crmi/1.0.0-snapshot/CapabilityStatement-crmi-authoring-artifact-repository.html) are developed.

### Submit

The measure repository app supports the submit operation by allowing the creation of a new Measure or Library artifact in draft status. The user can achieve this action by navigating to the "Authoring" tab and clicking "Create New Draft [Measure or Library]" under "Start From Scratch":

<img src="./static/draft-artifact.png" alt="Screenshot of create draft artifact" width="350"/>

### Revise

The measure repository app supports the revise operation by allowing draft artifacts to be updated through changes to the following basic resource fields:

- url
- identifier value
- identifier system
- name
- title
- description
- library (Measure only)

<img src="./static/update-release.png" alt="Screenshot of update/release draft artifact from authoring tab" width="350"/>

### Draft

The measure repository app supports the draft operation by allowing the creating a new Measure or Library artifact from an existing Measure or Library in "active" status. The user can achieve this in two ways: either the dropdown menu on the "Authoring" tab under "Start From an Existing Library" or on the "Create Draft of [Measure or Library]" button in the top right corner of an existing active Measure or Library artifact in the "Repository" tab. As more formally specified in the [CRMI Draft Operation Definition](https://build.fhir.org/ig/HL7/crmi-ig/OperationDefinition-crmi-draft.html), the draft operation is applied to the resources that an artifact is composed of, recursively. This operation is done as a batch for an artifact and any child artifacts that it is composed of.

<img src="./static/draft-artifact.png" alt="Screenshot of create draft measure artifact from authoring tab" width="350"/>

<img src="./static/draft-artifact-2.png" alt="Screenshot of create draft library artifact from repository tab" width="350"/>

### Release

The measure repository app supports the release operation by allowing the update of an existing draft artifact to "active" status. This involves the newly active artifact to be POSTed to the published measure repository and thus removed from the draft repository. The user can achieve this by clicking the "Release" button on a draft artifact in the "Authoring" tab. As more formally specified in the [CRMI Release Operation Definition](https://build.fhir.org/ig/HL7/crmi-ig/OperationDefinition-crmi-release.html), the release operation is applied to the resources that an artifact is composed of, recursively. This operation is done as a batch for an artifact and any child artifacts that it is composed of.

<img src="./static/update-release.png" alt="Screenshot of update/release draft artifact from authoring tab" width="350"/>

### Clone

The measure repository app supports the clone operation by allowing the ability to clone an existing draft artifact to include the contents of the existing artifact with status "draft" and a new ID. The user can achieve this with the "clone" button on the draft artifact cards in the "Authoring" tab. As more formally specified in the [CRMI Clone Operation Definition](https://build.fhir.org/ig/HL7/crmi-ig/OperationDefinition-crmi-clone.html), the clone operation is applied to the resources that an artifact is composed of, recursively. This operation is done as a batch for an artifact and any child artifacts that it is composed of.

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

The left navigation resource type selection displays sets of artifacts that are in progress and being drafted for potential addition to the FHIR Measure Repository. Options allow for editing, reviewing, or deleting a draft resource.
### Withdraw

<img src="./static/authoring-options.png" alt="Screenshot of authoring options" width="120"/>
The measure repository app supports the withdraw operation by allowing the ability to delete an existing draft artifact from the draft repository. The user can achieve this with the "delete" button on the draft artifact cards in the "Authoring" tab. Although not formally specified in the QM or CRMI IGs yet, the withdraw operation is applied to the draft resources that an artifact is composed of, recursively. This operation is done as a batch for an artifact and any child artifacts that it is composed of.

### Editing
- Updating: A Measure or Library allows changes to basic resource fields:
- url
- identifier value
- identifier system
- name
- title
- description
- library (Measure only)
- Releasing: Both resource types may be released from the editing page. This action publishes the draft artifact and any children it owns to the Repository space, adding them to the FHIR Measure Repository and giving them an active status. The draft artifact(s) will be removed from the Authoring space. See the [release operation specification](http://hl7.org/fhir/us/cqfmeasures/measure-repository-service.html#release).
<img src="./static/withdraw.png" alt="Screenshot of withdraw button for artifact" width="50"/>

### Reviewing
### Review

Reviewing a resource provides options for viewing existing comments on the resource or adding a new comment.
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.

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

Deleting an artifact will permanently remove it from the draft database.
<img src="./static/artifact-comment.png" alt="Screenshot of add draft artifact comment" width="500"/>
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import { Modal, Button, Center, Group, Text } from '@mantine/core';
import { AlertTriangle } from 'tabler-icons-react';

export interface DeletionConfirmationModalProps {
export interface ConfirmationModalProps {
open: boolean;
onClose: () => void;
onConfirm: () => void;
action: string;
modalText?: string | null;
}

export default function DeletionConfirmationModal({
export default function ConfirmationModal({
open = true,
onClose,
onConfirm,
action,
modalText
}: DeletionConfirmationModalProps) {
}: ConfirmationModalProps) {
return (
<Modal opened={open} onClose={onClose} withCloseButton={false} size="lg">
<Center>
<AlertTriangle color="red" size={40} />
<AlertTriangle color={action === 'delete' ? 'red' : 'green'} size={40} />
</Center>
<Center>
<Text weight={700} align="center" lineClamp={2} p={'sm'}>
Expand All @@ -29,8 +31,8 @@ export default function DeletionConfirmationModal({
<Button variant="default" onClick={onClose}>
Cancel
</Button>
<Button onClick={onConfirm} color="red">
Delete
<Button onClick={onConfirm} color={action === 'clone' ? 'green' : 'red'}>
{action === 'clone' ? 'Clone' : 'Delete'}
</Button>
</Group>
</Center>
Expand Down
Loading

0 comments on commit cfe2ba5

Please sign in to comment.