Skip to content

Instantly share code, notes, and snippets.

def is_payer_active_in_range(payer, range)
active_history = payer.active_history
# list of value and updated_at
prev_active = false
prev_time = 0
# cases: updated during, updated only before, updated only after, updated before and after but not during
for update in active_history:
current_active = update.value
def patient_payers(type, id, range, filters)
Map<Integer, Integer> payerTable = new HashMap<>();
List<Patient> patientsInDateRange = patients(type, id, range, filters);
// Iterate on the patients
for (Patient patient : patientsInDataRange) {
// Iterate on the payers
for (Payer payer : patient.getPayers()) {
if (payer.isActive()) {
if (payerTable.containsKey(payer.Id)) {
def patient_payers(type, id, range, filters)
# get hospital's patients at the hospital during range
# by looking at admissions table
active_patients = patients(type, id, range, filters)
# using list of patient_ids, get list of patient-payer relationships
payers = set([])
count = Counter()
def patient_payers(type, id, range, filters)
let patients = patients(type, id, range, filters)
var activePayers = [payer: count]
for patient in patients {
let patientPayers = patient.patient_payers
for payer in patientPayers {
if payerIsActiveInRange(payer, range) {
if activePayers[payer] == nil {
activePayers[payer] = 1
} else {
def patient_payers(type, id, range, filters)
ArrayList<Patient> patientList = patients(type, id, range, filters);
HashMap<Payer, Integer> dict = new HashMap<Payer, Integer>();
for (Patient patient : patientList) {
ArrayList<Payers> payerList = patient.patientPayers();
for (Payer payer : payerList) {
if (isInRange(payer, range)) {
if (dict.containsKey(payer)) {
dict.put(payer, ++dict.get(payer));
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;
5
/ \
3 7
/ \ / \
1 4 6 9
\
2
//find the next highest node
# Returns an array of arrays. The first element in each sub-array is the name of the payer, and the second element is
# the count. The payer must have been active during range.
def patient_payers(type, id, range, filters)
active_patients = patients(type, id, range, filters)
return_map = {}
for patient in active_patients:
for payer in patient.patient_payers:
for payer_history in payer.active_history:
if is_in_date_range(payer_history, range):
return_map.increment(payer.id)
5
/ \
3 8
/ \ / \
2 4 6 9
\
7
def nextLargest(node):
if it does not have a right child node:
grunt.initConfig({
nodemon: {
web: nodemonConf('cluster-web.js'),
objodb: nodemonConf('lib/objodb/objodbServer.js'),
topology: nodemonConf('lib/topology.js'),
scheduler: nodemonConf('lib/scheduler.js'),
propertyComputeWorker: nodemonConf('lib/propertyComputeWorker.js'),
emailQueueListener: nodemonConf('lib/emailQueueListener.js'),
fayeServer: nodemonConf('lib/fayeServer.js')
},