{
  "format": "dataset-manifest/1",
  "slug": "utility-billing",
  "version": 1,
  "seed": "utility-billing:1",
  "spec": {
    "format": "dataset/1",
    "slug": "utility-billing",
    "name": "Utility Billing",
    "tagline": "Modeling utility customer billing and consumption data.",
    "description": "Utility companies manage the delivery of electricity and other services to customers, tracking their usage and billing them accordingly. This dataset models various aspects of utility billing, including customers, their premises, meters, billing periods, and payment records. Each table is designed to capture important details about these entities and their relationships, allowing for comprehensive analysis of consumption patterns and payment behaviors. The tables link together seamlessly, enabling queries that can uncover insights such as average consumption per customer, payment trends, and discrepancies between estimated and actual meter readings. This synthetic dataset is ideal for practicing SQL queries, ORM seeding, and data analysis techniques, providing a realistic scenario to work with.",
    "domain": "energy",
    "shape": "transactional",
    "useCases": [
      "sql-practice",
      "orm-seeding"
    ],
    "keywords": [
      "utility",
      "billing",
      "customers",
      "meters",
      "payments",
      "energy",
      "consumption"
    ],
    "locale": "en",
    "license": "CC0-1.0",
    "version": 1,
    "tables": {
      "customers": {
        "description": "Each row represents a unique customer, linking to their associated premises and billing information.",
        "rows": 300,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each customer."
          },
          "full_name": {
            "kind": "fullName",
            "description": "The customer's full name."
          },
          "email": {
            "kind": "email",
            "from": "full_name",
            "description": "The customer's email address."
          },
          "phone": {
            "kind": "phone",
            "description": "Contact number for the customer."
          }
        }
      },
      "premises": {
        "description": "Details about each premises that customers occupy, linked to the respective customer.",
        "rows": 300,
        "via": "customer_id",
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each premises."
          },
          "customer_id": {
            "kind": "fk",
            "ref": "customers.id",
            "description": "Reference to the customer who owns this premises."
          },
          "address": {
            "kind": "sentence",
            "description": "Full address of the premises."
          },
          "postcode": {
            "kind": "postcode",
            "description": "Postal code for the premises."
          }
        }
      },
      "meters": {
        "description": "Information about utility meters installed at each premises, linking to the specific premises.",
        "rows": 300,
        "via": "premises_id",
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each meter."
          },
          "premises_id": {
            "kind": "fk",
            "ref": "premises.id",
            "description": "Reference to the premises where the meter is installed."
          },
          "serial_number": {
            "kind": "uuid",
            "description": "Unique serial number for the meter."
          }
        }
      },
      "billing_periods": {
        "description": "Each row represents a billing period for a premises, including consumption and charges.",
        "rows": 600,
        "via": "meter_id",
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each billing period."
          },
          "meter_id": {
            "kind": "fk",
            "ref": "meters.id",
            "description": "Reference to the meter associated with this billing period."
          },
          "start_date": {
            "kind": "date",
            "from": "2023-01-01",
            "to": "2023-12-31",
            "description": "Start date of the billing period.",
            "trend": "growing"
          },
          "end_date": {
            "kind": "date",
            "from": "2023-01-02",
            "to": "2024-01-01",
            "description": "End date of the billing period.",
            "trend": "growing"
          },
          "consumption": {
            "kind": "decimal",
            "min": 0,
            "max": 1000,
            "scale": 2,
            "description": "Total energy consumed during the billing period in kWh."
          },
          "estimated_read": {
            "kind": "decimal",
            "min": 0,
            "max": 1000,
            "scale": 2,
            "nullable": true,
            "description": "Estimated meter reading if actual reading is not available."
          },
          "actual_read": {
            "kind": "decimal",
            "min": 0,
            "max": 1000,
            "scale": 2,
            "nullable": true,
            "description": "Actual meter reading for the billing period."
          }
        }
      },
      "payments": {
        "description": "Records of payments made by customers for their utility bills, linked to specific billing periods.",
        "rows": 600,
        "via": "billing_period_id",
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each payment."
          },
          "billing_period_id": {
            "kind": "fk",
            "ref": "billing_periods.id",
            "description": "Reference to the billing period for which the payment was made."
          },
          "amount": {
            "kind": "decimal",
            "min": 0,
            "max": 500,
            "scale": 2,
            "description": "Amount paid by the customer."
          },
          "payment_date": {
            "kind": "date",
            "from": "2023-01-01",
            "to": "2024-01-01",
            "description": "Date when the payment was made.",
            "trend": "seasonal"
          },
          "payment_method": {
            "kind": "enum",
            "values": [
              "credit_card",
              "debit_card",
              "bank_transfer",
              "cash"
            ],
            "description": "Method of payment used by the customer."
          }
        }
      }
    },
    "structure": "multi-table",
    "traits": [
      "timestamped",
      "monetary",
      "nullable"
    ],
    "analysisQuestions": [
      "What is the average energy consumption per premises over a billing period?",
      "How do payment methods vary among customers?",
      "What percentage of readings are estimated versus actual?",
      "Which customers have the highest unpaid bills?",
      "How does consumption change seasonally?"
    ],
    "suggestedQueries": [
      {
        "title": "Join Customers and Payments",
        "sql": "SELECT customers.full_name, payments.amount FROM customers JOIN payments ON customers.id = payments.billing_period_id;",
        "dialect": "postgres"
      },
      {
        "title": "Average Consumption per Billing Period",
        "sql": "SELECT AVG(consumption) FROM billing_periods;",
        "dialect": "postgres"
      },
      {
        "title": "Payments by Method",
        "sql": "SELECT payment_method, SUM(amount) FROM payments GROUP BY payment_method;",
        "dialect": "postgres"
      },
      {
        "title": "Customers with Unpaid Bills",
        "sql": "SELECT customers.full_name FROM customers JOIN billing_periods ON customers.id = billing_periods.meter_id LEFT JOIN payments ON billing_periods.id = payments.billing_period_id WHERE payments.id IS NULL;",
        "dialect": "postgres"
      }
    ],
    "usageScenarios": [
      {
        "title": "Utility Company Analysis",
        "body": "Utility companies can utilize this dataset to analyze customer consumption patterns and payment behaviors. By querying the data, they can identify high consumption periods, track payment delinquency, and optimize billing strategies. This information can help improve customer service and operational efficiency."
      },
      {
        "title": "Data Science Projects",
        "body": "Data scientists can use this synthetic dataset to build machine learning models aimed at predicting customer behavior, such as payment likelihood based on consumption patterns. This can assist in identifying customers who may need financial support or those who are at risk of defaulting on payments."
      },
      {
        "title": "ORM Seeding",
        "body": "Developers can leverage this dataset for ORM seeding in applications related to utility billing management. By populating their databases with realistic customer and billing information, they can ensure their applications are robust and can handle real-world scenarios."
      }
    ]
  },
  "counts": {
    "customers": 300,
    "premises": 300,
    "meters": 300,
    "billing_periods": 600,
    "payments": 600
  },
  "stats": {
    "customers": {
      "rows": 300,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 300,
          "min": 1,
          "max": 300
        },
        "full_name": {
          "nulls": 0,
          "distinct": 291,
          "min": "Alice Carter",
          "max": "Zoe Johnson"
        },
        "email": {
          "nulls": 0,
          "distinct": 296
        },
        "phone": {
          "nulls": 0,
          "distinct": 284
        }
      }
    },
    "premises": {
      "rows": 300,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 300,
          "min": 1,
          "max": 300
        },
        "customer_id": {
          "nulls": 0,
          "distinct": 189,
          "min": 1,
          "max": 300
        },
        "address": {
          "nulls": 0,
          "distinct": 298
        },
        "postcode": {
          "nulls": 0,
          "distinct": 299,
          "min": 25,
          "max": 99420
        }
      }
    },
    "meters": {
      "rows": 300,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 300,
          "min": 1,
          "max": 300
        },
        "premises_id": {
          "nulls": 0,
          "distinct": 189,
          "min": 2,
          "max": 300
        },
        "serial_number": {
          "nulls": 0,
          "distinct": 300
        }
      }
    },
    "billing_periods": {
      "rows": 600,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 600,
          "min": 1,
          "max": 600
        },
        "meter_id": {
          "nulls": 0,
          "distinct": 251,
          "min": 1,
          "max": 300
        },
        "start_date": {
          "nulls": 0,
          "distinct": 286,
          "min": "2023-01-02",
          "max": "2023-12-31"
        },
        "end_date": {
          "nulls": 0,
          "distinct": 289,
          "min": "2023-01-03",
          "max": "2024-01-01"
        },
        "consumption": {
          "nulls": 0,
          "distinct": 599,
          "min": 2.28,
          "max": 998.64
        },
        "estimated_read": {
          "nulls": 62,
          "distinct": 536,
          "min": 0.52,
          "max": 999.82
        },
        "actual_read": {
          "nulls": 51,
          "distinct": 549,
          "min": 0.14,
          "max": 999.73
        }
      }
    },
    "payments": {
      "rows": 600,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 600,
          "min": 1,
          "max": 600
        },
        "billing_period_id": {
          "nulls": 0,
          "distinct": 386,
          "min": 1,
          "max": 599
        },
        "amount": {
          "nulls": 0,
          "distinct": 598,
          "min": 0.17,
          "max": 499.83
        },
        "payment_date": {
          "nulls": 0,
          "distinct": 280,
          "min": "2023-01-01",
          "max": "2024-01-01"
        },
        "payment_method": {
          "nulls": 0,
          "distinct": 4,
          "min": "bank_transfer",
          "max": "debit_card"
        }
      }
    }
  },
  "artifacts": [
    {
      "file": "csv/customers.csv",
      "format": "csv",
      "table": "customers",
      "key": "datasets/utility-billing/v1/csv/customers.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/utility-billing/v1/csv/customers.csv",
      "bytes": 16990,
      "sha256": "0ebf37539dfd6fd457c95d46ab74473680ef85fbf47fe5217c88f3336af6e337",
      "rows": 300,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/premises.csv",
      "format": "csv",
      "table": "premises",
      "key": "datasets/utility-billing/v1/csv/premises.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/utility-billing/v1/csv/premises.csv",
      "bytes": 21263,
      "sha256": "04f8f5b903c2e9122bd73382d95caeb74a2f8dd4af1af977c6cd24663b86d7e3",
      "rows": 300,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/meters.csv",
      "format": "csv",
      "table": "meters",
      "key": "datasets/utility-billing/v1/csv/meters.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/utility-billing/v1/csv/meters.csv",
      "bytes": 13604,
      "sha256": "30dba853c4db2a185561bec958532ba81774f4ba52119af6f80867db97fd1355",
      "rows": 300,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/billing_periods.csv",
      "format": "csv",
      "table": "billing_periods",
      "key": "datasets/utility-billing/v1/csv/billing_periods.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/utility-billing/v1/csv/billing_periods.csv",
      "bytes": 30078,
      "sha256": "6df5a9c83afca48372177d37b2ea826daa496554cfdcc51187dd3e69d549d196",
      "rows": 600,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/payments.csv",
      "format": "csv",
      "table": "payments",
      "key": "datasets/utility-billing/v1/csv/payments.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/utility-billing/v1/csv/payments.csv",
      "bytes": 22193,
      "sha256": "d2fc503d004a61389d1b40c1d35ad2db43c5d06201c2db758f771a904d0efda5",
      "rows": 600,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "utility-billing.json",
      "format": "json",
      "table": null,
      "key": "datasets/utility-billing/v1/utility-billing.json",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/utility-billing/v1/utility-billing.json",
      "bytes": 342561,
      "sha256": "b4741b485ccd9adf0f0c60abc4b2cb7cd3071a6a5904295cdafdb0e053343b45",
      "rows": null,
      "contentType": "application/json; charset=utf-8"
    },
    {
      "file": "sql/postgres.sql",
      "format": "sql-postgres",
      "table": null,
      "key": "datasets/utility-billing/v1/sql/postgres.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/utility-billing/v1/sql/postgres.sql",
      "bytes": 137138,
      "sha256": "b309d3f73b68319e3b2f84af37ecf474c3ce974732465aa44634d16aec9eb009",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/mysql.sql",
      "format": "sql-mysql",
      "table": null,
      "key": "datasets/utility-billing/v1/sql/mysql.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/utility-billing/v1/sql/mysql.sql",
      "bytes": 136583,
      "sha256": "9a951e752813bdf62b66ecad8d6ffb2f257ff4d855c80cf78a936507bbbba1cc",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/mssql.sql",
      "format": "sql-mssql",
      "table": null,
      "key": "datasets/utility-billing/v1/sql/mssql.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/utility-billing/v1/sql/mssql.sql",
      "bytes": 141122,
      "sha256": "5a9c6421dc60fbcd42e7885990259727e162c1f43a784fdb09357ac4b4d9f707",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/sqlite.sql",
      "format": "sql-sqlite",
      "table": null,
      "key": "datasets/utility-billing/v1/sql/sqlite.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/utility-billing/v1/sql/sqlite.sql",
      "bytes": 136383,
      "sha256": "c91619c3edf2bcb4d78abbdd9dc573c86b02eb1f7c5ab0822624d9b80641124b",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "prisma/seed.ts",
      "format": "prisma-seed",
      "table": null,
      "key": "datasets/utility-billing/v1/prisma/seed.ts",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/utility-billing/v1/prisma/seed.ts",
      "bytes": 272894,
      "sha256": "3dc8240a65fc432e4f8a71e6864c85c9f644853c79543970adea3833c5322a59",
      "rows": null,
      "contentType": "application/typescript; charset=utf-8"
    },
    {
      "file": "django/fixtures.json",
      "format": "django-fixture",
      "table": null,
      "key": "datasets/utility-billing/v1/django/fixtures.json",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/utility-billing/v1/django/fixtures.json",
      "bytes": 437317,
      "sha256": "4c8a55546408c7f37d4fa5364dcd5b65d64f392977973ad8135d2d218293a820",
      "rows": null,
      "contentType": "application/json; charset=utf-8"
    }
  ],
  "publishedAt": 1788734297133,
  "updatedAt": 1788734297133
}
