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.2.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.2.0-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: openimis_be_api_etl-1.2.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.0

File hashes

Hashes for openimis_be_api_etl-1.2.0.tar.gz
Algorithm Hash digest
SHA256 00a628de4a978cb6abe25e258ed13e63260d1f003efbb7b7a9564f6aec963fd4
MD5 98c9c63d69de8ca33aa801359ce6965f
BLAKE2b-256 3e223ec73da52638bedc3f8c61e354751681fe703c2479f84fb37fdb982838ac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for openimis_be_api_etl-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ef4edbeff0f3f0a2c11e9696e643d1ed6428dbd53eca1b878d2b7b1f43ca2ee8
MD5 6a829c1eeb5b76543e5f7aca50f61886
BLAKE2b-256 abe054cc095e5d6af71753c509a313464c3adb6e08f0a1c69f854ae1d4bbb9ec

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