About the client
Psicotrec is a Rational Emotive and Cognitive Behavioral Therapy Center in Lima, Peru, accredited by the International Association for Rational Emotive Behavior Therapy - IAREBT.
They offer a range of services like:
- Mental health care (therapy sessions)
- Training programs and refresher courses in REBT and CBT.
Psicotrec has +500 therapy sessions monthly, with a staff of more than ten psychotherapists. At the end of the month, the administrative team consolidates all session and generate a detailed report for each psychotherapist. This report contains session information and commission rate per psychotherapist.
Psicotrec was generating those reports via "Google Sheets," but consolidating the information on a simple spreadsheet was more tedious than ever due to the recent growth of customers. Mistakes were made, data was getting hard to manage, and macro reports were non-existence. Also, there was no relationship between the client information and the session record. Independent spreadsheets were operated, which of course, made information non-accessible.
On the other hand, Psicotrec needed a way of asking for customer feedback. There were no insights on customer satisfaction and loyalty to the company.
The proposed software was constructed to solve these issues and generate a more efficient and scalable workload.
We identified the following requirements with the stakeholders:
- There were two essential actors:
- Administrative staff (AS). For creating sessions, customers, and reports.
- Customers. To answer the monthly survey.
- The A.S. should be able to create, edit and delete a:
- Client. Wich was composed of:
- Personal information like name, I.D., email address, and phone number.
- Relationship between the client and their psychotherapists.
- Relationships between other clients. (This is important if the patient is a minor; Psicotrec relates the child with their parents.)
- Psychotherapist. Wich was composed of:
- Personal information
- Commission percentage
- Default session price
- Psychotherapist Session. Wich was composed of:
- The client
- The psychotherapist
- Start and end time and date
- Currency (Peruvian Soles or U.S. Dollars)
- Type: Virtual or On-Site
- Client. Wich was composed of:
- The client should receive an email (every month) with a survey. The survey is composed of two questions:
- 1 to a 5-star rating of the psychotherapist.
- 0 to 10 NPS questions regarding the institution.
- The A.S. should be able to generate the following reports:
- Export a PDF with the psychologist sessions, total, and commission of a month.
- Export a CSV of the new clients in Psicotrec.
- The A.S. should be able to visualize a table with all the totals and number of sessions of each physiotherapist.
- The A.S. should be able to view a yearly graph with the following statistics:
- The NPS per month
- The number of recurrent vs new clients per month.
- The number of virtual vs on-site clients per month.
- The gross income per month.
We implemented this web platform as a Next.js project with API routes (serverless technology under the hood) and deployed it on Vercel.
The following technologies were used:
- Prisma (ORM)
- MongoDB Atlas (Database)
- Base Web (React U.I. framework)
- Amazon SES (Amazon Simple Email Service)
- NextAuth.js with GoogleProvider (Authentication)
Since it's a private project, there's no public access to the platform or a demo. Nevertheless, you can see more of the web platform in the following screenshots.
The following image shows us all sessions registered for a determined month. The A.S. can filter the data via a psychotherapist or search for a specific client.
After clicking "Nueva Cita" (register a new session [in english]), we end up on the following screen. The A.S. search for a specific client by name and associates him with a psychotherapist with the details of the session.
ThisIn this last image shows a monthly report with the respective totals and buttons for generating the PDF report. The name of the physiotherapist and delicate information is hidden for confidentiality.
What were the challenging parts of the project?
This project required excellent planning from the very beginning. The database modeling/relationship was not trivial if we wanted a normalized dataset. Also, there were many relationships involved between different models. We manage to do an (object mapping) of our entities "on paper" before coding. This helped us avoid mistakes that later fixing later would cost more time; it increased our efficiency.
What was your favourite part of the project?
I enjoyed coding complex aggregation queries. Our ORM, Prisma, didn't support some advanced requests by default (like natively computing the NPS score). So native MongoDB aggregation tools (Prisma RAW) were needed for querying this information. Those tools allow us to do complex queries (with arithmetic operations) in record performance time.
What you didn't like about the project?
Definitely, the DATE management. Since we kept track of dates, I constantly needed to differentiate between server time and local Peruvian time. The dates were saved in our database in the server timestamp, but we needed to convert them in the server to Peruvian time for generating our reports. I solved the issue using an external library (date-fns) that helped me with the conversion while maintaining good code practices.