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

Monterey scraping #166

Merged
merged 3 commits into from
Jun 13, 2024
Merged

Monterey scraping #166

merged 3 commits into from
Jun 13, 2024

Conversation

ryanchansf
Copy link
Collaborator

Developer: Ryan Chan and Oli Lane

Closes #{ISSUE NUMBER HERE}

Pull Request Summary

TBD

Modifications

{list out the files created/modified and a brief description of what was changed}

Testing Considerations

{list out what you have tested and what the reviewer should verify}

Pull Request Checklist

  • Code is neat, readable, and works
  • Comments are appropriate
  • The commit messages follows our guidelines
  • The developer name is specified
  • The summary is completed
  • Assign reviewers

Screenshots/Screencast

{put screenshots of your change, or even better a screencast displaying the functionality}

Copy link

vercel bot commented Jun 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ecologistics-web-scraper ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 13, 2024 3:38am

print(hearings)
except Exception as e:
pass
return {"message": "Hello World!"}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Incomplete — haven't tested scrape_hearings()

if upcoming_events_table:
events = upcoming_events_table.find_all("tr", class_="rgRow")

for event in events:
Copy link
Collaborator Author

@ryanchansf ryanchansf Jun 12, 2024

Choose a reason for hiding this comment

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

Incomplete/haven't tested. Still unsure about what fields can be extracted from the public hearings table, particularly for the Planning Committee hearings (which seem to be the only ones that have any useful information). So far, in the limited number of hearings that actually have relevant information, the fields that we can extract are:

  • Hearing Date
  • Location (sort of)
  • Requesting Party (not explicit)
  • APN

Missing (as far as I can see):

  • County File Number
  • Date Accepted

@@ -9,7 +10,8 @@ export async function GET(req: Request) {

try {
await connectDB();
// TODO: get project by countyFileNumber
// TODO: get county from query params and use getProjectModel to get the correct model
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For the base route that does a simple fetch all for the project data, since we now have multiple counties, we must separate the projects collection into 3 separate collections, one for each county. These will live under the respective slo, santaBarbara, and monterey databases. This GET request will have to take in an optional query parameter for the specified county in the request, to which it will map to the correct Mongo database, then query from its respective projects collection.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

NOTE: the query parameter is mostly required, but optional because we can make it so that if missing it will just choose the SLO County database as default

@@ -19,8 +21,7 @@ export default function Navbar() {
<div className="flex bg-secondary px-16 h-16 items-center justify-between">
<div>
<Link href="/" className="flex items-left">
<div className="font-bold text-3xl">ECOLO</div>
<div className="text-primary text-3xl">GISTICS Web Scraper</div>
<Image src={Ecologistics} alt="Ecologistics Logo" />
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Adding the official logo to the navbar and replacing our makeshift one

<div className="flex items-center py-4">
<Select
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Component that allows the user to select between the 3 different counties, to which their respective tables will be displayed

console.log(columnToFilter); // log the columnToFilter state
}, [columnToFilter]);

const handleCountyChange = (selectedCounty: string) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Handler that will be primarily responsible for re-fetching the data (via the fetchProjectData function which should take in a new parameter county) that will populate the table for the user-selected county. Also responsible for any other state change, like the table header that displays the <County> (<number of projects>)

@@ -48,6 +48,12 @@ export const projectSchema = new Schema<IProject>({
additional_notes: { type: String, required: false, default: "N/A" },
});

// retrieve correct collection based on county database
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This will be the function used in the GET route to change the database according to the specified county in the request. Haven't tested it yet, but it looks reasonable as it uses the mongoose useDb function to select a database within the same mongo connection

@ryanchansf ryanchansf merged commit afa3c2c into develop Jun 13, 2024
4 checks passed
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