Initial Python Backend Scaffolding: database setup, models, error handling and two endpoints#4
Conversation
… onboarding docs - Set up FastAPI backend for Movies API - Implement create_success_response and create_error_response utils - Add MongoDB error mapper and global exception handler - Add .gitignore for Python, FastAPI, MongoDB data - Write detailed onboarding Readme with setup, FastAPI leaning and project mapping - Verified parity with TS response formatting and error handling
cbullinger
left a comment
There was a problem hiding this comment.
a couple minor things. and I'm not familiar with Pydantic/Fast API, so apologies for any naive questions/comments.
| if genre: | ||
| filter["genres"] = {"$regex": genre, "$options": "i"} | ||
| if year: | ||
| # I personally got some dirty data in the year field, a 1995è. Should we guard against this? |
There was a problem hiding this comment.
sounds reasonable to me. and i'll pass that on re: the dirty data; seems like something we should clean up in the actual sample database
There was a problem hiding this comment.
the bad data in the year field is now on Docs' radar, btw. not sure when it'll be cleaned up, though.
The current mflix db has years with special chars within them. This fix strips all non-digit chars from the year field or sets the year field to none of the string is empty. Typos, spacing, and renaming addressed as well. Removed error msg handling explanation.
cbullinger
left a comment
There was a problem hiding this comment.
Non-blocking comments and some questions re: requirements.txt.
| # Guarding against the dirty data in the year field. | ||
| if "year" in movie and not isinstance(movie["year"], int): | ||
| cleaned_year = re.sub(r"\D", "", str(movie["year"])) | ||
| try: | ||
| movie["year"] = int(cleaned_year) if cleaned_year else None |
There was a problem hiding this comment.
[suggestion] maybe revise the wording to be more diplomatic 😅 (depending on when the sample dataset is updated, we might be able to remove this entirely before release)
| # Guarding against the dirty data in the year field. | |
| if "year" in movie and not isinstance(movie["year"], int): | |
| cleaned_year = re.sub(r"\D", "", str(movie["year"])) | |
| try: | |
| movie["year"] = int(cleaned_year) if cleaned_year else None | |
| # Ensure that the year field contains int value. | |
| if "year" in movie and not isinstance(movie["year"], int): | |
| cleaned_year = re.sub(r"\D", "", str(movie["year"])) | |
| try: | |
| movie["year"] = int(cleaned_year) if cleaned_year else None |
- #1 Movie Cards: Make entire card clickable, enforce consistent heights, tone down checkbox - #2 Top Toolbar: Remove batch buttons, add contextual bottom selection bar - #3 Filters Bar: Replace mint/green with neutral gray borders and backgrounds - #4 Navbar: Remove full-width green border and animated underline effect - #5 Aggregations: Use light gray for row hover, tone down comment pills and show more button - Additional: Remove bright green border from aggregations section headers All changes improve visual hierarchy and reduce competing visual elements per reviewer feedback on PR #75.
This PR introduces the foundational backend structure for the Fast application. It sets up core configurations, database connectivity, error handling, and establishes the initial API endpoints.
Key Changes
Testing
Note: The readme was created to onboard another engineer, will not be included in the final version.