Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate Manifold #24

Merged
merged 4 commits into from
Feb 9, 2025
Merged

Generate Manifold #24

merged 4 commits into from
Feb 9, 2025

Conversation

claytongentry
Copy link
Member

@claytongentry claytongentry commented Feb 9, 2025

Enables generating manifold configurations, including the ability to configure both simple and composite metrics contexts.

Changes

  • Added support for composite contexts in the schema generator
  • Each composite context maintains the same metric structure as base contexts
  • Contexts can be combined using logical operators (currently supporting AND)

Example Usage

Users can now define composite contexts in their manifold.yml:

contexts:
  total: TRUE
  paid: IS_PAID(context.location)
  organic: IS_ORGANIC(context.location)
  paidOrganic:
    fields:
      - paid
      - organic
    operator: AND

This will generate a schema with three context structs (paid, organic, and paidOrganic), each containing the same metric fields. For example, with the following metrics configuration:

metrics:
  countif: tapCount
  sumif:
    sequenceSum:
      field: context.sequence

the following schema manifold metrics schema will be produced:

{
    "type": "RECORD",
    "name": "metrics",
    "mode": "REQUIRED",
    "fields": [
      {
        "name": "total",
        "type": "RECORD",
        "mode": "NULLABLE",
        "fields": [
          {
            "name": "tapCount",
            "type": "INTEGER",
            "mode": "NULLABLE"
          },
          {
            "name": "sequenceSum",
            "type": "INTEGER",
            "mode": "NULLABLE"
          }
        ]
      },
      {
        "name": "paid",
        "type": "RECORD",
        "mode": "NULLABLE",
        "fields": [
          {
            "name": "tapCount",
            "type": "INTEGER",
            "mode": "NULLABLE"
          },
          {
            "name": "sequenceSum",
            "type": "INTEGER",
            "mode": "NULLABLE"
          }
        ]
      },
      {
        "name": "organic",
        "type": "RECORD",
        "mode": "NULLABLE",
        "fields": [
          {
            "name": "tapCount",
            "type": "INTEGER",
            "mode": "NULLABLE"
          },
          {
            "name": "sequenceSum",
            "type": "INTEGER",
            "mode": "NULLABLE"
          }
        ]
      },
      {
        "name": "paidOrganic",
        "type": "RECORD",
        "mode": "NULLABLE",
        "fields": [
          {
            "name": "tapCount",
            "type": "INTEGER",
            "mode": "NULLABLE"
          },
          {
            "name": "sequenceSum",
            "type": "INTEGER",
            "mode": "NULLABLE"
          }
        ]
      }
    ]
  }

@claytongentry claytongentry marked this pull request as ready for review February 9, 2025 16:27
@claytongentry claytongentry merged commit 5973b6d into master Feb 9, 2025
3 checks passed
@claytongentry claytongentry deleted the claytongentry/metrics branch February 18, 2025 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant