elex.api.APElection

class elex.api.APElection

Base class for most objects.

Includes handy methods for transformation of data and AP connections

serialize()

Serialize the object. Should be implemented in all classes that inherit from APElection.

Should return an OrderedDict.

set_candidates()

Set candidates.

If this thing (race, reportingunit) has candidates, serialize them into objects.

set_polid()

Set politication id.

If polid is zero, set to None.

set_reportingunitids()

Set reporting unit ID.

Per Tracy / AP developers, if the level is “state”, the reportingunitid is always 1.

set_reportingunits()

Set reporting units.

If this race has reportingunits, serialize them into objects.

set_state_fields_from_reportingunits()

Set state fields.