# delphi-data-health-configs

## Config management

How to add a new config or update an existing one? See [here](./tools/dh_config_generator/README.md)

## Repository management

`master` is the main branch in this repository.

`versions.json` contains versions of all configs in a repository.

Version of a config should be updated accordingly to (SemVer)[https://semver.org/]

## Config description

1. `data-health-configs` - contains events and procedures used by data-health-lambda

#### data-health-configs.json
    [
      {
        "data_type": "ads_data",
        "dsps": [
          "google",
          "facebook"
        ],
        "queries": [
          {
            "query": "call data_health.recalculate_internal_ads_data_status( {start_date}, {end_date}, {volatile_days} );",
            "db_type": "postgresql",
            "db_secret_key": "delphi/{env}/api/pg/data-health-user",
            "propagate_result": false
          },
          {
            "query": "call data_health.refresh_ads_data_health_to_internal_table( {start_date}, {end_date}, {target_dsp} );",
            "db_type": "postgresql",
            "db_secret_key": "delphi/{env}/api/pg/data-health-user",
            "propagate_result": false
          }
        ]
      },
    ...
    ]

- `data_type` - determines what data needs to be checked
- `dsps` - list of supported DSPs
- `queries` - list of queries to execute:
  - `query` - raw sql query
  - `db_type` - postgresql|snowflake
  - `db_secret_key` - db secret key
  - `propagate_result` - determines whether it is necessary to pass the result of the execute to the next query as params
