GithubHelp home page GithubHelp logo

mdecourcy / beach-data-scrape Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 88 KB

Scrapes data provided by https://beachwatch.waterboards.ca.gov and inserts to influxdb

Python 93.39% Dockerfile 6.61%

beach-data-scrape's Introduction

Water Quality Data Processor

This script fetches water quality data from the Beach Watch website, processes it, and then writes it into an InfluxDB database. The data spans from the year 2000 to the current year, though it can also fetch data for specific years. The script can be run with a "first-pass" argument which causes it to fetch and process data for all years since 2000.

Getting Started

Prerequisites

  1. Python (version used in development was 3.11.4, but it should work with any 3.x version).

  2. Python libraries: io, json, requests, pandas, uuid, logging, os, argparse, datetime, dotenv.

  3. Environment variables (or .env file):

  • INFLUXDB_URL: The InfluxDB server URL.
  • INFLUXDB_ORG: The organization for the InfluxDB.
  • INFLUXDB_BUCKET: The bucket where data will be stored in the InfluxDB.
  • INFLUXDB_TOKEN: The authentication token for InfluxDB.
  1. Access to the Beach Watch website.

Installation

  1. Clone the repository to your local machine: git clone https://github.com/mdecourcy/beach-data-scrape.git

  2. Navigate to the project directory: cd beach-data-scrape

  3. Install the required Python packages: pip install -r requirements.txt

Usage

To run the script for all years from 2000 to the current year: python water_quality.py --first-pass

To run the script for the current year: python water_quality.py

Features

  • Fetches water quality data in the form of an XLS file.
  • Converts the XLS data to a pandas dataframe.
  • Maps the column names to the desired format.
  • Converts the dataframe data to line protocol, which is the format required for writing data to InfluxDB.
  • Writes the data to an InfluxDB database.

Logging

The script logs various information and error messages. Logs are written to a file named app.log. Contributing

If you wish to contribute to this project, please create an issue first to discuss your intended changes. After that, you can create a pull request. License

This project is open-source. Please refer to the LICENSE file for more details.

Acknowledgements

  • Thanks to the Beach Watch website for providing the data.
  • Thanks to the InfluxDB community for their extensive documentation.

Disclaimer

The script relies on the availability of the Beach Watch website and the format in which it provides data. If there are changes in the website's structure or the data format, the script may not function as expected.

Screenshot

image

beach-data-scrape's People

Contributors

mdecourcy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.