-
Notifications
You must be signed in to change notification settings - Fork 1
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
Making database models for the Lokniti question data #18
Comments
In the lokniti-data branch, I started each model/serializer, and the codebook model is complete. Responders is in-progress. |
I looked at the csvs again, and I think "resno" is per state or some other combination of pc/ac/ps id. Regardless, we should still have the resno attribute of the model reflect what it is in the csv, since it is one of the fields on the document that people needed to fill out. Django automatically assigns a unique id to every object added to a table, so there isn't a need to assign an id attribute per respondent if it's just the row number. |
Codebook and Responders models are complete:
Some sketchy things I have noticed:
|
Great, thanks! I think you should add the attributes (null=True, blank=True) to all the fields in the csv that might be nan. That way, the attributes can be assigned |
Now that the codebook csv mapping question variables to question text #13 is finished, all the data needs to be added to the database in some easy-to-use format. Based on the structure of question response data, I propose we integrate the data across all years using three models: Some model representing an individual who responded ("Responder"), another model for each response of a "Responder" ("Responses"), and a model for the Codebook. For some more details about what each of the models should contain:
Each row of the main data contains information that uniquely identifies a person and their responses to the survey questions.
The Responder model consists of only personal information, such as a person's state name, IDs, age, status, etc. The question responses will be stored in the "Responses" table instead of with the particular responder.
The Responses model contains all the responses from each responder and has attributes storing the year, question variable name, a foreign key to the responder, and a foreign key to a codebook entry
The Codebook should contain the same attributes as the column names in the spreadsheet created from Make codebook for column names in lokniti question data #13 and can be created straightforwardly using the existing update_db command. Implementing this model first might make it easier to look up the variable name corresponding to the state name when creating the Responder model (each responder should have a state name attribute, although the variable name containing the state name varies from year to year).
We could have as many as three people working on this issue, each implementing one of the models above.
The text was updated successfully, but these errors were encountered: