wright-way Prefect Flows#
The Wright Way project is a scraper that monitors the Wright Way Rescue website for new animals. There are two main prefect flows in this project: the initialization of the database, and the monitor.
wright_way.initialize
#
Initialize and populate the Wright Way database.
This flow will just initialize the database and populate it with all the current animals. The expectation is that this flow will be run once before the main monitor flow is run consistently. This will ensure that the first run of the monitor flow will not spam the slack channel with hundreds of new animals.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
engine
|
Engine | None
|
SQLAlchemy engine, if not provided, the default engine will be used. Defaults to None. |
None
|
client
|
WrightWayScraper | None
|
Wright Way Scraper client, if not provided, a new client will be created. Defaults to None. |
None
|
Source code in wright_way/orchestration.py
wright_way.monitor
#
monitor(*, full_refresh: bool = False, slack_channel: str | None = None, engine: Engine | None = None, client: WrightWayScraper | None = None) -> None
Wright Way Animal Monitor main logic.
This function is the main entry point for the Wright Way Animal Monitor. It will:
- Initialize the database, if not already initialized.
- Pull all the Wright Way Petango IDs from the database and from the Wright Way website.
- Scrape new animals from the Wright Way website and add them to the database.
- Update existing animals in the database (if requested).
- Delete animals from the database that are no longer on the Wright Way website.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
full_refresh
|
bool
|
Update all animals in the database, instead of just the new ones. Defaults to False. |
False
|
slack_channel
|
str
|
Slack channel to publish new animals to |
None
|
engine
|
Engine | None
|
SQLAlchemy engine, if not provided, the default engine will be used. Defaults to None. |
None
|
client
|
WrightWayScraper | None
|
Wright Way Scraper client, if not provided, a new client will be created. Defaults to None. |
None
|
Source code in wright_way/orchestration.py
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | |