Skip to content

Conversation

@acrowthe
Copy link
Contributor

When an inpatient is imported which has a visit:

  • Check if the visit can have active survey invites. If not, halt
  • If the survey has sent out any emails, mark the visit as on hold and stop sending future emails
  • If the survey has not sent out any emails, delete the visit

Important notes while testing this PR:

  • Since your computer's date will be set to the past, you will not be able to connect to the internet during testing
  • If a CARDS instance encounters a time in the past (eg. you have a running cards instance and set your computer's time backwards, or have a shut down cards instance, set the time backwards and start up the existing cards instance) then some parts of CARDS continue to work but many parts stop working. If this happens, you will have to delete the cards instance and start over. Some examples of breaking components are linking between subjects and forms, search results (such as the dashboards) not showing new entries, and many background tasks.

Testing

  • Update the SubjectSelector.jsx code to make it easier to generate the correct patients:
    • Update the createSubjects function to generate the node name from the entered name, not a uuid
    • Change the following line 854 from:
    let url = (subjectParent || "/Subjects") + "/" + uuidv4();

to:

    let url = (subjectParent || "/Subjects") + "/" + subjectName;
  • Prepare cards to run offline:
docker pull docker.io/library/ubuntu:24.04
mvn clean install -Pdocker
cd compose-cluster
python3 generate_compose_yaml.py --mssql --cards_project  cards4prems --oak_filesystem --dev_docker_image --composum --adminer --smtps --smtps_test_container --smtps_test_mail_path ~/cards-mail --server_address localhost:8080
  • Edit the docker-compose.yml to add the following environment variable: - NIGHTLY_NOTIFICATIONS_SCHEDULE=0 * * * * ? *

  • Set the current date to 08/28

  • Launch cards docker-compose build && docker-compose up

  • Create a new patient information form. When creating the patient subject, name the subject 111111. Fill out name, DoB, mrn, consents to being contacted by email = yes, email address

  • Create a new visit information form for the new patient. Fill out clinic to Integrated Care, Time to the current computer date, provider, location and status.

  • Set the date to 09/12. Create a new patient with MRN 111222 and an integrated care visit and a new patient 222111 with an inpatient visit

  • Set the date to 9/19, wait a minute and verify that an initial invitation email was sent for 222111

  • Set the date to 9/26, wait a minute for 222111's reminder email

  • Set the date to 9/28, wait a minute for 111111's invitation email

  • Set the date to 10/3, wait for 222111's second reminder

  • Set the date to 10/5, wait for 111111's reminder

  • Set the date to 10/12, create a new patient 111333 with an integrated care visit and 222222 with an inpatient visit. During this time, 111111 should get a second reminder

  • Set the date to 10/13, wait for 111222's invitation email

  • Set the date to 10/19, wait for 222222's invitation

  • Set the date to 10/20, wait for 111222's reminder

  • Set the date to 10/26, wait for 222222's reminder

  • Set the date to 10/27, create a new patient 222333 with an inpatient visit. During this time, 111222 should get a second reminder

  • Set the date to 10/30. Import a sample inpatient status table:

  • In cards/compose-cluster/mssql, run python3 ./generate_test_inpatient_status.py -n 10 inpatient_sample.sql

  • Edit the generated inpatient_sample.sql so it includes MRNs 111111, 111222, 111333, 222111, 222222 and 222333

  • Sign into adminer http://localhost:1435/?mssql=mssql&username=sa&db=master&ns=path&import= (password testPassword_)

  • Import the inpatient sample sql file (browse, select the file, execute)

  • Run the inpatient status import by navigating to http://localhost:8080/Subjects.importClarity?config=Inpatient%20Status

  • Verify that patients 111111 and 222111 are unaffected. Verify that patients 111222 and 222222 have their visit information form updated with status on hold. Verify that patients 111333 and 222333 have their visits deleted but patient information form unchanged.

  • Set the date to 11/3. Verify that no second reminder email is sent for 222222

Base automatically changed from CARDS-2767 to dev November 24, 2025 19:13
Copy link
Member

@sdumitriu sdumitriu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, with the exception of multiple Survey Events per visit.

@sdumitriu
Copy link
Member

Actually, speaking of integrated care, we must make sure we don't delete submitted IP/ED forms!

…nt status

When an inpatient is imported which has a visit:
- Check if the visit can have active survey invites. If not, halt
- If the survey has sent out any emails, mark the visit as on hold and stop sending future emails
- If the survey has not sent out any emails, delete the visit
…nt status

- Check for submitted forms before deleting visits. If any submitted forms exist,
don't delete their survey event forms and make the visit on hold instead.
Still delete unsubmitted forms/survey event forms for that visit

- If a form has multiple survey event forms, use the most recent for determining expiry
…nt status

Update survey expiry check to use survey events form instead of clinic
…nt status

Fix submitted forms being updated to on hold
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants