The goal here is to count the number of patients for each type of diagnosis. In patient record, visit id is unique, yet in diagnosis record, since one visit could have multiple diagnosis, the same visit id could have multiple diagnosis id.
To do so, i think the 2 data frame need to be linked with the field visit id. Could anyone kindly shed some light on how to link the 2 json via Pandas and count the number of patients for each diagnosis. Many thanks
Patient record
JSON [Patient record]
[
{
"Doctor id":"AU1254",
"Patient":[
{
"Patient id":"BK1221",
"Patient name":"Tim"
}
],
"Visit id":"B0001"
},
{
"Doctor id":"AU8766",
"Patient":[
{
"Patient id":"BK1209",
"Patient name":"Sue"
}
],
"Visit id":"B0002"
},
{
"Doctor id":"AU1254",
"Patient":[
{
"Patient id":"BK1323",
"Patient name":"Sary"
}
],
"Visit id":"B0003"
}
]
Diagnosis record
JSON [Diagnosis record]
[
{
"Visit id":"B0001",
"Diagnosis":[
{
"diagnosis id":"D1001",
"diagnosis name":"fever"
},
{
"diagnosis id":"D1987",
"diagnosis name":"cough"
},
{
"diagnosis id":"D1265",
"diagnosis name":"running nose"
}
]
},
{
"Visit id":"B0002",
"Diagnosis":[
{
"diagnosis id":"D1987",
"diagnosis name":"cough"
},
{
"diagnosis id":"D1453",
"diagnosis name":"stomach ache"
}
]
}
]