Skip to main content

Tools to help manage external data for Harness CCM

Project description

harness-ccm-external-data

tools to help manage ingesting external data in harness ccm

the project is split into several parts:

  • converting external data formats to a compatible format for harness (focus)
  • uploading the converted data to the harness platform

loading data

when loading in a billing export we can apply a few modifications of the data to prepare it for ingestion into harness.

first, we convert any non-focus fields to their focus equivalent. this is done by providing a map of focus fields to their corresponding non-focus fields.

mapping = {
    "BillingAccountId": "Organization ID",
    "BillingAccountName": "Organization Name",
    ...
}

next we create a Focus object, specifying the platform, local billing export file, field mappings (if needed) and any data modifications needed:

from harness_ccm_external_data import Focus

my_data = Focus(
    "MyTestPlatform",
    "my_billing_export.csv",
    mappings={
        "BillingAccountId": "Organization ID",
        "BillingAccountName": "Organization Name",
        ...
    }
    # skip the first n rows of the billing data
    skip_rows=100,
    # you can also specify specific rows to skip
    # skip_rows=[0, 2, 4, 6, 8],
    # apply a multiplier to the cost (account for discounts not shown in the export?)
    cost_multiplier=0.95
    # if the csv is in a non-standard format
    separator=";"
    # apply a function to any column value
    converters={
        "ChargeCategory": lambda x: lower(x)
    }
)

now we can render the data to the harness platform format:

my_data.render_file("harness_focus_my_billing_export.csv")

development

pull the example focus csv: curl -LO https://raw.githubusercontent.com/FinOps-Open-Cost-and-Usage-Spec/FOCUS-Sample-Data/refs/heads/main/FOCUS-1.0/focus_sample.csv

install poetry

testing: make test

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

harness_ccm_external_data-0.1.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

harness_ccm_external_data-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file harness_ccm_external_data-0.1.0.tar.gz.

File metadata

  • Download URL: harness_ccm_external_data-0.1.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Linux/6.1.134-152.225.amzn2023.x86_64

File hashes

Hashes for harness_ccm_external_data-0.1.0.tar.gz
Algorithm Hash digest
SHA256 97465ae67518e84f8bf15792e84cfd0defdbd403b7a33fa7862a6832d28884fe
MD5 e79e3dd594fdb24656731dd87a8f99c5
BLAKE2b-256 799a246760910f28e0628a361074a8a7d1f908ed5b9a0529cd15af0dc6348112

See more details on using hashes here.

File details

Details for the file harness_ccm_external_data-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for harness_ccm_external_data-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d466efeb80ff5b0446ce3248bbf95376e21037a0ff6788f72109544b6f2f2c50
MD5 661d0e092c67425ef0a2f6570325330a
BLAKE2b-256 52396897aafc3f884e384ded432efe8895a10d7619802b8def246683c00352dc

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