API Reference

tburundigeo.api.facade

Public API facade - simplified interface for end users.

tburundigeo.api.facade.set_data_source(data_source)[source]

Set the data source for all repositories.

Return type:

None

tburundigeo.api.facade.get_all_provinces()[source]

Get all provinces.

Return type:

List[Province]

tburundigeo.api.facade.get_province(code)[source]

Get a province by its code.

Return type:

Optional[Province]

tburundigeo.api.facade.get_province_capital(code)[source]

Get the capital of a province by its code.

Return type:

Optional[str]

tburundigeo.api.facade.search_provinces(query, search_by='name')[source]

Search provinces by name or code.

Return type:

List[Province]

tburundigeo.api.facade.count_provinces()[source]

Count total number of provinces.

Return type:

int

tburundigeo.api.facade.get_all_communes()[source]

Get all communes.

Return type:

List[Commune]

tburundigeo.api.facade.get_commune(code)[source]

Get a commune by its code.

Return type:

Optional[Commune]

tburundigeo.api.facade.get_communes_by_province(province_code)[source]

Get all communes in a province.

Return type:

List[Commune]

tburundigeo.api.facade.get_commune_capital(code)[source]

Get the capital of a commune by its code.

Return type:

Optional[str]

tburundigeo.api.facade.search_communes(query, search_by='name')[source]

Search communes by name, capital, or code.

Return type:

List[Commune]

tburundigeo.api.facade.count_communes()[source]

Count total number of communes.

Return type:

int

tburundigeo.api.facade.count_communes_in_province(province_code)[source]

Count communes in a specific province.

Return type:

int

tburundigeo.api.facade.get_all_zones()[source]

Get all zones.

Return type:

List[Zone]

tburundigeo.api.facade.get_zone(code)[source]

Get a zone by its code.

Return type:

Optional[Zone]

tburundigeo.api.facade.get_zones_by_commune(commune_code)[source]

Get all zones in a commune.

Return type:

List[Zone]

tburundigeo.api.facade.get_zone_chief_town(code)[source]

Get the chief town of a zone by its code.

Return type:

Optional[str]

tburundigeo.api.facade.search_zones(query, search_by='name')[source]

Search zones by name, chief town, or code.

Return type:

List[Zone]

tburundigeo.api.facade.count_zones()[source]

Count total number of zones.

Return type:

int

tburundigeo.api.facade.count_zones_in_commune(commune_code)[source]

Count zones in a specific commune.

Return type:

int

tburundigeo.api.facade.get_all_quartiers()[source]

Get all quartiers.

Return type:

List[Quartier]

tburundigeo.api.facade.get_quartier(code)[source]

Get a quartier by its code.

Return type:

Optional[Quartier]

tburundigeo.api.facade.get_quartiers_by_zone(zone_code)[source]

Get all quartiers in a zone.

Return type:

List[Quartier]

tburundigeo.api.facade.search_quartiers(query, search_by='name')[source]

Search quartiers by name or code.

Return type:

List[Quartier]

tburundigeo.api.facade.count_quartiers()[source]

Count total number of quartiers.

Return type:

int

tburundigeo.api.facade.count_quartiers_in_zone(zone_code)[source]

Count quartiers in a specific zone.

Return type:

int

tburundigeo.api.facade.get_full_hierarchy()[source]

Get the complete administrative hierarchy.

Return type:

Dict

tburundigeo.api.facade.get_parent_province(commune_code)[source]

Get the parent province of a commune.

Return type:

Optional[Province]

tburundigeo.api.facade.get_parent_commune(zone_code)[source]

Get the parent commune of a zone.

Return type:

Optional[Commune]

tburundigeo.api.facade.get_parent_zone(quartier_code)[source]

Get the parent zone of a quartier.

Return type:

Optional[Zone]

tburundigeo.api.facade.get_statistics()[source]

Get comprehensive statistics about administrative divisions.

Return type:

Dict[str, int]

tburundigeo.api.facade.get_summary()[source]

Get a quick summary of all administrative divisions.

Return type:

Dict[str, int]

tburundigeo.api.facade.export_to_json(include_hierarchy=False, entity_types=None)[source]

Export data to JSON format.

Return type:

str

tburundigeo.api.facade.export_to_csv(entity_type, include_headers=True)[source]

Export data to CSV format.

Return type:

str

tburundigeo.api.facade.export_to_yaml(include_hierarchy=False, entity_types=None)[source]

Export data to YAML format.

Return type:

str

tburundigeo.api.facade.validate_code(code, expected_level=None)[source]

Validate if a code exists and optionally matches expected level.

Return type:

bool

tburundigeo.api.facade.check_referential_integrity()[source]

Check referential integrity across all administrative levels.

Return type:

Dict[str, List[str]]

tburundigeo.api.facade.get_province_statistics(province_code)[source]

Get detailed statistics for a specific province.

Return type:

Dict[str, int]

tburundigeo.api.facade.get_commune_statistics(commune_code)[source]

Get detailed statistics for a specific commune.

Return type:

Dict[str, int]

tburundigeo.api.facade.get_zone_statistics(zone_code)[source]

Get detailed statistics for a specific zone.

Return type:

Dict[str, int]

tburundigeo.api.facade.get_all_provinces_statistics()[source]

Get detailed statistics for all provinces.

Return type:

List[Dict[str, int]]

tburundigeo.api.facade.get_all_communes_statistics()[source]

Get detailed statistics for all communes.

Return type:

List[Dict[str, int]]

tburundigeo.api.facade.get_all_zones_statistics()[source]

Get detailed statistics for all zones.

Return type:

List[Dict[str, int]]

tburundigeo.domain.entities

Core business entities for Burundi administrative divisions.

class tburundigeo.domain.entities.Province(code, name, capital)[source]

Bases: object

Represents a province in Burundi.

code: str
name: str
capital: str
__post_init__()[source]

Validate province data after initialization.

Return type:

None

__str__()[source]

String representation of the province.

Return type:

str

__init__(code, name, capital)
class tburundigeo.domain.entities.Commune(code, name, capital, province_code)[source]

Bases: object

Represents a commune in Burundi.

code: str
name: str
capital: str
province_code: str
__post_init__()[source]

Validate commune data after initialization.

Return type:

None

__str__()[source]

String representation of the commune.

Return type:

str

__init__(code, name, capital, province_code)
class tburundigeo.domain.entities.Zone(code, name, chief_town, commune_code)[source]

Bases: object

Represents a zone in Burundi.

code: str
name: str
chief_town: str
commune_code: str
__post_init__()[source]

Validate zone data after initialization.

Return type:

None

__str__()[source]

String representation of the zone.

Return type:

str

__init__(code, name, chief_town, commune_code)
class tburundigeo.domain.entities.Quartier(code, name, zone_code)[source]

Bases: object

Represents a quartier (neighborhood) in Burundi.

code: str
name: str
zone_code: str
__post_init__()[source]

Validate quartier data after initialization.

Return type:

None

__str__()[source]

String representation of the quartier.

Return type:

str

__init__(code, name, zone_code)

tburundigeo.infrastructure.repositories

Repository implementations that read data from Python files.

class tburundigeo.infrastructure.repositories.py_file.BasePyFileRepository(data_module_path)[source]

Bases: object

Base class for Python file-based repositories.

__init__(data_module_path)[source]

Initialize repository with path to data module.

class tburundigeo.infrastructure.repositories.py_file.PyFileProvinceRepository(data_module_path='tburundigeo.data.provinces')[source]

Bases: BasePyFileRepository, IProvinceRepository

Repository implementation for provinces using Python files.

__init__(data_module_path='tburundigeo.data.provinces')[source]

Initialize repository with path to data module.

get_all()[source]

Get all provinces.

Return type:

List[Province]

get_by_code(code)[source]

Get a province by its code.

Return type:

Optional[Province]

search_by_name(name_substring)[source]

Search provinces by name substring.

Return type:

List[Province]

count()[source]

Count total number of provinces.

Return type:

int

exists(code)[source]

Check if a province with the given code exists.

Return type:

bool

class tburundigeo.infrastructure.repositories.py_file.PyFileCommuneRepository(data_module_path='tburundigeo.data.communes')[source]

Bases: BasePyFileRepository, ICommuneRepository

Repository implementation for communes using Python files.

__init__(data_module_path='tburundigeo.data.communes')[source]

Initialize repository with path to data module.

get_all()[source]

Get all communes.

Return type:

List[Commune]

get_by_code(code)[source]

Get a commune by its code.

Return type:

Optional[Commune]

search_by_name(name_substring)[source]

Search communes by name substring.

Return type:

List[Commune]

search_by_capital(capital_substring)[source]

Search communes by capital substring.

Return type:

List[Commune]

get_by_province(province_code)[source]

Get all communes in a province.

Return type:

List[Commune]

count()[source]

Count total number of communes.

Return type:

int

count_in_province(province_code)[source]

Count communes in a specific province.

Return type:

int

exists(code)[source]

Check if a commune with the given code exists.

Return type:

bool

class tburundigeo.infrastructure.repositories.py_file.PyFileZoneRepository(data_module_path='tburundigeo.data.zones')[source]

Bases: BasePyFileRepository, IZoneRepository

Repository implementation for zones using Python files.

__init__(data_module_path='tburundigeo.data.zones')[source]

Initialize repository with path to data module.

get_all()[source]

Get all zones.

Return type:

List[Zone]

get_by_code(code)[source]

Get a zone by its code.

Return type:

Optional[Zone]

search_by_name(name_substring)[source]

Search zones by name substring.

Return type:

List[Zone]

get_by_commune(commune_code)[source]

Get all zones in a commune.

Return type:

List[Zone]

count()[source]

Count total number of zones.

Return type:

int

count_in_commune(commune_code)[source]

Count zones in a specific commune.

Return type:

int

exists(code)[source]

Check if a zone with the given code exists.

Return type:

bool

class tburundigeo.infrastructure.repositories.py_file.PyFileQuartierRepository(data_module_path='tburundigeo.data.quartiers')[source]

Bases: BasePyFileRepository, IQuartierRepository

Repository implementation for quartiers using Python files.

__init__(data_module_path='tburundigeo.data.quartiers')[source]

Initialize repository with path to data module.

get_all()[source]

Get all quartiers.

Return type:

List[Quartier]

get_by_code(code)[source]

Get a quartier by its code.

Return type:

Optional[Quartier]

search_by_name(name_substring)[source]

Search quartiers by name substring.

Return type:

List[Quartier]

get_by_zone(zone_code)[source]

Get all quartiers in a zone.

Return type:

List[Quartier]

count()[source]

Count total number of quartiers.

Return type:

int

count_in_zone(zone_code)[source]

Count quartiers in a specific zone.

Return type:

int

exists(code)[source]

Check if a quartier with the given code exists.

Return type:

bool