aggregator.pipes.models

Pipes model graph
Pipes model graph

Graph of models in the aggregator.pipes app and related apps.

Defines a class for a data platform’s API. Stores information on an API’s rate limits and parameter limits. Also stores information on how to access the specific class needed to handle a query to the API.

class aggregator.pipes.models.Pipe(*args, **kwargs)[source]

Bases: ambassador.endpoints.models.Endpoint

Specifies the module and Faucet class that should be used to access an API endpoint of a Reservoir, such as Twitter.

A Pipe can have a PipeSpecSheet that details information on the API’s parameter limits.

Since a Reservoir may be accessed using more than one API (e.g., Twitter Search API vs. Twitter Public API), Pipes have a many-to-one relationship with Reservoirs.

platform

|Reservoir| – The data platform which the API endpoint accesses.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

datachute_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

emissaries

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

pizza.toppings and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

funnel_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

gateway_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

get_specsheet()[source]

Returns the Specs for the Pipe if it has them.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <ambassador.endpoints.models.EndpointManager object>
platform

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

platform_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

sample

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

place.restaurant is a ReverseOneToOneDescriptor instance.

specsheet

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

place.restaurant is a ReverseOneToOneDescriptor instance.

stream_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class aggregator.pipes.models.PipeSpecSheet(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Contains info on search parameter formats and limits.

pipe

the ForeignKey for the Pipe with which the SpecSheet is associated

streaming

a Boolean indicating whether the API endpoint is for streaming

searchterms_limit

the maximum number of search terms allowed in a query

followees_limit

the maximum number of user accounts that can be included in a query

locations_limit

the maximum number of locations that can be searched in a query

location_format

whether the API takes a location as a bounding box or a search radius

radius_limit_km

the maximum radius of a search area accepted, in kilometers

combine_trm_dt

a Boolean indicating whether timeframes count toward the search term limit; if true, start datetime and end datetime each count as a search term

combine_trm_fol

a Boolean indicating whether search terms and followees share the same parameter space and therefore the same limit; if true, also indicates than terms and followees can be joined with an “OR” operator if one is available

combine_trm_loc

a Boolean indicating whether search terms and locations share the same parameter space and therefore the same limit; if true, also indicates than terms and locations can be joined with an “OR” operator if one is available

combine_trm_opr

a Boolean indicating whether logical operators count toward the search term limit

accepts_phrases

whether the API accepts phrases (if False, only takes keywords)

trm_trm_logic

a logical “AND” or “OR” operator indicating how multiple terms are evaluated in a query (i.e., with an intersection vs. a union of results)

trm_fol_logic

a logical “AND” or “OR” operator indicating how terms and followees are evaluated in a query (i.e., with an intersection vs. a union of results)

trm_loc_logic

a logical “AND” or “OR” operator indicating how terms and locations are evaluated in a query (i.e., with an intersection vs. a union of results)

OR_operator

a string that the API uses as an “OR” operator; can be used to join arguments in the search terms parameter space

NOT_operator

a string that the API uses as a “NOT” operator

#TODO

LH – add validator that makes sure logic fields have values if limits are > 1

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

NOT_operator

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OR_operator

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

accepts_phrases

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

combine_trm_dt

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

combine_trm_fol

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

combine_trm_loc

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

combine_trm_opr

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

followees_limit

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_location_format_display(**morekwargs)
get_trm_fol_logic_display(**morekwargs)
get_trm_loc_logic_display(**morekwargs)
get_trm_trm_logic_display(**morekwargs)
location_format

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

locations_limit

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
pipe

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

restaurant.place is a ForwardOneToOneDescriptor instance.

pipe_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

radius_limit_km

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

searchterms_limit

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

streaming

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

trm_fol_logic

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

trm_loc_logic

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

trm_trm_logic

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.