How can we establish a connection between queued_Dr
and upcoming_appointments
using all_appointments
?
What would be the most effective solution for this issue?
var queued_Dr = ["Dr.Salazar",["Dr.Connors","Dr.Johnson"],"Dr.Pearson"]
upcoming_appointments =
[{"DOB":"01-27-2002","name":"Judy, W." ,"PCD":"Dr-S"}
,{"DOB":"08-15-1995","name":"John, V." ,"PCD":"Dr-C"}
,{"DOB":"07-05-1992","name":"David, C.","PCD":"Dr-S"}
,{"DOB":"01-15-2002","name":"Anna, S." ,"PCD":"Dr-J"}
,{"DOB":"01-15-2002","name":"Jeff, D." ,"PCD":"Dr-P"}]
all_appointments =
{"0": ["Dr-S","New York","Dr.Salazar"],
"1": ["Dr-C","Austin","Dr.Connors"],
"2": ["Dr-J","Austin","Dr.Johnson"],
"3": ["Dr-S","New York","Dr.Salazar"],
"4": ["Dr-P","San Juan","Dr.Pearson"],
"5": ["Dr-J","Austin","Dr.Johnson"]}
Desired Output
"Dr.Salazar" -> "Dr-S"
["Dr.Connors","Dr.Johnson"] -> "Dr-C" or "Dr-J"
"Dr.Pearson"] -> "Dr-P"
The inputs are queued_Dr
and upcoming_appointments.PCD
//Attempted to search for matching values within the same dictionary
function find_by_exception_name(dr_name) {
return all_appointments.find((row) => row.upcoming_appointments == dr_name || row.upcoming_appointments.includes(dr_name));
}
//This function would provide true or false if a doctor's name from queued_Dr and upcoming appointments exists in all_appointments