Example #1
0
def main(url):
    # Download data
    data_raw = project0.fetchincidents(url)

    # Extract Data
    incidents = project0.extractincidents(data_raw)

    # Create Dataase
    project0.createdb()

    # Insert Data
    project0.populatedb(incidents)

    # Print Status
    project0.status()
def main(url):
    # Download data
    incident_data = project0.fetchincidents(url)

    # Extract Data
    incidents = project0.extractincidents(incident_data)

    # Create Database
    db = project0.createdb()

    # Insert Data
    project0.populatedb(db, incidents)

    # Print Status
    project0.status(db)
Example #3
0
def test_final_status():
    project0.fetchincidents(url)
    incidents = project0.extractincidents()
    project0.createdb()
    project0.populatedb(incidents)
    s = project0.status()
    assert type(s) == str
def test_status( ):
      temp_file = project0.fetchincidents(url)
      incidents = project0.extractincidents(temp_file)
      db = project0.createdb()
      project0.populatedb(db, incidents)
      result = project0.status(db)
      for i in result:
         assert len(i) > 0
Example #5
0
def test_random_title():
    df = project0.extractincidents([url3])
    conn = project0.createdb()
    project0.populatedb(df, conn)
    randomrecord = project0.status(conn)

    assert randomrecord is not None
    assert len(randomrecord) == 9
    assert type(randomrecord[0]) == str
def test_status():
    data = project0.fetchincidents(url)
    incidents = project0.extractincidents(data)
    db = project0.createdb()
    project0.populatedb(db, incidents)
    s = project0.status(db)
    with open("test.txt", "w") as file:
        d = file.write(str(s))
# print (d)
    assert type(d) == int
Example #7
0
def main(url):
    # Download data
    data = project0.fetch_incidents(url)

    # Extract Data
    incidents = project0.extract_incidents(data)

    # Create Dataset
    project0.create_db()

    # Insert Data
    project0.populate_db(incidents)

    # Print Status
    status = project0.status()
    print(status)
def test_status():
    try:
        data = project0.fetch_incidents(
            'http://normanpd.normanok.gov/'
            'filebrowser_download/657/2020-03-01%20Daily%'
            '20Incident%20Summary.pdf')

        incidents = project0.extract_incidents(data)

        project0.create_db()

        project0.populate_db(incidents)

        status = project0.status()

        march1 = open("march1.txt", "r").read()

        assert status == march1
        print("passed test status")
    except AssertionError:
        print("failed test status")
Example #9
0
def main(url):
    # Download data
    print("Here are the Arrest record URLs fetched from the Norman PD:\n")
    print(project0.fetchincidents(url))
    print("\n")

    # Extract Data
    df = project0.extractincidents(project0.fetchincidents(url))
    print(
        "\nHere are the first 5 records in the database stored from the Norman PD's arrest records:\n"
    )
    print(df.head())
    print("\n")

    # Create Dataase
    conn = project0.createdb()
    # Insert Data
    project0.populatedb(df, conn)
    # Print Status
    randomrecord = project0.status(conn)
    print(randomrecord[0])
    type(randomrecord[0])