OpenMontana / montana-legislature-council-data-project

Mozilla Public License 2.0
2 stars 1 forks source link

CDP - Montana State Legislature

Infrastructure Deployment Status Event Processing Pipeline Event Index Pipeline Web Deployment Status Repo Build Status


Council Data Project

Council Data Project is an open-source project dedicated to providing journalists, activists, researchers, and all members of each community we serve with the tools they need to stay informed and hold their Council Members accountable.

For more information about Council Data Project, please visit our website.

Instance Information

This repo serves the municipality: Montana State Legislature

Python Access

Install:

pip install cdp-backend

Quickstart:

from cdp_backend.database import models as db_models
from cdp_backend.pipeline.transcript_model import Transcript
import fireo
from gcsfs import GCSFileSystem
from google.auth.credentials import AnonymousCredentials
from google.cloud.firestore import Client

# Connect to the database
fireo.connection(client=Client(
    project="cdp-montana-legislature",
    credentials=AnonymousCredentials()
))

# Read from the database
five_people = list(db_models.Person.collection.fetch(5))

# Connect to the file store
fs = GCSFileSystem(project="cdp-montana-legislature", token="anon")

# Read a transcript's details from the database
transcript_model = list(db_models.Transcript.collection.fetch(1))[0]

# Read the transcript directly from the file store
with fs.open(transcript_model.file_ref.get().uri, "r") as open_resource:
    transcript = Transcript.from_json(open_resource.read())

# OR download and store the transcript locally with `get`
fs.get(transcript_model.file_ref.get().uri, "local-transcript.json")
# Then read the transcript from your local machine
with open("local-transcript.json", "r") as open_resource:
    transcript = Transcript.from_json(open_resource.read())

Contributing

If you wish to contribute to CDP please note that the best method to do so is to contribute to the upstream libraries that compose the CDP Instances themselves. These are detailed below.

Instance Admin Documentation

You can find documentation on how to customize, update, and maintain this CDP instance in the admin-docs directory.

License

CDP software is licensed under a MIT License.

Content produced by this instance is available under a Creative Commons Attribution 4.0 International License.