charterDataTemp = FileAttachment("data/arizona/charter_data_22_010423.csv").csv();
currentChartersData = aq.from(charterDataTemp)
.derive({
CC_TWINAS_CYK8: d => +op.round3(d.NAOI_CYK8 * d.SUPP_LWK8),
CC_TWINAS_CY912: d => +op.round3(d.NAOI_CY912 * d.SUPP_LW912),
// CC_TWINAS_CYPSD: d => +op.round3(d.NAOI_CYPSD * +d.SUPP_LWPSD),
CC_TWINAS_K3_READ: d => +op.round3(d.NAOI_CYK3 * 0.04),
CC_TWINAS_K3: d => +op.round3(d.NAOI_CYK3 * 0.06),
CC_TWINAS_ELL: d => +op.round3(d.NAOI_ELL * 0.115),
CC_TWINAS_SPED_1: d => +op.round3(d.NAOI_SPED_1 * 4.771),
CC_TWINAS_SPED_2: d => +op.round3(d.NAOI_SPED_2 * 6.024),
CC_TWINAS_SPED_3: d => +op.round3(d.NAOI_SPED_3 * 5.833),
CC_TWINAS_SPED_4: d => +op.round3(d.NAOI_SPED_4 * 7.947),
CC_TWINAS_SPED_5: d => +op.round3(d.NAOI_SPED_5 * 3.158),
CC_TWINAS_SPED_6: d => +op.round3(d.NAOI_SPED_6 * 6.773),
CC_TWINAS_SPED_7: d => +op.round3(d.NAOI_SPED_7 * 3.595),
CC_TWINAS_SPED_8: d => +op.round3(d.NAOI_SPED_8 * 0.003),
CC_TWINAS_SPED_9: d => +op.round3(d.NAOI_SPED_9 * 4.822),
CC_TWINAS_SPED_10: d => +op.round3(d.NAOI_SPED_10 * 4.421),
CC_TWINAS_SPED_11: d => +op.round3(d.NAOI_SPED_11 * 4.806),
CC_TWAFT_CYK8: d => +op.round3(d.AFT_CYK8 * d.SUPP_LWK8),
CC_TWAFT_CY912: d => +op.round3(d.AFT_CY912 * d.SUPP_LW912),
// CC_TWAFT_CYPSD: d => +op.round3(d.AFT_CYPSD * +d.SUPP_LWPSD),
CC_TWAFT_K3_READ: d => +op.round3(d.AFT_CYK3 * 0.04),
CC_TWAFT_K3: d => +op.round3(d.AFT_CYK3 * 0.06),
CC_TWAFT_ELL: d => +op.round3(d.AFT_ELL * 0.115),
CC_TWAFT_SPED_1: d => +op.round3(d.AFT_SPED_1 * 4.771),
CC_TWAFT_SPED_2: d => +op.round3(d.AFT_SPED_2 * 6.024),
CC_TWAFT_SPED_3: d => +op.round3(d.AFT_SPED_3 * 5.833),
CC_TWAFT_SPED_4: d => +op.round3(d.AFT_SPED_4 * 7.947),
CC_TWAFT_SPED_5: d => +op.round3(d.AFT_SPED_5 * 3.158),
CC_TWAFT_SPED_6: d => +op.round3(d.AFT_SPED_6 * 6.773),
CC_TWAFT_SPED_7: d => +op.round3(d.AFT_SPED_7 * 3.595),
CC_TWAFT_SPED_8: d => +op.round3(d.AFT_SPED_8 * 0.003),
CC_TWAFT_SPED_9: d => +op.round3(d.AFT_SPED_9 * 4.822),
CC_TWAFT_SPED_10: d => +op.round3(d.AFT_SPED_10 * 4.421),
CC_TWAFT_SPED_11: d => +op.round3(d.AFT_SPED_11 * 4.806),
CC_TWAPT_CYK8: d => +op.round3(d.APT_CYK8 * d.SUPP_LWK8),
CC_TWAPT_CY912: d => +op.round3(d.APT_CY912 * d.SUPP_LW912),
// CC_TWAPT_CYPSD: d => +op.round3(d.APT_CYPSD * +d.SUPP_LWPSD),
CC_TWAPT_K3_READ: d => +op.round3(d.APT_CYK3 * 0.04),
CC_TWAPT_K3: d => +op.round3(d.APT_CYK3 * 0.06),
CC_TWAPT_ELL: d => +op.round3(d.APT_ELL * 0.115),
CC_TWAPT_SPED_1: d => +op.round3(d.APT_SPED_1 * 4.771),
CC_TWAPT_SPED_2: d => +op.round3(d.APT_SPED_2 * 6.024),
CC_TWAPT_SPED_3: d => +op.round3(d.APT_SPED_3 * 5.833),
CC_TWAPT_SPED_4: d => +op.round3(d.APT_SPED_4 * 7.947),
CC_TWAPT_SPED_5: d => +op.round3(d.APT_SPED_5 * 3.158),
CC_TWAPT_SPED_6: d => +op.round3(d.APT_SPED_6 * 6.773),
CC_TWAPT_SPED_7: d => +op.round3(d.APT_SPED_7 * 3.595),
CC_TWAPT_SPED_8: d => +op.round3(d.APT_SPED_8 * 0.003),
CC_TWAPT_SPED_9: d => +op.round3(d.APT_SPED_9 * 4.822),
CC_TWAPT_SPED_10: d => +op.round3(d.APT_SPED_10 * 4.421),
CC_TWAPT_SPED_11: d => +op.round3(d.APT_SPED_11 * 4.806)
})
.derive({
CC_BSL: d => (((
d.CC_TWINAS_CYK8 + d.CC_TWINAS_CY912 + d.CC_TWINAS_K3_READ + d.CC_TWINAS_K3 + d.CC_TWINAS_ELL + d.CC_TWINAS_SPED_1 + d.CC_TWINAS_SPED_2 + d.CC_TWINAS_SPED_3 + d.CC_TWINAS_SPED_4 + d.CC_TWINAS_SPED_5 + d.CC_TWINAS_SPED_6 + d.CC_TWINAS_SPED_7 + d.CC_TWINAS_SPED_8 + d.CC_TWINAS_SPED_9 + d.CC_TWINAS_SPED_10 + d.CC_TWINAS_SPED_11
) * +d.B_COST)
+ ((
d.CC_TWAFT_CYK8 + d.CC_TWAFT_CY912 + d.CC_TWAFT_K3_READ + d.CC_TWAFT_K3 + d.CC_TWAFT_ELL + d.CC_TWAFT_SPED_1 + d.CC_TWAFT_SPED_2 + d.CC_TWAFT_SPED_3 + d.CC_TWAFT_SPED_4 + d.CC_TWAFT_SPED_5 + d.CC_TWAFT_SPED_6 + d.CC_TWAFT_SPED_7 + d.CC_TWAFT_SPED_8 + d.CC_TWAFT_SPED_9 + d.CC_TWAFT_SPED_10 + d.CC_TWAFT_SPED_11
) * 0.95 * +d.B_COST)
+ ((
d.CC_TWAPT_CYK8 + d.CC_TWAPT_CY912 + d.CC_TWAPT_K3_READ + d.CC_TWAPT_K3 + d.CC_TWAPT_ELL + d.CC_TWAPT_SPED_1 + d.CC_TWAPT_SPED_2 + d.CC_TWAPT_SPED_3 + d.CC_TWAPT_SPED_4 + d.CC_TWAPT_SPED_5 + d.CC_TWAPT_SPED_6 + d.CC_TWAPT_SPED_7 + d.CC_TWAPT_SPED_8 + d.CC_TWAPT_SPED_9 + d.CC_TWAPT_SPED_10 + d.CC_TWAPT_SPED_11
) * 0.85 * +d.B_COST)
)
})
.derive({
CC_ADJ_BSL: d => +d.CC_BSL + +d.B_SUPP_ADJ,
CC_AA_K8: d => +d.AA_K8C * +d.AA_K8AAPS,
CC_AA_912: d => +d.AA_912C * +d.AA_912AAPS,
})
.derive({
CC_EQ_BA: d => +d.CC_ADJ_BSL + +d.CC_AA_K8 + +d.CC_AA_912,
})
.objects();
modeledChartersData = aq.from(currentChartersData)
.params({charterBaseAdj: 1,
baseLevelAmount: 1,
k3Reading: 1,
k3: 1,
ell: 1,
sped1: 1,
sped2: 1,
sped3: 1,
sped4: 1,
sped5: 1,
sped6: 1,
sped7: 1,
sped8: 1,
sped9: 1,
sped10: 1,
sped11: 1,
msWeight: 1})
.derive({ADJ_IND: d => 0})
.derive({ charterBaseAdj: (d, $) => $.charterBaseAdj == true ? 1.05000081287029 : 1})
.derive({ MC_B_COST: (d, $) => +d.ADJ_IND === 1 ? +op.round2($.baseLevelAmount * +d.charterBaseAdj) : +op.round2($.baseLevelAmount)})
.derive({
MC_TWINAS_CYK8: d => +op.round3(d.NAOI_CYK8 * d.SUPP_LWK8),
MC_TWINAS_CY912: d => +op.round3(d.NAOI_CY912 * d.SUPP_LW912),
// MC_TWINAS_CYPSD: d => +op.round3(d.NAOI_CYPSD * +d.SUPP_LWPSD),
MC_TWINAS_K3_READ: (d, $) => +op.round3(d.NAOI_CYK3 * $.k3Reading),
MC_TWINAS_K3: (d, $) => +op.round3(d.NAOI_CYK3 * $.k3),
MC_TWINAS_ELL: (d, $) => +op.round3(d.NAOI_ELL * $.ell),
MC_TWINAS_SPED_1: (d, $) => +op.round3(d.NAOI_SPED_1 * $.sped1),
MC_TWINAS_SPED_2: (d, $) => +op.round3(d.NAOI_SPED_2 * $.sped2),
MC_TWINAS_SPED_3: (d, $) => +op.round3(d.NAOI_SPED_3 * $.sped3),
MC_TWINAS_SPED_4: (d, $) => +op.round3(d.NAOI_SPED_4 * $.sped4),
MC_TWINAS_SPED_5: (d, $) => +op.round3(d.NAOI_SPED_5 * $.sped5),
MC_TWINAS_SPED_6: (d, $) => +op.round3(d.NAOI_SPED_6 * $.sped6),
MC_TWINAS_SPED_7: (d, $) => +op.round3(d.NAOI_SPED_7 * $.sped7),
MC_TWINAS_SPED_8: (d, $) => +op.round3(d.NAOI_SPED_8 * $.sped8),
MC_TWINAS_SPED_9: (d, $) => +op.round3(d.NAOI_SPED_9 * $.sped9),
MC_TWINAS_SPED_10: (d, $) => +op.round3(d.NAOI_SPED_10 * $.sped10),
MC_TWINAS_SPED_11: (d, $) => +op.round3(d.NAOI_SPED_11 * $.sped11),
MC_TWAFT_CYK8: d => +op.round3(d.AFT_CYK8 * d.SUPP_LWK8),
MC_TWAFT_CY912: d => +op.round3(d.AFT_CY912 * d.SUPP_LW912),
// MC_TWAFT_CYPSD: d => +op.round3(d.AFT_CYPSD * +d.SUPP_LWPSD),
MC_TWAFT_K3_READ: (d, $) => +op.round3(d.AFT_CYK3 * $.k3Reading),
MC_TWAFT_K3: (d, $) => +op.round3(d.AFT_CYK3 * $.k3),
MC_TWAFT_ELL: (d, $) => +op.round3(d.AFT_ELL * $.ell),
MC_TWAFT_SPED_1: (d, $) => +op.round3(d.AFT_SPED_1 * $.sped1),
MC_TWAFT_SPED_2: (d, $) => +op.round3(d.AFT_SPED_2 * $.sped2),
MC_TWAFT_SPED_3: (d, $) => +op.round3(d.AFT_SPED_3 * $.sped3),
MC_TWAFT_SPED_4: (d, $) => +op.round3(d.AFT_SPED_4 * $.sped4),
MC_TWAFT_SPED_5: (d, $) => +op.round3(d.AFT_SPED_5 * $.sped5),
MC_TWAFT_SPED_6: (d, $) => +op.round3(d.AFT_SPED_6 * $.sped6),
MC_TWAFT_SPED_7: (d, $) => +op.round3(d.AFT_SPED_7 * $.sped7),
MC_TWAFT_SPED_8: (d, $) => +op.round3(d.AFT_SPED_8 * $.sped8),
MC_TWAFT_SPED_9: (d, $) => +op.round3(d.AFT_SPED_9 * $.sped9),
MC_TWAFT_SPED_10: (d, $) => +op.round3(d.AFT_SPED_10 * $.sped10),
MC_TWAFT_SPED_11: (d, $) => +op.round3(d.AFT_SPED_11 * $.sped11),
MC_TWAPT_CYK8: d => +op.round3(d.APT_CYK8 * d.SUPP_LWK8),
MC_TWAPT_CY912: d => +op.round3(d.APT_CY912 * d.SUPP_LW912),
// MC_TWAPT_CYPSD: d => +op.round3(d.APT_CYPSD * +d.SUPP_LWPSD),
MC_TWAPT_K3_READ: (d, $) => +op.round3(d.APT_CYK3 * $.k3Reading),
MC_TWAPT_K3: (d, $) => +op.round3(d.APT_CYK3 * $.k3),
MC_TWAPT_ELL: (d, $) => +op.round3(d.APT_ELL * $.ell),
MC_TWAPT_SPED_1: (d, $) => +op.round3(d.APT_SPED_1 * $.sped1),
MC_TWAPT_SPED_2: (d, $) => +op.round3(d.APT_SPED_2 * $.sped2),
MC_TWAPT_SPED_3: (d, $) => +op.round3(d.APT_SPED_3 * $.sped3),
MC_TWAPT_SPED_4: (d, $) => +op.round3(d.APT_SPED_4 * $.sped4),
MC_TWAPT_SPED_5: (d, $) => +op.round3(d.APT_SPED_5 * $.sped5),
MC_TWAPT_SPED_6: (d, $) => +op.round3(d.APT_SPED_6 * $.sped6),
MC_TWAPT_SPED_7: (d, $) => +op.round3(d.APT_SPED_7 * $.sped7),
MC_TWAPT_SPED_8: (d, $) => +op.round3(d.APT_SPED_8 * $.sped8),
MC_TWAPT_SPED_9: (d, $) => +op.round3(d.APT_SPED_9 * $.sped9),
MC_TWAPT_SPED_10: (d, $) => +op.round3(d.APT_SPED_10 * $.sped10),
MC_TWAPT_SPED_11: (d, $) => +op.round3(d.APT_SPED_11 * $.sped11)
})
// .derive({
// MC_MS_WEIGHT: (d, $) => ((+d.MS_ENR_6 + +d.MS_ENR_7 + +d.MS_ENR_8) * $.msWeight)
// })
.derive({
MC_BSL: d => ((d.MC_TWINAS_CYK8 + d.MC_TWINAS_CY912 + d.MC_TWINAS_K3_READ + d.MC_TWINAS_K3 + d.MC_TWINAS_ELL + d.MC_TWINAS_SPED_1 + d.MC_TWINAS_SPED_2 + d.MC_TWINAS_SPED_3 + d.MC_TWINAS_SPED_4 + d.MC_TWINAS_SPED_5 + d.MC_TWINAS_SPED_6 + d.MC_TWINAS_SPED_7 + d.MC_TWINAS_SPED_8 + d.MC_TWINAS_SPED_9 + d.MC_TWINAS_SPED_10 + d.MC_TWINAS_SPED_11) * d.MC_B_COST) +
((d.MC_TWAFT_CYK8 + d.MC_TWAFT_CY912 + d.MC_TWAFT_K3_READ + d.MC_TWAFT_K3 + d.MC_TWAFT_ELL + d.MC_TWAFT_SPED_1 + d.MC_TWAFT_SPED_2 + d.MC_TWAFT_SPED_3 + d.MC_TWAFT_SPED_4 + d.MC_TWAFT_SPED_5 + d.MC_TWAFT_SPED_6 + d.MC_TWAFT_SPED_7 + d.MC_TWAFT_SPED_8 + d.MC_TWAFT_SPED_9 + d.MC_TWAFT_SPED_10 + d.MC_TWAFT_SPED_11) * 0.95 * d.MC_B_COST) +
((d.MC_TWAPT_CYK8 + d.MC_TWAPT_CY912 + d.MC_TWAPT_K3_READ + d.MC_TWAPT_K3 + d.MC_TWAPT_ELL + d.MC_TWAPT_SPED_1 + d.MC_TWAPT_SPED_2 + d.MC_TWAPT_SPED_3 + d.MC_TWAPT_SPED_4 + d.MC_TWAPT_SPED_5 + d.MC_TWAPT_SPED_6 + d.MC_TWAPT_SPED_7 + d.MC_TWAPT_SPED_8 + d.MC_TWAPT_SPED_9 + d.MC_TWAPT_SPED_10 + d.MC_TWAPT_SPED_11) * 0.85 * d.MC_B_COST)
})
.derive({
MC_ADJ_BSL: d => d.MC_BSL + +d.B_SUPP_ADJ,
MC_AA_K8: d => d.AA_K8C * d.AA_K8AAPS,
MC_AA_912: d => d.AA_912C * d.AA_912AAPS
})
.derive({
MC_EQ_BA: d => d.MC_ADJ_BSL + d.MC_AA_K8 + d.MC_AA_912
})
.derive({
ADM: d => +d.NAOI_CYK8 + +d.NAOI_CY912 + +d.AFT_CYK8 + +d.AFT_CY912 + +d.APT_CYK8 + +d.APT_CY912
})
// .select("NAME", "charterBaseAdj", "MC_B_COST", "MC_TWINAS_CYK8", "MC_TWINAS_CY912", "MC_TWINAS_CYPSD", "MC_TWINAS_K3_READ", "MC_TWINAS_K3", "MC_TWINAS_ELL", "MC_TWINAS_SPED_1", "MC_TWINAS_SPED_2", "MC_TWINAS_SPED_3", "MC_TWINAS_SPED_4", "MC_TWINAS_SPED_5", "MC_TWINAS_SPED_6", "MC_TWINAS_SPED_7", "MC_TWINAS_SPED_8", "MC_TWINAS_SPED_9", "MC_TWINAS_SPED_10", "MC_TWINAS_SPED_11", "MC_TWAFT_CYK8", "MC_TWAFT_CY912", "MC_TWAFT_CYPSD", "MC_TWAFT_K3_READ", "MC_TWAFT_K3", "MC_TWAFT_ELL", "MC_TWAFT_SPED_1", "MC_TWAFT_SPED_2", "MC_TWAFT_SPED_3", "MC_TWAFT_SPED_4", "MC_TWAFT_SPED_5", "MC_TWAFT_SPED_6", "MC_TWAFT_SPED_7", "MC_TWAFT_SPED_8", "MC_TWAFT_SPED_9", "MC_TWAFT_SPED_10", "MC_TWAFT_SPED_11", "MC_TWAPT_CYK8", "MC_TWAPT_CY912", "MC_TWAPT_CYPSD", "MC_TWAPT_K3_READ", "MC_TWAPT_K3", "MC_TWAPT_ELL", "MC_TWAPT_SPED_1", "MC_TWAPT_SPED_2", "MC_TWAPT_SPED_3", "MC_TWAPT_SPED_4", "MC_TWAPT_SPED_5", "MC_TWAPT_SPED_6", "MC_TWAPT_SPED_7", "MC_TWAPT_SPED_8", "MC_TWAPT_SPED_9", "MC_TWAPT_SPED_10", "MC_TWAPT_SPED_11", "MC_MS_WEIGHT", "MC_BSL", "MC_ADJ_BSL", "MC_AA_K8", "MC_AA_912", "MC_EQ_BA", "ADM")
// .select("charterBaseAdj", "MC_B_COST")
.objects();
viewof perPupilTotal = form(
html`
<form style="text-align: center; font-size: 16px;">
<label class="per-pupil-switch">
<input id="per-pupil" type="radio" name="optradio" value="0" checked>Per Pupil
</label>
<label class="total-switch">
<input id="total" type="radio" name="optradio" value="1">Total
</label>
</form>
`
)
Temp Districts Data
tempDistrictsDataNEW = FileAttachment("data/arizona/district_data.csv").csv()
aq.from(tempDistrictsDataNEW).orderby('NAME')
.view()
tempDistrictsData = FileAttachment("data/arizona/district_data.csv").csv()
// Functions
functions = {aq.addFunction('round5', x => x.toFixed(5), { override: true })
aq.addFunction('round4', x => x.toFixed(4), { override: true })
aq.addFunction('round3', x => x.toFixed(3), { override: true })
aq.addFunction('round2', x => x.toFixed(2), { override: true })
aq.addFunction('trunc', x => Math.trunc(x), { override: true })}
currentDistrictsData = aq.from(tempDistrictsData)
// .derive({
// B_COST: d => +d.NAME == "Pima County Accomodation School District" ? 4577.53 : +d.B_COST
// })
.derive({
TRCL_23_CONS: d => 0,
})
.derive({
CD_TWINAS_CYK8: d => +op.round3(d.NAOI_CYK8 * d.SUPP_LWK8),
CD_TWINAS_CY912: d => +op.round3(d.NAOI_CY912 * d.SUPP_LW912),
CD_TWINAS_CYPSD: d => +op.round3(d.NAOI_CYPSD * d.SUPP_LWPSD),
CD_TWINAS_K3_READ: d => +op.round3(d.NAOI_CYK3 * 0.04),
CD_TWINAS_K3: d => +op.round3(d.NAOI_CYK3 * 0.06),
CD_TWINAS_ELL: d => +op.round3(d.NAOI_ELL * 0.115),
CD_TWINAS_SPED_1: d => +op.round3(d.NAOI_SPED_1 * 4.771),
CD_TWINAS_SPED_2: d => +op.round3(d.NAOI_SPED_2 * 6.024),
CD_TWINAS_SPED_3: d => +op.round3(d.NAOI_SPED_3 * 5.833),
CD_TWINAS_SPED_4: d => +op.round3(d.NAOI_SPED_4 * 7.947),
CD_TWINAS_SPED_5: d => +op.round3(d.NAOI_SPED_5 * 3.158),
CD_TWINAS_SPED_6: d => +op.round3(d.NAOI_SPED_6 * 6.773),
CD_TWINAS_SPED_7: d => +op.round3(d.NAOI_SPED_7 * 3.595),
CD_TWINAS_SPED_8: d => +op.round3(d.NAOI_SPED_8 * 0.003),
CD_TWINAS_SPED_9: d => +op.round3(d.NAOI_SPED_9 * 4.822),
CD_TWINAS_SPED_10: d => +op.round3(d.NAOI_SPED_10 * 4.421),
CD_TWINAS_SPED_11: d => +op.round3(d.NAOI_SPED_11 * 4.806),
CD_TWAFT_CYK8: d => +op.round3(d.AFT_CYK8 * d.SUPP_LWK8),
CD_TWAFT_CY912: d => +op.round3(d.AFT_CY912 * d.SUPP_LW912),
CD_TWAFT_CYPSD: d => +op.round3(d.AFT_CYPSD * d.SUPP_LWPSD),
CD_TWAFT_K3_READ: d => +op.round3(d.AFT_CYK3 * 0.04),
CD_TWAFT_K3: d => +op.round3(d.AFT_CYK3 * 0.06),
CD_TWAFT_ELL: d => +op.round3(d.AFT_ELL * 0.115),
CD_TWAFT_SPED_1: d => +op.round3(d.AFT_SPED_1 * 4.771),
CD_TWAFT_SPED_2: d => +op.round3(d.AFT_SPED_2 * 6.024),
CD_TWAFT_SPED_3: d => +op.round3(d.AFT_SPED_3 * 5.833),
CD_TWAFT_SPED_4: d => +op.round3(d.AFT_SPED_4 * 7.947),
CD_TWAFT_SPED_5: d => +op.round3(d.AFT_SPED_5 * 3.158),
CD_TWAFT_SPED_6: d => +op.round3(d.AFT_SPED_6 * 6.773),
CD_TWAFT_SPED_7: d => +op.round3(d.AFT_SPED_7 * 3.595),
CD_TWAFT_SPED_8: d => +op.round3(d.AFT_SPED_8 * 0.003),
CD_TWAFT_SPED_9: d => +op.round3(d.AFT_SPED_9 * 4.822),
CD_TWAFT_SPED_10: d => +op.round3(d.AFT_SPED_10 * 4.421),
CD_TWAFT_SPED_11: d => +op.round3(d.AFT_SPED_11 * 4.806),
CD_TWAPT_CYK8: d => +op.round3(d.APT_CYK8 * d.SUPP_LWK8),
CD_TWAPT_CY912: d => +op.round3(d.APT_CY912 * d.SUPP_LW912),
CD_TWAPT_CYPSD: d => +op.round3(d.APT_CYPSD * d.SUPP_LWPSD),
CD_TWAPT_K3_READ: d => +op.round3(d.APT_CYK3 * 0.04),
CD_TWAPT_K3: d => +op.round3(d.APT_CYK3 * 0.06),
CD_TWAPT_ELL: d => +op.round3(d.APT_ELL * 0.115),
CD_TWAPT_SPED_1: d => +op.round3(d.APT_SPED_1 * 4.771),
CD_TWAPT_SPED_2: d => +op.round3(d.APT_SPED_2 * 6.024),
CD_TWAPT_SPED_3: d => +op.round3(d.APT_SPED_3 * 5.833),
CD_TWAPT_SPED_4: d => +op.round3(d.APT_SPED_4 * 7.947),
CD_TWAPT_SPED_5: d => +op.round3(d.APT_SPED_5 * 3.158),
CD_TWAPT_SPED_6: d => +op.round3(d.APT_SPED_6 * 6.773),
CD_TWAPT_SPED_7: d => +op.round3(d.APT_SPED_7 * 3.595),
CD_TWAPT_SPED_8: d => +op.round3(d.APT_SPED_8 * 0.003),
CD_TWAPT_SPED_9: d => +op.round3(d.APT_SPED_9 * 4.822),
CD_TWAPT_SPED_10: d => +op.round3(d.APT_SPED_10 * 4.421),
CD_TWAPT_SPED_11: d => +op.round3(d.APT_SPED_11 * 4.806)
})
.derive({
CD_M_BSL: d => ((d.CD_TWINAS_CYK8 + d.CD_TWINAS_CY912 + d.CD_TWINAS_CYPSD +
d.CD_TWINAS_K3_READ + d.CD_TWINAS_K3 + d.CD_TWINAS_ELL +
d.CD_TWINAS_SPED_1 + d.CD_TWINAS_SPED_2 + d.CD_TWINAS_SPED_3 +
d.CD_TWINAS_SPED_4 + d.CD_TWINAS_SPED_5 + d.CD_TWINAS_SPED_6 +
d.CD_TWINAS_SPED_7 + d.CD_TWINAS_SPED_8 + d.CD_TWINAS_SPED_9 +
d.CD_TWINAS_SPED_10 + d.CD_TWINAS_SPED_11) * d.B_COST) +
((d.CD_TWAFT_CYK8 + d.CD_TWAFT_CY912 + d.CD_TWAFT_CYPSD +
d.CD_TWAFT_K3_READ + d.CD_TWAFT_K3 + d.CD_TWAFT_ELL +
d.CD_TWAFT_SPED_1 + d.CD_TWAFT_SPED_2 + d.CD_TWAFT_SPED_3 +
d.CD_TWAFT_SPED_4 + d.CD_TWAFT_SPED_5 + d.CD_TWAFT_SPED_6 +
d.CD_TWAFT_SPED_7 + d.CD_TWAFT_SPED_8 + d.CD_TWAFT_SPED_9 +
d.CD_TWAFT_SPED_10 + d.CD_TWAFT_SPED_11) * 0.95 * d.B_COST) +
((d.CD_TWAPT_CYK8 + d.CD_TWAPT_CY912 + d.CD_TWAPT_CYPSD +
d.CD_TWAPT_K3_READ + d.CD_TWAPT_K3 + d.CD_TWAPT_ELL +
d.CD_TWAPT_SPED_1 + d.CD_TWAPT_SPED_2 + d.CD_TWAPT_SPED_3 +
d.CD_TWAPT_SPED_4 + d.CD_TWAPT_SPED_5 + d.CD_TWAPT_SPED_6 +
d.CD_TWAPT_SPED_7 + d.CD_TWAPT_SPED_8 + d.CD_TWAPT_SPED_9 +
d.CD_TWAPT_SPED_10 + d.CD_TWAPT_SPED_11) * 0.85 * d.B_COST)
})
.derive({ CD_M_ADJ_BSL: d => d.CD_M_BSL * d.TEI})
.derive({
CD_BSL_BRCL: d => +d.CD_M_ADJ_BSL + +d.B_SUPP_ADJ,
CD_TSL_TF_SSL: d => +op.round2(d.TSL_TADRM * 180 * d.TSL_SSLRM)
})
.derive({
CD_TSL_ATS: d => +op.round2(d.CD_TSL_TF_SSL * d.TSL_ATF),
CD_TSL_HESYSL: d => d.TSL_HESYM * d.TSL_SSLRM
})
.derive({ CD_TSL_SL: d => +op.round2(+d.CD_TSL_TF_SSL + +d.CD_TSL_ATS + +d.CD_TSL_HESYSL + +d.TSL_AEBPT) })
.derive({ CD_TRCL_PRELIM: d => +op.round2(+d.CD_TSL_SL - +d.TRCL_TSL_2122 + +d.TRCL_2122) })
.derive({
CD_TRCL_23_TSL: d => +op.round2(d.CD_TSL_SL * 1.2)
})
.derive({
CD_TRCL_ADJ_23: d => +d.CD_TRCL_PRELIM > +d.CD_TRCL_23_TSL ? +d.TRCL_2122 : +d.CD_TRCL_PRELIM
})
.derive({
CD_TRCL_23: d => +d.CD_TSL_SL > +d.CD_TRCL_ADJ_23 ? +d.CD_TSL_SL : +d.CD_TRCL_ADJ_23
})
.derive({
CD_CALC_DSL: d => +op.round2(+d.CD_BSL_BRCL + +d.TRCL_23_CONS + +d.TRCL_TO + +d.CD_TSL_SL),
CD_CALC_RSL: d => +op.round2(+d.CD_BSL_BRCL + +d.TRCL_23_CONS + +d.TRCL_TO + +d.CD_TRCL_23),
CD_DAA_PSD: d => d.DAA_PSDC * d.DAA_PPSD,
CD_DAA_K8: d => d.DAA_K8C * d.DAA_K8,
CD_DAA_912: d => (+d.DAA_912C + +d.DAA_T3TOC) * d.DAA_912,
CD_DAAG_FACTOR: d => +op.round4(+d.DAAG_F23_ASC/+d.DAAG_F22_ASC)
})
.derive({
CD_DAAG_FACTOR_USE: d => +op.trunc(+op.round5(+op.trunc((+d.CD_DAAG_FACTOR <= 1.05 ? 1 :(+d.CD_DAAG_FACTOR-1)/2 + 1) * 1e6) / 1e6) * 1e4)/1e4
})
.derive({
CD_DAAG_PSD_ADJ_FUND: d => d.CD_DAAG_FACTOR_USE * d.CD_DAA_PSD,
CD_DAAG_K8_ADJ_FUND: d => +op.round2(d.CD_DAAG_FACTOR_USE * d.CD_DAA_K8),
CD_DAAG_912_ADJ_FUND: d => +op.round2(d.CD_DAAG_FACTOR_USE * d.CD_DAA_912)
})
.derive({
CD_DAA_HS_TEXT: d => +op.round2(+d.DAAHS_AMOUNT),
CD_2021_PSD8_DAA_BASE: d => (+d.CD_DAAG_PSD_ADJ_FUND + +d.CD_DAAG_K8_ADJ_FUND + +d.DAAA_PSD8_ADJ)
})
.derive({
CD_2021_912_DAA_BASE: d => +op.round2(+d.CD_DAAG_912_ADJ_FUND + +d.CD_DAA_HS_TEXT + +d.DAAA_912_ADJ),
CD_EB_LESSER_RCLDSL: d => +d.CD_CALC_DSL < +d.CD_CALC_RSL ? +d.CD_CALC_DSL : +d.CD_CALC_RSL,
CD_EB_PSD8: d => (((+d.NAOI_CYK8 + +d.AFT_CYK8 + +d.APT_CYK8) * +d.SUPP_LWK8) + ((+d.NAOI_CYPSD + +d.AFT_CYPSD + +d.APT_CYPSD) * +d.SUPP_LWPSD)),
CD_EB_912: d => (((+d.NAOI_CY912 + +d.AFT_CY912 + +d.APT_CY912) * +d.SUPP_LW912))
})
.derive({
CD_EB_PSD8_PCT: d => +op.round4(+d.CD_EB_PSD8 / (+d.CD_EB_PSD8 + +d.CD_EB_912)),
CD_EB_912_PCT: d => +op.round4(+d.CD_EB_912 / (+d.CD_EB_PSD8 + +d.CD_EB_912))
})
.derive({
CD_EB_RCLDCL_PSD8: d => +op.round2(+d.CD_EB_LESSER_RCLDSL * +d.CD_EB_PSD8_PCT) - +d.TRCL_TO,
CD_EB_RCLDCL_912: d => +op.round2(+d.CD_EB_LESSER_RCLDSL * +d.CD_EB_912_PCT),
CD_QUAL_LEVY: d => +op.round2((+d.TAX_PAV1 + +d.TAX_PRIMARY + +d.TAX_SR + +d.TAX_GPLET)/100 * +d.TAX_RATE)
})
.derive({
CD_EA_PSD8: d => +op.round2((+d.CD_2021_PSD8_DAA_BASE + +d.CD_EB_RCLDCL_PSD8 - +d.CD_QUAL_LEVY) < 0 ? 0 : (+d.CD_2021_PSD8_DAA_BASE + +d.CD_EB_RCLDCL_PSD8 - +d.CD_QUAL_LEVY)),
CD_EA_912: d => +op.round2((+d.CD_2021_912_DAA_BASE + +d.CD_EB_RCLDCL_912 - +d.CD_QUAL_LEVY + +d.TRCL_TO) < 0 ? 0 : (+d.CD_2021_912_DAA_BASE + +d.CD_EB_RCLDCL_912 - +d.CD_QUAL_LEVY + +d.TRCL_TO))
})
.select('ID', 'NAME', 'B_COST', 'CD_TWINAS_CYK8', 'CD_TWINAS_CY912', 'CD_TWINAS_CYPSD', 'CD_TWINAS_K3_READ', 'CD_TWINAS_K3', 'CD_TWINAS_ELL', 'CD_TWINAS_SPED_1', 'CD_TWINAS_SPED_2', 'CD_TWINAS_SPED_3', 'CD_TWINAS_SPED_4', 'CD_TWINAS_SPED_5', 'CD_TWINAS_SPED_6', 'CD_TWINAS_SPED_7', 'CD_TWINAS_SPED_8', 'CD_TWINAS_SPED_9', 'CD_TWINAS_SPED_10', 'CD_TWINAS_SPED_11', 'CD_TWAFT_CYK8', 'CD_TWAFT_CY912', 'CD_TWAFT_CYPSD', 'CD_TWAFT_K3_READ', 'CD_TWAFT_K3', 'CD_TWAFT_ELL', 'CD_TWAFT_SPED_1', 'CD_TWAFT_SPED_2', 'CD_TWAFT_SPED_3', 'CD_TWAFT_SPED_4', 'CD_TWAFT_SPED_5', 'CD_TWAFT_SPED_6', 'CD_TWAFT_SPED_7', 'CD_TWAFT_SPED_8', 'CD_TWAFT_SPED_9', 'CD_TWAFT_SPED_10', 'CD_TWAFT_SPED_11', 'CD_TWAPT_CYK8', 'CD_TWAPT_CY912', 'CD_TWAPT_CYPSD', 'CD_TWAPT_K3_READ', 'CD_TWAPT_K3', 'CD_TWAPT_ELL', 'CD_TWAPT_SPED_1', 'CD_TWAPT_SPED_2', 'CD_TWAPT_SPED_3', 'CD_TWAPT_SPED_4', 'CD_TWAPT_SPED_5', 'CD_TWAPT_SPED_6', 'CD_TWAPT_SPED_7', 'CD_TWAPT_SPED_8', 'CD_TWAPT_SPED_9', 'CD_TWAPT_SPED_10', 'CD_TWAPT_SPED_11',
'CD_M_BSL', 'CD_M_ADJ_BSL', 'CD_BSL_BRCL', 'CD_TSL_TF_SSL', 'CD_TSL_ATS', 'CD_TSL_HESYSL', 'CD_TSL_SL', 'CD_TRCL_PRELIM', 'CD_TRCL_23_TSL', 'CD_TRCL_ADJ_23', 'CD_TRCL_23', 'CD_CALC_DSL', 'CD_CALC_RSL', 'CD_DAA_PSD', 'CD_DAA_K8', 'CD_DAA_912', 'CD_DAAG_FACTOR', 'CD_DAAG_FACTOR_USE', 'CD_DAAG_PSD_ADJ_FUND', 'CD_DAAG_K8_ADJ_FUND', 'CD_DAAG_912_ADJ_FUND',
'CD_DAA_HS_TEXT', 'CD_2021_PSD8_DAA_BASE', 'CD_2021_912_DAA_BASE', 'CD_EB_LESSER_RCLDSL', 'CD_EB_PSD8', 'CD_EB_912', 'CD_EB_PSD8_PCT', 'CD_EB_912_PCT', 'CD_EB_RCLDCL_PSD8', 'CD_EB_RCLDCL_912', 'CD_QUAL_LEVY', 'CD_EA_PSD8', 'CD_EA_912', 'TRCL_TO')
.objects();
currentDistrictsData;
modeledDistrictsData = aq.from(tempDistrictsData)
.params({teacherCompAdj: 1,
baseLevelAmount: 1,
teacherExpIndex: 1,
k3Reading: 1,
k3: 1,
ell: 1,
sped1: 1,
sped2: 1,
sped3: 1,
sped4: 1,
sped5: 1,
sped6: 1,
sped7: 1,
sped8: 1,
sped9: 1,
sped10: 1,
sped11: 1,
msWeight: 1})
.derive({ TeacherCompAdj: (d, $) => $.teacherCompAdj == true ? 1.0125 : 1})
.derive({ MD_B_COST_Temp: (d, $) => +op.round2(+d.TCAI == 1 ? $.baseLevelAmount * +d.TeacherCompAdj : $.baseLevelAmount) })
.derive({ MD_B_COST: d => d.NAME === "Pima County Accommodation School District" ? 4577.53 : +d.MD_B_COST_Temp })
.derive({
TRCL_23_CONS: d => 0,
})
.derive({
MD_TWINAS_CYK8: d => +op.round3(+d.NAOI_CYK8 * +d.SUPP_LWK8),
MD_TWINAS_CY912: d => +op.round3(+d.NAOI_CY912 * +d.SUPP_LW912),
MD_TWINAS_CYPSD: d => +op.round3(+d.NAOI_CYPSD * +d.SUPP_LWPSD),
MD_TWINAS_K3_READ: (d, $) => +op.round3(+d.NAOI_CYK3 * $.k3Reading),
MD_TWINAS_K3: (d, $) => +op.round3(+d.NAOI_CYK3 * $.k3),
MD_TWINAS_ELL: (d, $) => +op.round3(+d.NAOI_ELL * $.ell),
MD_TWINAS_SPED_1: (d, $) => +op.round3(+d.NAOI_SPED_1 * $.sped1),
MD_TWINAS_SPED_2: (d, $) => +op.round3(+d.NAOI_SPED_2 * $.sped2),
MD_TWINAS_SPED_3: (d, $) => +op.round3(+d.NAOI_SPED_3 * $.sped3),
MD_TWINAS_SPED_4: (d, $) => +op.round3(+d.NAOI_SPED_4 * $.sped4),
MD_TWINAS_SPED_5: (d, $) => +op.round3(+d.NAOI_SPED_5 * $.sped5),
MD_TWINAS_SPED_6: (d, $) => +op.round3(+d.NAOI_SPED_6 * $.sped6),
MD_TWINAS_SPED_7: (d, $) => +op.round3(+d.NAOI_SPED_7 * $.sped7),
MD_TWINAS_SPED_8: (d, $) => +op.round3(+d.NAOI_SPED_8 * $.sped8),
MD_TWINAS_SPED_9: (d, $) => +op.round3(+d.NAOI_SPED_9 * $.sped9),
MD_TWINAS_SPED_10: (d, $) => +op.round3(+d.NAOI_SPED_10 * $.sped10),
MD_TWINAS_SPED_11: (d, $) => +op.round3(+d.NAOI_SPED_11 * $.sped11)
})
.derive({
MD_TWAFT_CYK8: d => +op.round3(+d.AFT_CYK8 * +d.SUPP_LWK8),
MD_TWAFT_CY912: d => +op.round3(+d.AFT_CY912 * +d.SUPP_LW912),
MD_TWAFT_CYPSD: d => +op.round3(+d.AFT_CYPSD * +d.SUPP_LWPSD),
MD_TWAFT_K3_READ: (d, $) => +op.round3(+d.AFT_CYK3 * $.k3Reading),
MD_TWAFT_K3: (d, $) => +op.round3(+d.AFT_CYK3 * $.k3),
MD_TWAFT_ELL: (d, $) => +op.round3(+d.AFT_ELL * $.ell),
MD_TWAFT_SPED_1: (d, $) => +op.round3(+d.AFT_SPED_1 * $.sped1),
MD_TWAFT_SPED_2: (d, $) => +op.round3(+d.AFT_SPED_2 * $.sped2),
MD_TWAFT_SPED_3: (d, $) => +op.round3(+d.AFT_SPED_3 * $.sped3),
MD_TWAFT_SPED_4: (d, $) => +op.round3(+d.AFT_SPED_4 * $.sped4),
MD_TWAFT_SPED_5: (d, $) => +op.round3(+d.AFT_SPED_5 * $.sped5),
MD_TWAFT_SPED_6: (d, $) => +op.round3(+d.AFT_SPED_6 * $.sped6),
MD_TWAFT_SPED_7: (d, $) => +op.round3(+d.AFT_SPED_7 * $.sped7),
MD_TWAFT_SPED_8: (d, $) => +op.round3(+d.AFT_SPED_8 * $.sped8),
MD_TWAFT_SPED_9: (d, $) => +op.round3(+d.AFT_SPED_9 * $.sped9),
MD_TWAFT_SPED_10: (d, $) => +op.round3(+d.AFT_SPED_10 * $.sped10),
MD_TWAFT_SPED_11: (d, $) => +op.round3(+d.AFT_SPED_11 * $.sped11)
})
.derive({
MD_TWAPT_CYK8: d => +op.round3(+d.APT_CYK8 * +d.SUPP_LWK8),
MD_TWAPT_CY912: d => +op.round3(+d.APT_CY912 * +d.SUPP_LW912),
MD_TWAPT_CYPSD: d => +op.round3(+d.APT_CYPSD * +d.SUPP_LWPSD),
MD_TWAPT_K3_READ: (d, $) => +op.round3(+d.APT_CYK3 * $.k3Reading),
MD_TWAPT_K3: (d, $) => +op.round3(+d.APT_CYK3 * $.k3),
MD_TWAPT_ELL: (d, $) => +op.round3(+d.APT_ELL * $.ell),
MD_TWAPT_SPED_1: (d, $) => +op.round3(+d.APT_SPED_1 * $.sped1),
MD_TWAPT_SPED_2: (d, $) => +op.round3(+d.APT_SPED_2 * $.sped2),
MD_TWAPT_SPED_3: (d, $) => +op.round3(+d.APT_SPED_3 * $.sped3),
MD_TWAPT_SPED_4: (d, $) => +op.round3(+d.APT_SPED_4 * $.sped4),
MD_TWAPT_SPED_5: (d, $) => +op.round3(+d.APT_SPED_5 * $.sped5),
MD_TWAPT_SPED_6: (d, $) => +op.round3(+d.APT_SPED_6 * $.sped6),
MD_TWAPT_SPED_7: (d, $) => +op.round3(+d.APT_SPED_7 * $.sped7),
MD_TWAPT_SPED_8: (d, $) => +op.round3(+d.APT_SPED_8 * $.sped8),
MD_TWAPT_SPED_9: (d, $) => +op.round3(+d.APT_SPED_9 * $.sped9),
MD_TWAPT_SPED_10: (d, $) => +op.round3(+d.APT_SPED_10 * $.sped10),
MD_TWAPT_SPED_11: (d, $) => +op.round3(+d.APT_SPED_11 * $.sped11)
})
.derive({
MD_M_BSL: d => (+op.round3(+d.MD_TWINAS_CYK8 + +d.MD_TWINAS_CY912 + +d.MD_TWINAS_CYPSD +
+d.MD_TWINAS_K3_READ + +d.MD_TWINAS_K3 + +d.MD_TWINAS_ELL +
+d.MD_TWINAS_SPED_1 + +d.MD_TWINAS_SPED_2 + +d.MD_TWINAS_SPED_3 +
+d.MD_TWINAS_SPED_4 + +d.MD_TWINAS_SPED_5 + +d.MD_TWINAS_SPED_6 +
+d.MD_TWINAS_SPED_7 + +d.MD_TWINAS_SPED_8 + +d.MD_TWINAS_SPED_9 +
+d.MD_TWINAS_SPED_10 + +d.MD_TWINAS_SPED_11) * +d.MD_B_COST) +
(+op.round3(+d.MD_TWAFT_CYK8 + +d.MD_TWAFT_CY912 + +d.MD_TWAFT_CYPSD +
+d.MD_TWAFT_K3_READ + +d.MD_TWAFT_K3 + +d.MD_TWAFT_ELL +
+d.MD_TWAFT_SPED_1 + +d.MD_TWAFT_SPED_2 + +d.MD_TWAFT_SPED_3 +
+d.MD_TWAFT_SPED_4 + +d.MD_TWAFT_SPED_5 + +d.MD_TWAFT_SPED_6 +
+d.MD_TWAFT_SPED_7 + +d.MD_TWAFT_SPED_8 + +d.MD_TWAFT_SPED_9 +
+d.MD_TWAFT_SPED_10 + +d.MD_TWAFT_SPED_11) * 0.95 * +d.MD_B_COST) +
(+op.round3(+d.MD_TWAPT_CYK8 + +d.MD_TWAPT_CY912 + +d.MD_TWAPT_CYPSD +
+d.MD_TWAPT_K3_READ + +d.MD_TWAPT_K3 + +d.MD_TWAPT_ELL +
+d.MD_TWAPT_SPED_1 + +d.MD_TWAPT_SPED_2 + +d.MD_TWAPT_SPED_3 +
+d.MD_TWAPT_SPED_4 + +d.MD_TWAPT_SPED_5 + +d.MD_TWAPT_SPED_6 +
+d.MD_TWAPT_SPED_7 + +d.MD_TWAPT_SPED_8 + +d.MD_TWAPT_SPED_9 +
+d.MD_TWAPT_SPED_10 + +d.MD_TWAPT_SPED_11) * 0.85 * +d.MD_B_COST)
})
.derive({ MD_M_ADJ_BSL: (d, $) => $.teacherExpIndex == true ? +d.MD_M_BSL * +d.TEI : +d.MD_M_BSL })
.derive({
MD_BSL_BRCL: d => +d.MD_M_ADJ_BSL + +d.B_SUPP_ADJ,
MD_TSL_TF_SSL: d => +op.round2(+d.TSL_TADRM * 180 * +d.TSL_SSLRM)
})
.derive({
MD_TSL_ATS: d => +op.round2(+d.MD_TSL_TF_SSL * +d.TSL_ATF),
MD_TSL_HESYSL: d => +d.TSL_HESYM * +d.TSL_SSLRM
})
.derive({ MD_TSL_SL: d => +op.round2(+d.MD_TSL_TF_SSL + +d.MD_TSL_ATS + +d.MD_TSL_HESYSL + +d.TSL_AEBPT)})
.derive({
MD_TRCL_PRELIM: d => +op.round2(+d.MD_TSL_SL - + d.TRCL_TSL_2122 + +d.TRCL_2122),
MD_TRCL_23_TSL: d => +op.round2(+d.MD_TSL_SL * 1.2)
})
.derive({ MD_TRCL_ADJ_23: d => +d.MD_TRCL_PRELIM > +d.MD_TRCL_23_TSL ? +d.TRCL_2122 : +d.MD_TRCL_PRELIM})
.derive({ MD_TRCL_23: d => +d.MD_TSL_SL > +d.MD_TRCL_ADJ_23 ? +d.MD_TSL_SL : +d.MD_TRCL_ADJ_23})
.derive({
MD_CALC_DSL: d => +op.round2(+d.MD_BSL_BRCL + +d.TRCL_23_CONS + +d.TRCL_TO + +d.MD_TSL_SL),
MD_CALC_RSL: d => +op.round2(+d.MD_BSL_BRCL + +d.TRCL_23_CONS + +d.TRCL_TO + +d.MD_TRCL_23),
MD_DAA_PSD: d => +d.DAA_PSDC * +d.DAA_PPSD,
MD_DAA_K8: d => +d.DAA_K8C * +d.DAA_K8
})
.derive({
MD_DAA_912: d => (+d.DAA_912C + +d.DAA_T3TOC) * +d.DAA_912,
MD_DAAG_FACTOR: d => +op.round4(+d.DAAG_F23_ASC/+d.DAAG_F22_ASC)
})
.derive({
MD_DAAG_FACTOR_USE: d => +op.trunc(+op.round5(+op.trunc((+d.MD_DAAG_FACTOR <= 1.05 ? 1 :(+d.MD_DAAG_FACTOR-1)/2 + 1) * 1e6) / 1e6) * 1e4)/1e4
})
.derive({
MD_DAAG_PSD_ADJ_FUND: d => +d.MD_DAAG_FACTOR_USE * +d.MD_DAA_PSD,
MD_DAAG_K8_ADJ_FUND: d => +op.round2(+d.MD_DAA_K8 * +d.MD_DAAG_FACTOR_USE),
MD_DAAG_912_ADJ_FUND: d => +op.round2(+d.MD_DAA_912 * +d.MD_DAAG_FACTOR_USE),
MD_DAA_HS_TEXT: d => +op.round2(+d.DAAHS_AMOUNT)
})
.derive({
MD_2021_PSD8_DAA_BASE: d => +d.MD_DAAG_PSD_ADJ_FUND + +d.MD_DAAG_K8_ADJ_FUND + +d.DAAA_PSD8_ADJ,
MD_2021_912_DAA_BASE: d => +d.MD_DAAG_912_ADJ_FUND + +d.MD_DAA_HS_TEXT + +d.DAAA_912_ADJ,
MD_EB_LESSER_RCLDSL: d => +d.MD_CALC_DSL < +d.MD_CALC_RSL ? +d.MD_CALC_DSL : +d.MD_CALC_RSL,
MD_EB_PSD8: d => ((+d.NAOI_CYK8 + +d.AFT_CYK8 + +d.APT_CYK8) * +d.SUPP_LWK8) + ((+d.NAOI_CYPSD + +d.AFT_CYPSD + +d.APT_CYPSD) * +d.SUPP_LWPSD),
MD_EB_912: d => ((+d.NAOI_CY912 + +d.AFT_CY912 + +d.APT_CY912) * +d.SUPP_LW912)
})
.derive({
MD_EB_PSD8_PCT: d => +op.round4(+d.MD_EB_PSD8/(+d.MD_EB_PSD8 + +d.MD_EB_912)),
MD_EB_912_PCT: d => +op.round4(+d.MD_EB_912/(+d.MD_EB_PSD8 + +d.MD_EB_912))
})
.derive({
MD_EB_RCLDCL_PSD8: d => +op.round2(+d.MD_EB_LESSER_RCLDSL * +d.MD_EB_PSD8_PCT) - +d.TRCL_TO,
MD_EB_RCLDCL_912: d => +op.round2(+d.MD_EB_LESSER_RCLDSL * +d.MD_EB_912_PCT),
MD_QUAL_LEVY: d => +op.round2((+d.TAX_PAV1 + +d.TAX_PRIMARY + +d.TAX_SR + +d.TAX_GPLET)/100 * +d.TAX_RATE)
})
.derive({
MD_EA_PSD8: d => +op.round2(+d.MD_2021_PSD8_DAA_BASE + +d.MD_EB_RCLDCL_PSD8 - +d.MD_QUAL_LEVY < 0 ? 0 : +d.MD_2021_PSD8_DAA_BASE + +d.MD_EB_RCLDCL_PSD8 - +d.MD_QUAL_LEVY),
MD_EA_912: d => +op.round2(+d.MD_EB_RCLDCL_912 + +d.MD_2021_912_DAA_BASE - +d.MD_QUAL_LEVY + +d.TRCL_TO < 0 ? 0 : +d.MD_EB_RCLDCL_912 + +d.MD_2021_912_DAA_BASE - +d.MD_QUAL_LEVY + +d.TRCL_TO),
ADM: d => +d.NAOI_CYPSD + +d.NAOI_CYK8 + +d.NAOI_CY912 + +d.AFT_CYPSD + +d.AFT_CYK8 + +d.AFT_CY912 + +d.APT_CYPSD + +d.APT_CYK8 + +d.APT_CY912
})
.select('ID', 'NAME', 'TeacherCompAdj', 'MD_B_COST', 'MD_TWINAS_CYK8', 'MD_TWINAS_CY912', 'MD_TWINAS_CYPSD',
'MD_TWINAS_K3_READ', 'MD_TWINAS_K3', 'MD_TWINAS_ELL', 'MD_TWINAS_SPED_1', 'MD_TWINAS_SPED_2', 'MD_TWINAS_SPED_3',
'MD_TWINAS_SPED_4', 'MD_TWINAS_SPED_5', 'MD_TWINAS_SPED_6', 'MD_TWINAS_SPED_7', 'MD_TWINAS_SPED_8', 'MD_TWINAS_SPED_9', 'MD_TWINAS_SPED_10', 'MD_TWINAS_SPED_11', 'MD_M_BSL', 'MD_M_ADJ_BSL', 'MD_BSL_BRCL', 'MD_TSL_TF_SSL', 'MD_TSL_ATS', 'MD_TSL_HESYSL', 'MD_TSL_SL', 'MD_TRCL_PRELIM', 'MD_TRCL_23_TSL', 'MD_TRCL_ADJ_23', 'MD_TRCL_23', 'MD_CALC_DSL', 'MD_CALC_RSL', 'MD_DAA_PSD', 'MD_DAA_K8', 'MD_DAA_912', 'MD_DAAG_FACTOR', 'MD_DAAG_FACTOR_USE', 'MD_DAAG_PSD_ADJ_FUND', 'MD_DAAG_K8_ADJ_FUND', 'MD_DAAG_912_ADJ_FUND', 'MD_DAA_HS_TEXT', 'MD_2021_PSD8_DAA_BASE', 'MD_2021_912_DAA_BASE', 'MD_EB_LESSER_RCLDSL', 'MD_EB_PSD8', 'MD_EB_912', 'MD_EB_PSD8_PCT', 'MD_EB_912_PCT', 'MD_EB_RCLDCL_PSD8', 'MD_EB_RCLDCL_912', 'MD_QUAL_LEVY', 'MD_EA_PSD8', 'MD_EA_912', 'TRCL_TO', 'ADM', 'NAOI_CYK8', 'NAOI_CY912')
.objects();
modeledDistrictsData;
currentSummary = aq.from(currentDistrictsData)
.derive({
current_equalization_base: d => (d.CD_EB_RCLDCL_PSD8 + d.CD_EB_RCLDCL_912 + d.CD_2021_PSD8_DAA_BASE + d.CD_2021_912_DAA_BASE + +d.TRCL_TO),
current_equalization_assistance: d => (d.CD_EA_PSD8 + d.CD_EA_912)
})
.select("ID", "NAME", "current_equalization_base", "current_equalization_assistance")
.objects();
modeledSummary = aq.from(modeledDistrictsData)
.derive({
modeled_equalization_base: d => (d.MD_EB_RCLDCL_PSD8 + d.MD_EB_RCLDCL_912 + d.MD_2021_PSD8_DAA_BASE + d.MD_2021_912_DAA_BASE + +d.TRCL_TO),
modeled_equalization_assistance: d => (d.MD_EA_PSD8 + d.MD_EA_912),
NAOI_CYK8: d => +d.NAOI_CYK8,
NAOI_CY912: d => +d.NAOI_CY912
})
.select("ID", "NAME", "modeled_equalization_base", "modeled_equalization_assistance", "MD_TRCL_23", "MD_TSL_SL", "ADM", "NAOI_CYK8", "NAOI_CY912")
.objects();
districtsSummary = aq.from(currentSummary)
.join_left(aq.from(modeledSummary), [["ID", "NAME"], ["ID", "NAME"]])
.objects();
localRevenue = FileAttachment("data/arizona/local_revenue.csv").csv();
trclData = aq.from(districtsSummary)
.select("ID", "NAME", "MD_TRCL_23", "MD_TSL_SL", "modeled_equalization_assistance", "current_equalization_assistance", "modeled_equalization_base", "current_equalization_base", "ADM")
completeDistrictSummaryTemp = aq.from(localRevenue)
.join_left(trclData, [["ID"], ["ID"]])
.derive({
AdjacentWays: d => +d["Adjacent Ways"],
CSF_IIF: d => +d["Classroom Site & Ins Improv Funds-CSF & IIF"],
DebtService: d => +d["Debt Service"],
MaintenanceOperations: d => +d["Maintenance & Operations (M&O)"],
OtherRevenue: d => +d["Other: See Definitions for Description"],
SchoolFacilities: d => +d["School Facilities"],
UnrestrictedCapitalOutlay: d => +d["Unrestricted Capital Outlay"]
})
.params({
// adjacentWays: adjacentWays,
// CSFIIF: CSFIIF,
// debtService: debtService,
// MO: MO,
// otherRevenue: otherRevenue,
// schoolFacilities: schoolFacilities,
// capitalOutlay: capitalOutlay,
// TRCL: true
})
.derive({
adj_way: d => true ? d.AdjacentWays : 0 ,
csf_iif: d => true ? d.CSF_IIF : 0 ,
dev_serv: d => true ? d.DebtService : 0 ,
other_rev: d => true ? d.OtherRevenue : 0 ,
sch_fac: d => true ? d.SchoolFacilities : 0 ,
unres_cap_out: d => true ? d.UnrestrictedCapitalOutlay : 0,
trcl: d => true ? (+d.MD_TRCL_23 - +d.MD_TSL_SL) : 0
})
.derive({
maint_op: d => true ? (d.MaintenanceOperations - (+d.MD_TRCL_23 - +d.MD_TSL_SL)) : 0 ,
})
.derive({
total_local_revenue: d => d.adj_way + d.csf_iif + d.dev_serv + d.maint_op + d.other_rev + d.sch_fac + d.unres_cap_out + d.trcl
})
.derive({
total_available_modeled: d => d.modeled_equalization_assistance + d.total_local_revenue,
total_available_current: d => d.current_equalization_assistance + d.AdjacentWays + d.CSF_IIF + d.DebtService + d.MaintenanceOperations + d.OtherRevenue + d.SchoolFacilities + d.UnrestrictedCapitalOutlay,
equalization_base_modeled: d => d.modeled_equalization_base,
equalization_base_current: d => d.current_equalization_base,
equalization_assistance_modeled: d => d.modeled_equalization_assistance,
equalization_assistance_current: d => d.current_equalization_assistance
})
.objects();
completeDistrictSummary = {
if (perPupilTotal.optradio == "0") {
return aq.from(completeDistrictSummaryTemp)
.derive({
total_available_modeled: d => d.total_available_modeled / d.ADM,
total_available_current: d => d.total_available_current / d.ADM,
equalization_base_modeled: d => d.equalization_base_modeled / d.ADM,
equalization_base_current: d => d.equalization_base_current / d.ADM,
equalization_assistance_modeled: d => d.equalization_assistance_modeled / d.ADM,
equalization_assistance_current: d => d.equalization_assistance_current / d.ADM
})
.derive({
total_available_difference: d => d.total_available_modeled / d.total_available_current - 1,
equalization_base_difference: d => d.equalization_base_modeled / d.equalization_base_current - 1,
equalization_assistance_difference: d => d.equalization_assistance_current === 0 ? 0 : d.equalization_assistance_modeled / d.equalization_assistance_current - 1
})
.select("ID", "NAME", "total_available_modeled", "total_available_current", "equalization_base_modeled", "equalization_base_current", "equalization_assistance_modeled", "equalization_assistance_current", "total_available_difference", "equalization_base_difference", "equalization_assistance_difference", "ADM")
.objects();
} else {
return aq.from(completeDistrictSummaryTemp)
.derive({
total_available_difference: d => d.total_available_modeled / d.total_available_current - 1,
equalization_base_difference: d => d.equalization_base_modeled / d.equalization_base_current - 1,
equalization_assistance_difference: d => d.equalization_assistance_current === 0 ? 0 : d.equalization_assistance_modeled / d.equalization_assistance_current - 1
})
.select("ID", "NAME", "total_available_modeled", "total_available_current", "equalization_base_modeled", "equalization_base_current", "equalization_assistance_modeled", "equalization_assistance_current", "total_available_difference", "equalization_base_difference", "equalization_assistance_difference", "ADM")
.objects();
}
}
aq = {
const aq = await require(`arquero@${aq_version}`);
// load and install any additional packages
(await Promise.all(aq_packages.map(pkg => require(pkg))))
.forEach(pkg => aq.addPackage(pkg));
// Add HTML table view method to tables
aq.addTableMethod('view', toView, { override: true });
return aq;
};
aq_version = "5.1.0";
aq_packages = [];
op = aq.op;
toView = {
const DEFAULT_LIMIT = 100;
const DEFAULT_NULL = value => `<span style="color: #999;">${value}</span>`;
const tableStyle = 'margin: 0; border-collapse: collapse; width: initial;';
const cellStyle = 'padding: 1px 5px; white-space: nowrap; overflow-x: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums;';
// extend table prototype to provide an HTML table view
return function(dt, opt = {}) {
// permit shorthand for limit
if (typeof opt === 'number') opt = { limit: opt };
// marshal cell color options
const color = { ...opt.color };
if (typeof opt.color === 'function') {
// if function, apply to all columns
dt.columnNames().forEach(name => color[name] = opt.color);
} else {
// otherwise, gather per-column color options
for (const key in color) {
const value = color[key];
color[key] = typeof value === 'function' ? value : () => value;
}
}
// marshal CSS styles as toHTML() options
const table = `${tableStyle}`;
const td = (name, index, row) => {
return `${cellStyle} max-width: ${+opt.maxCellWidth || 300}px;`
+ (color[name] ? ` background-color: ${color[name](index, row)};` : '');
};
opt = {
limit: DEFAULT_LIMIT,
null: DEFAULT_NULL,
...opt,
style: { table, td, th: td }
};
// return container div, bind table value to support viewof operator
const size = `max-height: ${+opt.height || 270}px`;
const style = `${size}; overflow-x: auto; overflow-y: auto;`;
const view = html`<div style="${style}">${dt.toHTML(opt)}</div>`;
view.value = dt;
return view;
};
};
function formValue(form) {
const object = {};
for (const input of form.elements) {
if (input.disabled || !input.hasAttribute("name")) continue;
let value = input.value;
switch (input.type) {
case "range":
case "number": {
value = input.valueAsNumber;
break;
}
case "date": {
value = input.valueAsDate;
break;
}
case "radio": {
if (!input.checked) continue;
break;
}
case "checkbox": {
if (input.checked) value = true;
else if (input.name in object) continue;
else value = false;
break;
}
case "file": {
value = input.multiple ? input.files : input.files[0];
break;
}
case "select-multiple": {
value = Array.from(input.selectedOptions, option => option.value);
break;
}
}
object[input.name] = value;
}
return object;
}
function form(form) {
const container = html`<div>${form}`;
form.addEventListener("submit", event => event.preventDefault());
form.addEventListener("change", () => container.dispatchEvent(new CustomEvent("input")));
form.addEventListener("input", () => container.value = formValue(form));
container.value = formValue(form);
return container
}