changes list: an entry for each thing you sent, whether or not it was saved. Each change’s status says which:
APPLIED: saved.REJECTED: not saved. Fix the input.AMBIGUOUS: not saved. Pick one of itsoptions.
APPLIED, everything you sent took effect.
A change
after is set even on a rejected change. A rejected call returns no record, so after is the only place that shows what each input resolved to. Resend its argument and value to skip resolving it again.
Choices
options, before and after are all Choices. A choice says what it is and how to send it:
Answering a choice
When a name fits several things (a drug, an allergen, a pharmacy), Photon doesn’t guess. It returns anAMBIGUOUS change, saves nothing, and lists the candidates as options:
entity is a Treatment with its brand, form and strength in separate fields (see Choosing the drug).
Each option says exactly what to do: in the input of the operation mutation, set the argument path to value, then resend. Here that means resending with treatment: { id: "med_01M3D93NFGCZJPQ3XW3AF7578G" } in place of the name.
A single match can ask too. A name that matches one thing, but not exactly, comes back AMBIGUOUS with one option and the CONFIRMATION_REQUIRED category. A drug, allergen or diagnosis name attaches on its own only when it’s exactly that entry’s name. A pharmacy search never picks a pharmacy on its own, even with one match: only a pharmacy id does.
Who picks: pick automatically only when there’s a single option that matched exactly (EXACT_NAME_MATCH or RXNORM_CODE_MATCH). Otherwise, show the options to a person, or apply your own deterministic rule. Prescribe and the JavaScript client follow this same rule.
Rules
- A call is all or nothing. If any change is
REJECTEDorAMBIGUOUS, nothing is saved. Inputs that were fine come backREJECTED, with areasonpointing at the input that failed. Fix that input and resend the whole call. - The record can be null. When nothing was saved,
patient,prescriptionorordermay benull. The cause is inchanges. - Applied changes can carry advice. An
APPLIEDchange withADVISORYseverity was saved, but its options suggest something better, such as a more specific diagnosis code. - Ambiguous records are separate. When Photon can’t tell which existing patient, draft or order you meant, the whole result is an
Ambiguous…Matchwithcandidates, not a change. Resend with the candidate’sid.