# singer-io/tap-bing-ads architecture

> Architecture diagram of the GitHub repository singer-io/tap-bing-ads, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/singer-io/tap-bing-ads
- Repository: https://github.com/singer-io/tap-bing-ads

## Overview

tap-bing-ads is a Singer tap that extracts Microsoft Advertising account entities and analytics reports. Users configure credentials and stream selection, discover an access-filtered catalog, then sync selected data: entity streams cascade through accounts, campaigns, ad groups, and ads, while report streams run per account with date windows, asynchronous generation, polling, and CSV parsing. The map includes the shared stream runtime and report metadata. Some report-stream implementations were not sampled; their capabilities and async flow are documented in the README, while unverified implementation links are omitted.

Main entry points: [`tap_bing_ads/streams/abstracts.py`](https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/streams/abstracts.py) (Stream runtime), [`tap_bing_ads/sync.py`](https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/sync.py) (Sync coordinator), [`tap_bing_ads/schema.py`](https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/schema.py) (Schemas), [`tap_bing_ads/__init__.py`](https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/__init__.py) (Singer tap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Tap entry"]
  node_tap["Singer tap<br/>[__init__.py]"]
end

subgraph group_discovery["Catalog discovery"]
  node_discover["Catalog discovery<br/>[discover.py]"]
  node_schema["Schemas<br/>[schema.py]"]
  node_registry["Stream registry<br/>[__init__.py]"]
end

subgraph group_runtime["Sync runtime"]
  node_sync["Sync coordinator<br/>[sync.py]"]
  node_abstracts["Stream runtime<br/>[abstracts.py]"]
end

subgraph group_streams["Data streams"]
  node_accounts["Accounts<br/>[accounts.py]"]
  node_campaigns["Campaigns<br/>[campaigns.py]"]
  node_adgroups["Ad groups<br/>[ad_groups.py]"]
  node_ads["Ads<br/>[ads.py]"]
  node_performance["Performance reports"]
  node_audience["Audience reports"]
  node_otherreports["Other reports"]
end

subgraph group_support["Shared services"]
  node_client["REST client<br/>[client.py]"]
  node_reportmeta["Report metadata<br/>[reports.py]"]
  node_exclusions["Field exclusions<br/>[exclusions.py]"]
end

node_user(("Tap operator"))
node_api{{"Microsoft Advertising API"}}
node_singer(("Singer output"))

node_user -->|"runs"| node_tap
node_tap -->|"dispatches"| node_discover
node_tap -->|"dispatches"| node_sync
node_discover -->|"loads schemas"| node_schema
node_discover -->|"checks streams"| node_registry
node_schema -->|"builds stream schemas"| node_registry
node_schema -->|"uses report fields"| node_reportmeta
node_schema -->|"applies exclusions"| node_exclusions
node_sync -->|"instantiates streams"| node_registry
node_sync -->|"syncs selected stream"| node_accounts
node_sync -->|"syncs per account"| node_performance
node_sync -->|"syncs per account"| node_audience
node_sync -->|"syncs per account"| node_otherreports
node_accounts -->|"drives children"| node_campaigns
node_campaigns -->|"drives children"| node_adgroups
node_adgroups -->|"drives children"| node_ads
node_accounts -->|"uses runtime"| node_abstracts
node_campaigns -->|"uses runtime"| node_abstracts
node_adgroups -->|"uses runtime"| node_abstracts
node_ads -->|"uses runtime"| node_abstracts
node_performance -->|"uses report runtime"| node_abstracts
node_audience -->|"uses report runtime"| node_abstracts
node_otherreports -->|"uses report runtime"| node_abstracts
node_abstracts -->|"requests data"| node_client
node_abstracts -->|"uses report definitions"| node_reportmeta
node_abstracts -->|"validates fields"| node_exclusions
node_client -->|"calls REST API"| node_api
node_sync -->|"emits records"| node_singer

click node_tap "https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/__init__.py"
click node_discover "https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/discover.py"
click node_schema "https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/schema.py"
click node_registry "https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/streams/__init__.py"
click node_sync "https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/sync.py"
click node_accounts "https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/streams/accounts.py"
click node_campaigns "https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/streams/campaigns.py"
click node_adgroups "https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/streams/ad_groups.py"
click node_ads "https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/streams/ads.py"
click node_performance "https://github.com/singer-io/tap-bing-ads/tree/master/tap_bing_ads/streams"
click node_audience "https://github.com/singer-io/tap-bing-ads/tree/master/tap_bing_ads/streams"
click node_otherreports "https://github.com/singer-io/tap-bing-ads/tree/master/tap_bing_ads/streams"
click node_abstracts "https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/streams/abstracts.py"
click node_client "https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/client.py"
click node_reportmeta "https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/reports.py"
click node_exclusions "https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/exclusions.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_tap toneBlue
class node_discover,node_schema,node_registry toneAmber
class node_sync,node_abstracts,node_api toneMint
class node_accounts,node_campaigns,node_adgroups,node_ads,node_performance,node_audience,node_otherreports toneRose
class node_client,node_reportmeta,node_exclusions,node_user,node_singer toneIndigo
```

## Components

### Tap entry

- [Singer tap](https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/__init__.py): `tap_bing_ads/__init__.py`

### Catalog discovery

- [Catalog discovery](https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/discover.py): `tap_bing_ads/discover.py`
- [Schemas](https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/schema.py): `tap_bing_ads/schema.py`
- [Stream registry](https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/streams/__init__.py): `tap_bing_ads/streams/__init__.py`

### Sync runtime

- [Sync coordinator](https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/sync.py): `tap_bing_ads/sync.py`
- [Stream runtime](https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/streams/abstracts.py): `tap_bing_ads/streams/abstracts.py`

### Data streams

- [Accounts](https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/streams/accounts.py): `tap_bing_ads/streams/accounts.py`
- [Campaigns](https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/streams/campaigns.py): `tap_bing_ads/streams/campaigns.py`
- [Ad groups](https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/streams/ad_groups.py): `tap_bing_ads/streams/ad_groups.py`
- [Ads](https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/streams/ads.py): `tap_bing_ads/streams/ads.py`
- [Performance reports](https://github.com/singer-io/tap-bing-ads/tree/master/tap_bing_ads/streams): `tap_bing_ads/streams`
- [Audience reports](https://github.com/singer-io/tap-bing-ads/tree/master/tap_bing_ads/streams): `tap_bing_ads/streams`
- [Other reports](https://github.com/singer-io/tap-bing-ads/tree/master/tap_bing_ads/streams): `tap_bing_ads/streams`

### Shared services

- [REST client](https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/client.py): `tap_bing_ads/client.py`
- [Report metadata](https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/reports.py): `tap_bing_ads/reports.py`
- [Field exclusions](https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/exclusions.py): `tap_bing_ads/exclusions.py`

### Other components

- **Tap operator**
- **Microsoft Advertising API**
- **Singer output**

## Connections

- Tap operator → Singer tap: runs (evidence: `README.md`)
- Singer tap → Catalog discovery: dispatches (evidence: `tap_bing_ads/__init__.py`)
- Singer tap → Sync coordinator: dispatches (evidence: `tap_bing_ads/__init__.py`)
- Catalog discovery → Schemas: loads schemas (evidence: `tap_bing_ads/discover.py`)
- Catalog discovery → Stream registry: checks streams (evidence: `tap_bing_ads/discover.py`)
- Schemas → Stream registry: builds stream schemas (evidence: `tap_bing_ads/schema.py`)
- Schemas → Report metadata: uses report fields (evidence: `tap_bing_ads/schema.py`)
- Schemas → Field exclusions: applies exclusions (evidence: `tap_bing_ads/schema.py`)
- Sync coordinator → Stream registry: instantiates streams (evidence: `tap_bing_ads/sync.py`)
- Sync coordinator → Accounts: syncs selected stream (evidence: `tap_bing_ads/sync.py`)
- Sync coordinator → Performance reports: syncs per account (evidence: `tap_bing_ads/sync.py`)
- Sync coordinator → Audience reports: syncs per account (evidence: `tap_bing_ads/sync.py`)
- Sync coordinator → Other reports: syncs per account (evidence: `tap_bing_ads/sync.py`)
- Accounts → Campaigns: drives children (evidence: `README.md`)
- Campaigns → Ad groups: drives children (evidence: `README.md`)
- Ad groups → Ads: drives children (evidence: `README.md`)
- Accounts → Stream runtime: uses runtime (evidence: `tap_bing_ads/streams/accounts.py`)
- Campaigns → Stream runtime: uses runtime (evidence: `tap_bing_ads/streams/campaigns.py`)
- Ad groups → Stream runtime: uses runtime (evidence: `tap_bing_ads/streams/ad_groups.py`)
- Ads → Stream runtime: uses runtime (evidence: `tap_bing_ads/streams/ads.py`)
- Performance reports → Stream runtime: uses report runtime (evidence: `tap_bing_ads/streams/search_query_performance_report.py`)
- Audience reports → Stream runtime: uses report runtime (evidence: `tap_bing_ads/streams/age_gender_audience_report.py`)
- Other reports → Stream runtime: uses report runtime (evidence: `tap_bing_ads/streams/ad_extension_detail_report.py`)
- Stream runtime → REST client: requests data (evidence: `tap_bing_ads/streams/abstracts.py`)
- Stream runtime → Report metadata: uses report definitions (evidence: `tap_bing_ads/streams/abstracts.py`)
- Stream runtime → Field exclusions: validates fields (evidence: `tap_bing_ads/streams/abstracts.py`)
- REST client → Microsoft Advertising API: calls REST API (evidence: `README.md`)
- Sync coordinator → Singer output: emits records (evidence: `README.md`)
