/**
 * A physician wants to filter out the patient data based on a certain condition.
 *
 * Complete the code below to iterate over each element in the patientData list,
 * check if the element satisfies the given condition, and add it to the filteredData list.
 *
 * @param patientData a list of patient records, where each record is represented as a map
 * @param condition a function that takes a patient record as input and returns a boolean value indicating whether the record satisfies the condition or not
 * @return filteredData a list of patient records that satisfy the given condition
 */
fun filterPatientData(patientData: List<Map<String, Any>>, condition: (Map<String, Any>) -> Boolean): List<Map<String, Any>> {

    val filteredData = mutableListOf<Map<String, Any>>()

    for (data in patientData) {
        if (condition(data)) {
            filteredData.add(data)
        }
    }

    return filteredData
}

// Example usage:

val patients = listOf(
    mapOf("name" to "John", "age" to 34, "gender" to "Male", "diagnosis" to "Influenza"),
    mapOf("name" to "Lisa", "age" to 52, "gender" to "Female", "diagnosis" to "Hypertension"),
    mapOf("name" to "David", "age" to 45, "gender" to "Male", "diagnosis" to "Asthma")
)
/**
 * A physician wants to filter out the patient data based on a certain condition.
 *
 * Complete the code below to iterate over each element in the patientData list,
 * check if the element satisfies the given condition, and add it to the filteredData list.
 *
 * @param patientData a list of patient records, where each record is represented as a map
 * @param condition a function that takes a patient record as input and returns a boolean value indicating whether the record satisfies the condition or not
 * @return filteredData a list of patient records that satisfy the given condition
 */
fun filterPatientData(patientData: List<Map<String, Any>>, condition: (Map<String, Any>) -> Boolean): List<Map<String, Any>> {
/**
 * A physician wants to filter out the patient data based on a certain condition.
 *
 * Complete the code below to iterate over each element in the patientData list,
 * check if the element satisfies the given condition, and add it to the filteredData list.
 *
 * @param patientData a list of patient records, where each record is represented as a map
 * @param condition a function that takes a patient record as input and returns a boolean value indicating whether the record satisfies the condition or not
 * @return filteredData a list of patient records that satisfy the given condition
 */
fun filterPatientData(patientData: List<Map<String, Any>>, condition: (Map<String, Any>) -> Boolean): List<Map<String, Any>> {

    val filteredData = mutableListOf<Map<String, Any>>()

    for (data in patientData) {
        if (condition(data)) {
            filteredData.add(data)
        }
    }

    return filteredData
}

// Example usage:

val patients = listOf(
    mapOf("name" to "John", "age" to 34, "gender" to "Male", "diagnosis" to "Influenza"),
    mapOf("name" to "Lisa", "age" to 52, "gender" to "Female", "diagnosis" to "Hypertension"),
    mapOf("name" to "David", "age" to 45, "gender" to "Male", "diagnosis" to "Asthma")
)