Skip to content
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

🏗 Build Spider: Cincinnati Board of Education #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vsspnkkvr
Copy link

@vsspnkkvr vsspnkkvr commented Jan 1, 2025

What's this PR do?

This PR creates a new scraper for the Cincinnati Board of Education website at URL: https://go.boarddocs.com/oh/cps/Board.nsf/Public#tab-welcome

Why are we doing this?

Scraper requested from this spreadsheet.

Steps to manually test

  1. Ensure the project is installed:
pipenv sync --dev
  1. Activate the virtual env and enter the pipenv shell:
pipenv shell
  1. Run the spider:
scrapy crawl <spider-name> -O test_output.csv
  1. Monitor the output and ensure no errors are raised.

  2. Inspect test_output.csv to ensure the data looks valid.

Are there any smells or added technical debt to note?

It scrapes one of two API endpoints found after clicking on a meeting within the table.

Summary by CodeRabbit

  • New Features

    • Added a new spider for scraping Cincinnati Board of Education meeting data
    • Implemented comprehensive parsing of meeting details including titles, dates, and links
  • Tests

    • Created a robust test suite to validate the spider's data extraction and parsing capabilities
    • Added multiple test cases to ensure accurate meeting information retrieval

Copy link
Contributor

coderabbitai bot commented Jan 1, 2025

Walkthrough

A new spider for scraping Cincinnati Board of Education meeting data has been developed. The spider is designed to retrieve meeting information from an API endpoint, parse JSON responses, and extract relevant meeting details. It focuses on meetings within the last 12 months, creating structured Meeting objects with various attributes like title, description, classification, and links. A comprehensive test suite has been created to validate the spider's parsing functionality, ensuring accurate data extraction and adherence to expected output formats.

Changes

File Change Summary
city_scrapers/spiders/cinoh_Board_of_Ed.py Added new CinohBoardOfEdSpider class for scraping Cincinnati Board of Education meeting data
tests/files/cinoh_Board_of_Ed.json Added test JSON file with meeting records for various committee meetings
tests/test_cinoh_Board_of_Ed.py Created comprehensive test suite with multiple test functions to validate spider's parsing logic

Sequence Diagram

sequenceDiagram
    participant Spider as CinohBoardOfEdSpider
    participant API as Meeting Data API
    participant Parser as JSON Parser
    participant Meeting as Meeting Object

    Spider->>API: Request meeting data
    API-->>Spider: Return JSON response
    Spider->>Parser: Parse JSON data
    Parser-->>Spider: Extract meeting details
    Spider->>Meeting: Create Meeting objects
    Meeting-->>Spider: Return parsed meetings
Loading

Poem

🐰 Hop, hop, through Cincinnati's halls,
Scraping meetings, big and small,
Board of Ed, your data we'll trace,
With spider magic, we'll embrace!
Meetings parsed with bunny delight,
City Scrapers take their flight! 🕷️


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
city_scrapers/spiders/cinoh_Board_of_Ed.py (2)

73-81: Consider distinguishing multiple document links.

If future requirements expand (e.g., separate Zoom link, minutes, attachments), consider returning multiple link entries with more specific titles.


19-23: Potential future enhancement to parse second API endpoint.

You mentioned there's a second endpoint that’s currently unused. If it provides additional meeting details or ensures completeness, consider adding a second request/parse flow in the future.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7ca4020 and dfaf432.

📒 Files selected for processing (3)
  • city_scrapers/spiders/cinoh_Board_of_Ed.py (1 hunks)
  • tests/files/cinoh_Board_of_Ed.json (1 hunks)
  • tests/test_cinoh_Board_of_Ed.py (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • tests/files/cinoh_Board_of_Ed.json
🧰 Additional context used
🪛 Ruff (0.8.2)
tests/test_cinoh_Board_of_Ed.py

5-5: city_scrapers_core.constants.NOT_CLASSIFIED imported but unused

Remove unused import

(F401)


5-5: city_scrapers_core.constants.BOARD imported but unused

Remove unused import

(F401)

🔇 Additional comments (3)
city_scrapers/spiders/cinoh_Board_of_Ed.py (3)

23-26: Good use of FormRequest to handle form data.

This approach ensures correct server interaction and clean request handling.


28-45: Validate date filtering and iteration logic.

The logic to skip meetings older than 12 months helps keep the dataset relevant. Confirm this aligns with project requirements (some boards may post older meeting data retroactively).


65-71: Classification logic looks appropriate.

The classification covers committee, board, or default. This improves clarity if more categories are introduced in the future.

from os.path import dirname, join

import pytest
from city_scrapers_core.constants import COMMITTEE, NOT_CLASSIFIED, BOARD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove unused imports.

NOT_CLASSIFIED and BOARD aren't used anywhere, so please remove them to avoid clutter and improve maintainability.

-from city_scrapers_core.constants import COMMITTEE, NOT_CLASSIFIED, BOARD
+from city_scrapers_core.constants import COMMITTEE
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
from city_scrapers_core.constants import COMMITTEE, NOT_CLASSIFIED, BOARD
from city_scrapers_core.constants import COMMITTEE
🧰 Tools
🪛 Ruff (0.8.2)

5-5: city_scrapers_core.constants.NOT_CLASSIFIED imported but unused

Remove unused import

(F401)


5-5: city_scrapers_core.constants.BOARD imported but unused

Remove unused import

(F401)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant