openIMIS Backend api_etl reference module
API ETL Configuration and Adapter Extension Guide
Default Configuration Example
The following is a sample configuration (DEFAULT_CONFIG) that enables connection to an example API. This configuration is used to control authentication, data source connection, and field mappings for an adapter:
DEFAULT_CONFIG = {
"auth_type": "basic", # Options: noauth, basic, bearer
"auth_basic_username": "<USERNAME>", # Basic auth username
"auth_basic_password": "<PASSWORD>", # Basic auth password
"auth_bearer_token": "", # Bearer token for 'bearer' auth_type
"source_http_method": "post", # HTTP method for requests.request
"source_url": "http://41.175.18.170:8070/api/mobile/v1/beneficiary/active/search",
"source_headers": {
"Content-Type": "application/x-www-form-urlencodedc",
"Accept": "application/json"
},
"source_batch_size": 50, # Number of records to fetch in one batch
"adapter_first_name_field": "firstName",
"adapter_last_name_field": "lastName",
"adapter_dob_field": "dateOfBirth",
"skip_integration_test": False # Must be False for production deployments
}
Creating a New Adapter
To implement a new adapter, you must:
-
Extend the base Adapter class provided by the project.
- Base Adapter class source:
base.py
- Base Adapter class source:
-
Create a new class that inherits from this base class.
- Reference implementation:
exampleIndividialAdapter.py
- Reference implementation:
-
Implement the required methods and logic in your subclass based on the data structure and behavior needed.
-
Register the adapter in the appropriate place if required for discovery or configuration.
Example
from api_etl.adapters.base import BaseAdapter
class MyCustomAdapter(BaseAdapter):
def transform(self, record):
# Implement transformation logic here
pass
This modular architecture allows easy customization and extension to support different data sources and APIs.
Metadata
Release files for openimis-be-api-etl 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| openimis_be_api_etl-1.3.0.tar.gz | 14.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| openimis_be_api_etl-1.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.5 kB
Release files / openimis_be_api_etl-1.3.0.tar.gz
| Download URL | openimis_be_api_etl-1.3.0.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7572ddfa4f9966a0edf100789838790bd091d939f734a31c799415be91731301
|
|
BLAKE2b-256 checksum How to use checksums |
fc9f3d508035cceeda9c28ec6e5aca7aed0835ab8f50164a6f79c799b068c10d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Release files / openimis_be_api_etl-1.3.0-py3-none-any.whl
| Download URL | openimis_be_api_etl-1.3.0-py3-none-any.whl |
|---|---|
| Size | 21.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a66457601a6bee7db12ec105be2ce66fab43566bb0c979fe322b183b38d4aaa1
|
|
BLAKE2b-256 checksum How to use checksums |
9162b92017633af011f9224d3ea967084291180b47d708da3e845915e5815bc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|