From 4d813e230debe8bf02df212e41b60d962dcac970 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 26 Sep 2026 13:10:03 -0700 Subject: [PATCH 1/2] add data contract yaml --- .../data_contracts/data_contract.yaml | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 data-science/data_contracts/data_contract.yaml diff --git a/data-science/data_contracts/data_contract.yaml b/data-science/data_contracts/data_contract.yaml new file mode 100644 index 00000000..38c24e2f --- /dev/null +++ b/data-science/data_contracts/data_contract.yaml @@ -0,0 +1,108 @@ +#Created using the editor at https://editor.datacontract.com +apiVersion: "v3.1.0" +kind: "DataContract" +id: "example-id" +version: "0.0.1" +status: "draft" +name: "Lucky Parking Data Contract" +schema: + - name: "single_data" + businessName: "Schema 1" + physicalType: "table" + properties: + - name: "region_type" + logicalType: "string" + required: true + primaryKey: false + quality: + - type: "library" + metric: "invalidValues" + description: "Region Type should be one of the valid region types" + mustBe: 0 + arguments: + validValues: + - "Neighborhood Council" + - "Zip Code" + - "Place (Radius)" + dimension: "conformity" + - name: "region" + logicalType: "string" + required: false + primaryKey: false + - name: "date_min" + logicalType: "date" + required: true + primaryKey: false + - name: "date_max" + logicalType: "date" + required: true + primaryKey: false + - name: "chart_type" + logicalType: "string" + required: false + primaryKey: false + quality: + - type: "library" + mustBe: 0 + metric: "invalidValues" + arguments: + validValues: + - "Total # Citations" + - "Citations per Sq. Mile (Density)" + - "Violation Type" + - "Total $ Fine Amount" + - "Fine $ Amount per Sq. Mile (Density)" + - "Day of the Week" + dimension: "conformity" + - name: "compare_mode" + businessName: "Schema 2" + physicalType: "table" + properties: + - name: "region_type" + logicalType: "string" + primaryKey: false + required: true + quality: + - type: "library" + metric: "invalidValues" + arguments: + validValues: + - "Neighborhood Council" + - "Zip Code" + - "Place (Radius)" + mustBe: 0 + description: "Region Type should be one of the valid region types" + dimension: "conformity" + - name: "region_1" + logicalType: "string" + required: false + primaryKey: false + - name: "region_2" + logicalType: "string" + required: false + primaryKey: false + - name: "date_min" + logicalType: "date" + required: true + primaryKey: false + - name: "date_max" + logicalType: "date" + required: true + primaryKey: false + - name: "chart_type" + logicalType: "string" + required: false + primaryKey: false + quality: + - type: "library" + mustBe: 0 + metric: "invalidValues" + arguments: + validValues: + - "Total # Citations" + - "Citations per Sq. Mile (Density)" + - "Violation Type" + - "Total $ Fine Amount" + - "Fine $ Amount per Sq. Mile (Density)" + - "Day of the Week" + dimension: "conformity" From 38d1430b18ec8c88dc37e4a32f7986ae832659cc Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 26 Sep 2026 14:35:38 -0700 Subject: [PATCH 2/2] add readme file --- data-science/data_contracts/README.md | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 data-science/data_contracts/README.md diff --git a/data-science/data_contracts/README.md b/data-science/data_contracts/README.md new file mode 100644 index 00000000..b00cb3e5 --- /dev/null +++ b/data-science/data_contracts/README.md @@ -0,0 +1,42 @@ +# Data Contracts + +This directory contains data contracts for the data science components of the Lucky Parking project. + +## What are Data Contracts? + +Data contracts are formal agreements between data producers and consumers that define the structure, quality, and semantics of data. They ensure data reliability and consistency across different components of the system. + +## Structure + +Each data contract specifies: +- Schema definition (fields, types, constraints) +- Data quality expectations (nullability, uniqueness, ranges) +- Semantic meaning of data elements +- Versioning information + +## Usage + +Data contracts are used by: +- Data validation pipelines +- ETL processes +- API interfaces between services +- Machine learning model training and inference + +## Files + +- `schema.json`: JSON Schema definitions for data entities +- `contracts.yaml`: YAML files describing specific data contracts +- `examples/`: Sample data instances that conform to the contracts + +## Contributing + +When adding or modifying data contracts: +1. Ensure backward compatibility where possible +2. Update version numbers appropriately +3. Provide clear documentation of changes +4. Add examples demonstrating correct usage +5. Update any dependent consumers of the contract + +## Maintenance + +Data contracts should be reviewed periodically to ensure they remain accurate reflections of the data being produced and consumed. \ No newline at end of file