Closed mfekadu closed 4 years ago
The "good points of contact" section is a really great inclusion!
@mfekadu Does this Entity read in a CSV and populate the database as well? Is that what you meant by "make sure that the save_entity function properly saves a new OfficeHour"?
@chidiewenike
The latter. save_entity
has the job of actually persisting the data in the database.
insert_entity
and update_entity
A separate function to loop over a CSV and call the relevant functions (e.g. insert_entity
) may be necessary.
The end goal is we can do the following POST requests
@chidiewenike @cameron-toy
Could excalibur
be a good manual+automated tool to help us streamline getting new data from PDFs (curricula, office hours if mistakenly provided as PDF, etc)?
@mfekadu I added the csv to the DB manually and I created a barebones office hours entity class. Is there a way to test it with our DB to ensure that it pulls the information correctly?
Awesome, thanks @chidiewenike ! Have you created a pull request yet? Sooner is better than later.
There is an example of a database test here:
@Jason-Ku knows all about it. Jason, do you have any advice for Chidi?
Yeah! If you want to try and save your data to a test database you could add some code in the database_wrapper.py main method to manually run save_entity. There aren't any unittests to make sure that are you Entity was made correctly yet, (I'll probably work on that tomorrow)
@mfekadu I tried excalibur in the past for a different project and didn't have much luck with it, but success is probably dependent on how the table is represented in the PDF. It's worth a try.
@mfekadu Where should the abstracted save_office_hours function reside? The functions for the other "save_entity" functions reside within the db instantiation of the NimbusMySQLAlchemy class. Example here:
https://github.com/calpoly-csai/api/blob/7e24774fccc6f835c59c4b6d3414b79c1ba1fd0b/flask_api.py#L120-L130
At line 129, db.save_course(course)
is called for each course. Since this is now universally handled by the insert_entity function, should the code I have for processing the csv be abstracted in another function?
@chidiewenike
Feel free to just directly call the insert_entity
function because it will work and will be simple/direct.
However, you do bring up a good point that abstracting out a save_office_hours
function would offer better readability of the code.
The choice is yours 😄
@mfekadu Where should I store the abstracted out function? Keep it in flask_api.py or database_wrapper.py like the others?
Objective
Enhance the NimbusDatabase’s ability to answer questions like
Or even
The Computer Science department office will provide us with an excel file containing the latest office hours for each professor upon email as early as the 2nd week of each academic quarter.
Key Result
OfficeHour
save_entity
function properly saves a newOfficeHour
flask_api
endpoint tosave_office_hours
Details
Useful comment with similar code: https://github.com/calpoly-csai/api/pull/53#issuecomment-590121657
what the data looks like
good points of contact