Skip to content

Instantly share code, notes, and snippets.

@Zhang
Created July 15, 2016 00:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zhang/1ba343137a578f05acf8d4c3aebce9f6 to your computer and use it in GitHub Desktop.
Save Zhang/1ba343137a578f05acf8d4c3aebce9f6 to your computer and use it in GitHub Desktop.
anuj desai interview
def patient_payers(type, id, range, filters)
let active_patients = patients(type, id, range, filters)
let result = {}
let active = null;
for (var active_patient of active_patients) {
for (var patient_payer of active_patient.patient_payers) {
if (patient_payer.created_at < range.start) {
isBetween = any(patient_payer.active_history, range.start, range.end)
closest = getClosest(patient_payer.active_history, range.start)
if (isBetween) active = true;
else {
if (!closest.value) active = false;
}
} else if (patient_payer.created_at > range.start && patient_payer.created_at < range.end) {
active = true;
} else {
active = false;
}
if (!active) {
continue;
}
if (!result[patient_payer.name]) {
result[patient.payer.name] = 1;
} else {
result[patient.payer.name] += 1;
}
}
}
for key in result {
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment