# Path: src/mcsafetyfeed-server/mcsafetyfeedserver/models.py
# class Users(Base):
# class AgencyTypes(Base):
# class Agencies(Base):
# class DispatchTypes(Base):
# class Groups(Base):
# class GroupDispatchTypes(Base):
# class Statuses(Base):
# class Incidents(Base):
# class IncidentsDispatches(Base):
# class Dispatches(Base):
# class APICalls(Base):
# class CurrentDispatches(Base):
# class Runs(Base):
#     def get_from_code(cls, session, code):
#     def create_new_agency_type(cls, session, code, description):
#     def get_from_guid(cls, session, guid):
#     def create_new_agency(cls, session, agency_code, agency_name,
#             type_id, description, website):
#     def get_all(cls, session):
#     def get_from_dispatch_text(cls, session, dispatch_text):
#     def create_new_dispatch_type(cls, session, dispatch_text, description):
#     def get_all(cls, session):
#     def get_from_dispatch_text(cls, session, dispatch_text):
#     def create_new_status(cls, session, status_text, description):
#     def get_from_status_text(cls, session, status_text):
#     def create_new_incident(cls, session, dispatch_text):
#     def get_count(cls, session):
#     def check_exists(cls, session, guid, status_text):
#     def add_dispatch(cls, session, run_id, status_text, short_address,
#             guid, dispatch_text, dispatch_datetime, source_lat, source_lng,
#             geocode_lat, geocode_lng, full_address, geocode_successful):
#     def get_by_guid(cls, session, guid):
#     def close_dispatch(cls, session, run_id, guid):
#     def get_by_date(cls, session, target_datetime, start, count):
#     def get_count_by_date(cls, session, target_datetime):
#     def add_api_call(cls, session, api_key, query_time, api_call, api_version):
#     def get_count(cls, session):
#     def add_current_dispatch(cls, session, guid):
#     def get_current_dispatch_guids(cls, session):
#     def remove_current_dispatch(cls, session, guid):
#     def get_count(cls, session):
#     def new_run(cls, session):
#     def update_run(cls, session, run, successful, error_text, new_dispatches):


import os
import json
import datetime
from pyramid.response import Response
from pyramid.view import view_config
from sqlalchemy.exc import DBAPIError
from .models import (
    DBSession,
    Users,
    AgencyTypes,
    Agencies,
    DispatchTypes,
    Groups,
    GroupDispatchTypes,
    Statuses,
    Incidents,
    IncidentsDispatches,
    Dispatches,
    APICalls,
    CurrentDispatches,
    Runs,
    )
    return {'agencies': agencies}

@view_config(route_name='browse', renderer='templates/browse.mak')
def browse(request):

    return {}

@view_config(route_name='search', renderer='templates/search.mak')
def search(request):

    return {}

@view_config(route_name='about', renderer='templates/about.mak')
def about(request):

    return {}

@view_config(route_name='status', renderer='templates/status.mak')
def status(request):

    return {}

@view_config(route_name='status.json')
def status_json(request):

    """ Returns the status of the system
    """

    response = {'success': False}
    try:

# Path: src/mcsafetyfeed-server/mcsafetyfeedserver/models.py
# class Users(Base):
# class AgencyTypes(Base):
# class Agencies(Base):
# class DispatchTypes(Base):
# class Groups(Base):
# class GroupDispatchTypes(Base):
# class Statuses(Base):
# class Incidents(Base):
# class IncidentsDispatches(Base):
# class Dispatches(Base):
# class APICalls(Base):
# class CurrentDispatches(Base):
# class Runs(Base):
#     def get_from_code(cls, session, code):
#     def create_new_agency_type(cls, session, code, description):
#     def get_from_guid(cls, session, guid):
#     def create_new_agency(cls, session, agency_code, agency_name,
#             type_id, description, website):
#     def get_all(cls, session):
#     def get_from_dispatch_text(cls, session, dispatch_text):
#     def create_new_dispatch_type(cls, session, dispatch_text, description):
#     def get_all(cls, session):
#     def get_from_dispatch_text(cls, session, dispatch_text):
#     def create_new_status(cls, session, status_text, description):
#     def get_from_status_text(cls, session, status_text):
#     def create_new_incident(cls, session, dispatch_text):
#     def get_count(cls, session):
#     def check_exists(cls, session, guid, status_text):
#     def add_dispatch(cls, session, run_id, status_text, short_address,
#             guid, dispatch_text, dispatch_datetime, source_lat, source_lng,
#             geocode_lat, geocode_lng, full_address, geocode_successful):
#     def get_by_guid(cls, session, guid):
#     def close_dispatch(cls, session, run_id, guid):
#     def get_by_date(cls, session, target_datetime, start, count):
#     def get_count_by_date(cls, session, target_datetime):
#     def add_api_call(cls, session, api_key, query_time, api_call, api_version):
#     def get_count(cls, session):
#     def add_current_dispatch(cls, session, guid):
#     def get_current_dispatch_guids(cls, session):
#     def remove_current_dispatch(cls, session, guid):
#     def get_count(cls, session):
#     def new_run(cls, session):
#     def update_run(cls, session, run, successful, error_text, new_dispatches):


# Path: src/mcsafetyfeed-server/mcsafetyfeedserver/views.py
import os
import json
import datetime
from pyramid.response import Response
from pyramid.view import view_config
from sqlalchemy.exc import DBAPIError
from .models import (
    DBSession,
    Users,
    AgencyTypes,
    Agencies,
    DispatchTypes,
    Groups,
    GroupDispatchTypes,
    Statuses,
    Incidents,
    IncidentsDispatches,
    Dispatches,
    APICalls,
    CurrentDispatches,
    Runs,
    )

    return {'agencies': agencies}

@view_config(route_name='browse', renderer='templates/browse.mak')
def browse(request):

    return {}

@view_config(route_name='search', renderer='templates/search.mak')
def search(request):

    return {}

@view_config(route_name='about', renderer='templates/about.mak')
def about(request):

    return {}

@view_config(route_name='status', renderer='templates/status.mak')
def status(request):

    return {}

@view_config(route_name='status.json')
def status_json(request):

    """ Returns the status of the system
    """

    response = {'success': False}
    try:

        response['dispatch_count'] = Dispatches.get_count(DBSession)