Visit Count by Visit Date per Collection Protocol
Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com

Visit Count by Visit Date per Collection Protocol

We can create a query to get the count of visits for every visit date for each CP.

  1. Add Visit >> Visit Date Operator Exists

  2. Add the following expression as a ‘Calculated Filter’ : date_format(SpecimenCollectionGroup.collectionDate, "%month2%/%month_day%/%year4%") any

image-20250908-104258.png

You can change the expression to show the dates in your desired date format, for more date formats refer: https://openspecimen.atlassian.net/wiki/spaces/CAT/pages/72024115/Calculated+Filter+Temporal+Queries#Temporal-functions

Reason for Step#2:

As ‘Visit Date’ is stored as timestamp in the database i.e. the value is stored as 2025-01-10 12:12:100, even though 2 visits would have same day, month, and year, there might be chance the hours, minutes and millisecond might be different, because of which you might see 2 rows of same date.

  1. If required: add other conditions to the query.

visitcount new5.png
  1. Click on View Records --> Action --> columns.

  2. Select fields --> ‘CP Short Title’, ‘Visit: Identifier or ‘Visit: Name’, ‘Date Format (Calculated Field)’

    visitcount new1.png

 

  1. Optional: Rename the ‘Date Format’ to ‘Visit Date’.

    visitcount new2.png
  2. Click on ‘Next’, select ‘Count’ for the ‘Visit: Identifier’ field.

    visitcount new3.png
  3. Click on ‘Done’.

    visitcount new4.png

 

Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com