-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor backend school buildings data model capacity and enroll fields #625
Comments
One challenge with this data model is that an object does not clearly represent one single thing. The object is intended to represent one instance of a school (breaking down school building objects that have a combined As it stands, the data model includes original data about the school building itself ( If we wanted to clearly make this data object represent the school unit, it would only include these properties: {
org_id: 'K002',
level: 'is', // computed
enroll: 493, // computed
capacity: 669, // computed
} Here, the data object is clearly defined to represent a single real-world entity. Alternatively, if we maintained the data structure we get from the original datasets, but wanted to clearly represent it, it could look like this: {
org_id: 'K002',
org_level: 'PSIS',
hs_enroll: 0,
ms_enroll: 493,
ps_enroll: 198,
hs_capacity: 0,
ms_capacity: 669,
ps_capacity: 233,
} This would remove our computed / duplicative information in the data model, but would require us to refactor to have the application perform the multiplier calculations downstream (maybe near the frontend closer to where the multiplier calculations are performed. |
The compromise @trbmcginnis and I discussed was to maintain the existing data model, which wouldn't require a large refactor, but rename the calculated fields to make it more clear what they mean (in relation to the surrounding, redundant properties). We could just remove the unused |
The only places in the frontend app where we use
^^ this means that all |
capacity
, enroll
, and level
properties in CEQR school buildings data object
Currently in
backend/app/models/public_schools_analysis.rb
, if a school has anorg_level
property of "PSIS", we separate this one school into TWO schools, one for the PS version and one for the IS version. Both school objects will keep the sameorg_id
. Each school object has these properties by default:ps_capacity
,is_capacity
,hs_capacity
ANDps_enroll
,is_enroll
,hs_enroll
.The rails app currently assigns three new calculated properties to each school object:
level
: which will be "ps" for the PS school object and "is" for the IS school objectcapacity
: which will be theps_capacity
value for the PS object and theis_capacity
value for the IS objectenroll
: which will be theps_enroll
value for the PS object and theis_enroll
value for the IS objectISSUE: Having both
ps_capacity
andcapacity
properties is confusing. We were thinking of removing theps_capacity
,ps_enroll
,ms_capacity
,ms_enroll
etc. properties since in the frontend these properties aren't being used and are mainly just noise. We will still separate out mixed-level schools into two schools but each new object will only havelevel
,capacity
, andenroll
, making the object much shorter and more direct.How to implement:
NOTE: After EDM combines Bluebook and LCGMS school datasets we will have one CEQR school buildings dataset.
ps_capacity
andps_enroll
will have different names with EDM's new table.ps_enroll
andis_enroll
will becomepe
andie
respectively andps_capacity
andis_capacity
will becomepc
andic
respectively.Related to #484
The text was updated successfully, but these errors were encountered: