Welcome to Dana’s documentation!

Community

The Community module

class app.models.community.Community(**kwargs)[source]
classmethod add_comunity(community)[source]

Add a given Community to the database. If there is a conflict, the existing object in the database is overwritten.

classmethod from_dict(data)[source]

Create a Community object from a dict.

classmethod get_all_communities()[source]

Query the database and return a list of all Communities with their id, name and boundaries in GeoJSON format.

classmethod get_community_surrounding(longitude, latitude)[source]

Get a Community with boundaries surrounding a given point specified by longitude and latitude. Returns the Community id, name and boundaries.

static populate_db()[source]

Populate database with default community data.

to_dict()[source]

Return a dictionary representation of this Community object.

Community Resource

The Community Resource module

class app.models.community_resource.CommunityResource(**kwargs)[source]
classmethod add_community_resource(resource)[source]

Add a given CommunityResource to the database. If there is a conflict, the existing object in the database is overwritten.

static coordinates_from_address(address)[source]

Return the given address’ coordinates.

classmethod edit_community_resource(community_resource_id, new_name, new_lat, new_long, new_contact_name, new_email, new_phone_number, new_address, new_website, new_image_uri)[source]

Update and return the existing CommunityResource with the given id.

classmethod from_dict(data)[source]

Create a CommunityResource object from a dict.

classmethod get_community_resource_by_charity_number(charity_number)[source]

Return the CommunityResource with the given charity number.

classmethod get_community_resource_by_id(community_resource_id)[source]

Return a GeoJSON representation of the CommunityResource with the given id.

classmethod get_resources_by_radius(longitude, latitude, radius)[source]

Given coordinates and a radius, return a list of CommunityResources within the given radius around the given coordinates in GeoJSON format.

classmethod get_resources_in_shape(polygon_string)[source]

Given a polygon, return a list of CommunityResources within the given polygon in GeoJSON format.

static long_lat_to_point(longitude, latitude)[source]

Return a WKTElement of the point with the given coordinates.

static populate_db()[source]

Populate database with default data.

to_dict()[source]

Return a dictionary representation of this CommunityResource object.

exception app.models.community_resource.InvalidCommunityResourceInfo(message)[source]
exception app.models.community_resource.NoExistingCommunityResource(message)[source]

Indices and tables