Country¶
Country ¶
Country(country_name: str, preload_panel_ids: bool = False, verbose: bool = False, trust_cache: bool = False)
Primary interface to a single country's LSMS survey data.
Provides access to all survey waves, standardized tables, and panel data.
Tables listed in data_scheme are available as callable attributes
(e.g. country.food_expenditures()).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
country_name
|
str
|
Directory name under |
required |
preload_panel_ids
|
bool
|
If True, compute panel ID mappings eagerly at construction time. Default is False (lazy). |
False
|
verbose
|
bool
|
Enable verbose logging. |
False
|
trust_cache
|
bool
|
If True, read existing cached Parquet files directly without validating their hashes. Useful on clusters with pre-built data. |
False
|
Examples:
>>> import lsms_library as ll
>>> uga = ll.Country('Uganda')
>>> uga.waves
['2005-06', '2009-10', ...]
>>> uga.data_scheme
['food_acquired', 'household_roster', ...]
>>> food = uga.food_expenditures()
categorical_mapping
property
¶
Get the categorical mapping for the country. Searches current directory, then parent directory.
panel_ids
property
¶
Raw panel-ID tables keyed by wave. Computed lazily on first access.
updated_ids
property
¶
Mapping {old_id: new_id} per wave for ID harmonization. Computed lazily.
cached_datasets ¶
List dataset names currently cached for this country.
test_all_data_schemes ¶
Test whether all method_names in obj.data_scheme can be successfully built. Falls back to Makefile if not in data_scheme.