/**
 * This function counts the number of patients with flu based on their age.
 *
 * @param age the age group to count the flu cases for (e.g., 'child', 'adult', 'elderly')
 * @param patientList a list of maps where each map represents a patient
 * @return the count of flu cases for the given age group
 */
fun countFluCases(age: String, patientList: List<Map<String, Any>>): Int {

    var count = 0

    for (patient in patientList) {
        if (patient["has_flu"] == true && patient["age_group"] == age) {
            count++
        }
    }

    return count
}

// Example usage:

val patients = listOf(
    mapOf("name" to "John", "age_group" to "child", "has_flu" to true),
    mapOf("name" to "Maria", "age_group" to "elderly", "has_flu" to true),
    mapOf("name" to "Alex", "age_group" to "adult", "has_flu" to false),
    mapOf("name" to "Sophia", "age_group" to "child", "has_flu" to true),
    mapOf("name" to "Michael", "age_group" to "child", "has_flu" to true)
)
/**
 * This function counts the number of patients with flu based on their age.
 *
 * @param age the age group to count the flu cases for (e.g., 'child', 'adult', 'elderly')
 * @param patientList a list of maps where each map represents a patient
 * @return the count of flu cases for the given age group
 */
fun countFluCases(age: String, patientList: List<Map<String, Any>>): Int {
/**
 * This function counts the number of patients with flu based on their age.
 *
 * @param age the age group to count the flu cases for (e.g., 'child', 'adult', 'elderly')
 * @param patientList a list of maps where each map represents a patient
 * @return the count of flu cases for the given age group
 */
fun countFluCases(age: String, patientList: List<Map<String, Any>>): Int {

    var count = 0

    for (patient in patientList) {
        if (patient["has_flu"] == true && patient["age_group"] == age) {
            count++
        }
    }

    return count
}

// Example usage:

val patients = listOf(
    mapOf("name" to "John", "age_group" to "child", "has_flu" to true),
    mapOf("name" to "Maria", "age_group" to "elderly", "has_flu" to true),
    mapOf("name" to "Alex", "age_group" to "adult", "has_flu" to false),
    mapOf("name" to "Sophia", "age_group" to "child", "has_flu" to true),
    mapOf("name" to "Michael", "age_group" to "child", "has_flu" to true)
)