surveydata.odkplatform module
Support for ODK Central as a survey data platform.
- class surveydata.odkplatform.ODKPlatform(config_file: Optional[str] = None, project_id: Optional[int] = None, form_id: str = '')
Bases:
SurveyPlatform
ODK Central survey data platform implementation.
- __init__(config_file: Optional[str] = None, project_id: Optional[int] = None, form_id: str = '')
Initialize ODK for access to survey data.
- Parameters:
config_file (str) – Full path to ODK Central config file (needed to call sync_data())
project_id (int) – ODK project ID (if not supplied, will use default_project_id in config file)
form_id (str) – ODK form ID (needed to call sync_data())
If you’re not going to call sync_data(), you don’t need to supply any of the parameters to this constructor.
- static get_submissions_df(storage: StorageSystem, sort_columns: bool = True) DataFrame
Get all submission data from storage, organized into a Pandas DataFrame and optimized based on the platform.
- Parameters:
storage (StorageSystem) – Storage system for submissions
sort_columns (bool) – True to sort columns by name
- Returns:
Pandas DataFrame containing all submissions currently in storage
- Return type:
pandas.DataFrame
- sync_data(storage: StorageSystem, attachment_storage: Optional[StorageSystem] = None, no_attachments: bool = False, include_rejected: bool = False) list
Sync survey data to storage system.
- Parameters:
storage (StorageSystem) – Storage system for submissions (and attachments, if supported and other options don’t override)
attachment_storage (StorageSystem) – Separate storage system for attachments (only if needed)
no_attachments (bool) – True to not sync attachments
include_rejected (bool) – True to include rejected submissions
- Returns:
List of new submissions stored (submission ID strings)
- Return type:
list