/**
 * Given a list of therapist notes, an exercise list, and a specific patient ID, count the number of exercises completed by that patient.
 */
fun countExercisesCompleted(therapistNotes: List<Map<String, Any>>, exerciseList: List<String>, patientId: String): Int {

    // Initialize a variable to store the count of exercises completed
    var exercisesCompleted = 0
    
    // Iterate over the therapist notes
    for (note in therapistNotes) {
        // Check if the note is regarding the specified patient
        if (note["patient_id"] == patientId) {
            // Retrieve the exercise IDs from the note
            val completedExercises = note["exercises_completed"] as List<String>
            
            // Iterate over the exercise IDs
            for (exerciseId in completedExercises) {
                // Check if the exercise ID exists in the exercise list
                if (exerciseId in exerciseList) {
                    // Increment the count of exercises completed
                    exercisesCompleted++
                }
            }
        }
    }
    
    return exercisesCompleted
}
/**
 * Given a list of therapist notes, an exercise list, and a specific patient ID, count the number of exercises completed by that patient.
 */
fun countExercisesCompleted(therapistNotes: List<Map<String, Any>>, exerciseList: List<String>, patientId: String): Int {
/**
 * Given a list of therapist notes, an exercise list, and a specific patient ID, count the number of exercises completed by that patient.
 */
fun countExercisesCompleted(therapistNotes: List<Map<String, Any>>, exerciseList: List<String>, patientId: String): Int {

    // Initialize a variable to store the count of exercises completed
    var exercisesCompleted = 0
    
    // Iterate over the therapist notes
    for (note in therapistNotes) {
        // Check if the note is regarding the specified patient
        if (note["patient_id"] == patientId) {
            // Retrieve the exercise IDs from the note
            val completedExercises = note["exercises_completed"] as List<String>
            
            // Iterate over the exercise IDs
            for (exerciseId in completedExercises) {
                // Check if the exercise ID exists in the exercise list
                if (exerciseId in exerciseList) {
                    // Increment the count of exercises completed
                    exercisesCompleted++
                }
            }
        }
    }
    
    return exercisesCompleted
}