opal
opal copied to clipboard
discussion over bulk create
bulk create currently accepts a dictionary similar to what is serialised.
However these 2 situations are not equivalent.
if I upload a dictionary to the patient bulk update like follows
{"diagnosis": [
{condition: "cough", episode_id: 1, "id": 1},
{condition: "sneeze"}
]}
At present, this will create a new episode with the diagnosis sneeze, but previous diagnosis will stay on the previous instance. I am not sure this is intuitive
I am not sure this is intuitive
That's actively wrong. If it's anything, it's an episode oriented API.
yeah agreed. I think options are...
{
# patients subrecords
demographics: {patient_id: 1, first_name: 'wilma'
episodes: [
{ id: 1
# all subrecords of episodes 1
},
{ id: None
# all subrecords to be created for a new episode
}
]
}
or we limit the api to just work for a single episode and blow up if there are multiple ids.
How do we handle the case where, no episode_id is present , create a new episode? How do we handle the case where, one episode_id is present but not for other subrecords
or we force an episode to be passed in. In which case its an api on Episode and we just call bulk update on patient for patient specific subrecords.