Skip to main content

The openIMIS Backend api_etl reference module.

Project description

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:

  1. Extend the base Adapter class provided by the project.

    • Base Adapter class source: base.py
  2. Create a new class that inherits from this base class.

  3. Implement the required methods and logic in your subclass based on the data structure and behavior needed.

  4. 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openimis_be_api_etl-1.3.0.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openimis_be_api_etl-1.3.0-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file openimis_be_api_etl-1.3.0.tar.gz.

File metadata

  • Download URL: openimis_be_api_etl-1.3.0.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for openimis_be_api_etl-1.3.0.tar.gz
Algorithm Hash digest
SHA256 7572ddfa4f9966a0edf100789838790bd091d939f734a31c799415be91731301
MD5 0df4ec5d9db57ba719e988159010e364
BLAKE2b-256 fc9f3d508035cceeda9c28ec6e5aca7aed0835ab8f50164a6f79c799b068c10d

See more details on using hashes here.

File details

Details for the file openimis_be_api_etl-1.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for openimis_be_api_etl-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a66457601a6bee7db12ec105be2ce66fab43566bb0c979fe322b183b38d4aaa1
MD5 b481ef1df0e5ee5d595af55cdd48ac97
BLAKE2b-256 9162b92017633af011f9224d3ea967084291180b47d708da3e845915e5815bc5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page