I have a list of alarm data that I need to filter based on specific conditions. If there are multiple alarms of type "pull_Alarm" and "emergency_alarm" in the same location, I want to prioritize the "emergency_alarm".
Here is my list:
[
{
alarmType:"Normal_ALARM"
location:"Ward5"
severity:"URGENT"
},
{
alarmType:"Emergency_Alarm
location:"Ward1"
severity:"URGENT"
},
{
alarmType:"PULL_Alarm"
location:"Ward1"
severity:"NORMAL"
}
]
The desired filtered list should look like this:
[
{
alarmType:"Normal_ALARM"
location:"Ward5"
severity:"URGENT"
},
{
alarmType:"Emergency_Alarm
location:"Ward1"
severity:"URGENT"
}
]
If anyone has any suggestions on how to apply these filters, please let me know.