stakeholders package

stakeholders.api module

This module contains the API and API factory.

stakeholders.api.create_api(file='./stakeholders.sqlite3')[source]

This is the API factory. It returns an instance of the API.

Parameters:file (str) – The name of the database file (stakeholders.sqlite3 by default).
Returns:api – An instance of the API as a Flask application object.
Return type:Flask application object

stakeholders.app module

This module contains the app and app factory.

stakeholders.app.create_app(requester=<module 'requests' from '/home/docs/checkouts/readthedocs.org/user_builds/stakeholders/envs/latest/lib/python3.7/site-packages/requests/__init__.py'>, host='localhost', port='8079')[source]

This is the app factory. It returns an instance of the app.

The app is the intermediary between the API and the end-user’s web browser.

Parameters:
  • requester (Python library) –

    The library used to send requests to the API (requests for production and flask.testing.FlaskClient for testing).

    We need this contrivance only so we can use Flask’s testing module for unit testing.

  • host (str) –

    The name of the host on which the API runs (localhost by default).

    The app sends requests to the API’s endpoints, and this forms part of the base URI.

  • port (str) –

    The port on which the API listens (8079 by default).

    The app sends requests to the API’s endpoints, and this forms part of the base URI.

Returns:

app – An instance of the app as a Flask application object.

Return type:

Flask application object

stakeholders.db module

This module contains the Database class.

class stakeholders.db.Database(file='stakeholders.sqlite3')[source]

Bases: object

The Database class.

open()[source]

Opens a connection to the database.

close()[source]

Closes the connection to the database.

create_stakeholders_table()[source]

Creates the stakeholders table.

create_deliverables_table()[source]

Creates the deliverables table.

create_associations_table()[source]

Creates the associations table.

drop_stakeholders_table()[source]

Drops the stakeholders table.

drop_deliverables_table()[source]

Drops the deliverables table.

drop_associations_table()[source]

Drops the associations table.

insert_into_stakeholders_table(name=None, role=None, sentiment=None, power=None, interest=None, approach=None)[source]

Inserts a record into the stakeholders table, where the record represents a stakeholder.

Parameters:
  • name (str) – The stakeholder’s name.
  • role (str) – The stakeholder’s role.
  • sentiment (str) – The stakeholder’s sentiment.
  • power (str) – The stakeholder’s level of power.
  • interest (str) – The stakeholder’s level of interest.
  • approach (str) – The approach to managing this stakeholder.
insert_into_deliverables_table(name=None, kind=None, medium=None, formality=None, frequency=None)[source]

Inserts a record into the deliverables table, where the record represents a deliverable.

Parameters:
  • name (str) – The deliverable’s name.
  • kind (str) – The deliverable’s kind.
  • medium (str) – The deliverable’s medium.
  • formality (str) – The deliverable’s level of formality.
  • frequency (str) – The deliverable’s frequency.
insert_into_associations_table(stakeholder_id=None, deliverable_id=None)[source]

Inserts a record into the associations table, where a record represents a relationship between a stakeholder and a deliverable.

Parameters:
  • stakeholder_id (int) – A stakeholder’s unique id as found in the stakeholders table.
  • deliverable_id (int) – A deliverable’s unique id as found in the deliverables table.
select_all_from_stakeholders_table()[source]

Selects all records and fields from the stakeholders table.

Returns:A list of records.
Return type:list
select_all_from_deliverables_table()[source]

Selects all records and fields from the deliverables table.

Returns:A list of records.
Return type:list
select_all_from_associations_table()[source]

Selects all records and fields from the associations table.

Returns:A list of records.
Return type:list
select_from_stakeholders_table(id=None)[source]

Selects one record and all fields from the stakeholders table.

Parameters:id (str) – A stakeholder’s unique id as found in the stakeholders table.
Returns:A list with one record.
Return type:list
select_from_deliverables_table(id=None)[source]

Selects one record and all fields from the deliverables table.

Parameters:id (int) – A deliverable’s unique id as found in the deliverables table.
Returns:A list with one record.
Return type:list
select_from_associations_table(id=None)[source]

Selects one record and all fields from the associations table.

Parameters:id (int) – An association’s unique id as found in the associations table.
Returns:
Return type:A list with one record.
update_stakeholders_table(id=None, name=None, role=None, sentiment=None, power=None, interest=None, approach=None)[source]

Updates a record in the stakeholders table.

Parameters:
  • id (str) – A stakeholder’s unique id as found in the stakeholders table.
  • name (str) – The stakeholder’s name.
  • role (str) – The stakeholder’s role.
  • sentiment (str) – The stakeholder’s sentiment.
  • power (str) – The stakeholder’s level of power.
  • interest (str) – The stakeholder’s level of interest.
  • approach (str) – The approach to managing this stakeholder.
update_deliverables_table(id=None, name=None, kind=None, medium=None, formality=None, frequency=None)[source]

Updates a record in the deliverables table.

Parameters:
  • id (int) – A deliverable’s unique id as found in the deliverables table.
  • name (str) – The deliverable’s name.
  • kind (str) – The deliverable’s kind.
  • medium (str) – The deliverable’s medium.
  • formality (str) – The deliverable’s level of formality.
  • frequency (str) – The deliverable’s frequency.
update_associations_table(id=None, stakeholder_id=None, deliverable_id=None)[source]

Updates a record in the associations table.

Parameters:
  • id (int) – An association’s unique id as found in the associations table.
  • stakeholder_id (int) – A stakeholder’s unique id as found in the stakeholders table.
  • deliverable_id (int) – A deliverable’s unique id as found in the deliverables table.
delete_from_stakeholders_table(id=None)[source]

Deletes a record from the stakeholders table.

Parameters:id (str) – A stakeholder’s unique id as found in the stakeholders table.
delete_from_deliverables_table(id=None)[source]

Deletes a record from the deliverables table.

Parameters:id (str) – A deliverable’s unique id as found in the deliverables table.
delete_from_associations_table(id=None)[source]

Deletes a record from the associations table.

Parameters:id (str) – An association’s unique id as found in the associations table.

stakeholders.utils module

This module contains utils.

stakeholders.utils.compute_approach(power, interest)[source]

Computes the approach to managing a stakeholder according to the power/interest model.

Parameters:
  • power (str) – The stakeholder’s level of power, either high or low.
  • interest (str) – The stakeholder’s level of interest, either high or low.
Returns:

The approach to managing this stakeholder: monitor closely, keep satisfied, keep informed, monitor, or unknown.

Return type:

str

stakeholders.utils.transform(record)[source]

Transforms (maps) a record.

Parameters:record (dict) – The record to transform.
Returns:The transformed record.
Return type:dict
stakeholders.utils.recursive_fold(left, right)[source]

Recursively folds (reduces) two records.

Parameters:
  • left (dict) – The “left-hand”, or current, record.
  • right (dict) – The “right-hand”, or next, record.
Returns:

left – The folded (reduced) record.

Return type:

dict

stakeholders.utils.map_reduce(records)[source]

Maps and reduces a list of records.

Calls the transform and recursive_fold functions.

Parameters:records (list of dicts) – The records to map and reduce.
Returns:The mapped and reduced records.
Return type:dict
stakeholders.utils.sort(records)[source]

Sorts records by the approach to managing stakeholders.

Parameters:records (dict) – The records to sort.
Returns:The sorted records.
Return type:OrderedDict

Module contents

Manage stakeholders like a pro!