Skip to main content

Analytic Schema

Note: This project has been discontinued. Please use Contract schema.

Analytic Schema is a lightweight Python package for loading, validating, and building standardized I/O documents for analytics notebooks based on a single, versioned JSON contract that drives both input parsing and output construction.

Table of Contents

Description

Analytic Schema centralizes your notebook or script I/O definitions into one authoritative JSON file. From that contract it automatically:

  • Generates a complete command-line interface (via argparse) for every input field.
  • Parses parameters provided as CLI flags, JSON dictionaries, or JSON files.
  • Injects sensible defaults for all optional inputs.
  • Performs deep schema validation (type checks, enums, date-time formats, oneOf branches, and no extra fields).
  • Builds structured output documents with embedded metadata, SHA-256 hashes for auditability, and a built-in logging mechanism.

With zero dependencies beyond the standard library and pandas, Analytic Schema is ideal for air-gapped notebooks, CI pipelines, or any environment where you need a robust, self-contained I/O layer for cybersecurity analytics.

Dependencies

This project depends only on the Python standard library (>=3.8) and pandas (>=1.0).

Installation

pip install analytic-schema

In your code:

import analytic_schema

Usage

Check out example_usage.py for a guided walkthrough. That script demonstrates how Analytic Schema handles all the I/O boilerplate, to include CLI parsing, default injection, validation, metadata, logging, hashing, and final serialization so you can focus on the core analytic logic.

Project structure

analytic-schema/ # Project repository
├── analytic_schema/ # Package
│   ├── __init__.py
│   ├── loader.py
│   ├── parser.py
│   ├── validator.py
│   ├── output.py
│   └── analytic_schema.json
│
├── tests/
│   └── test_analytic_schema.py
│
├── example_usage.py
│
├── README.md      # This file
├── LICENSE.md     # Project license
├── Makefile       # Project makefile
└── pyproject.toml

Background and Motivation

In cybersecurity analytics, consistency and auditability are paramount. Analysts and automation pipelines often spin up dozens of scripts and notebooks, each rolling its own argument parsing, validation, and output formatting. This fragmentation leads to subtle bugs, schema drift, and integration headaches.

Analytic Schema addresses these challenges by elevating your I/O contract to one single JSON schema. This contract drives:

  • Uniformity: All analytics share the same field names, types, and defaults.
  • Reliability: Fail-fast validation prevents runtime surprises from missing or mistyped parameters.
  • Traceability: Inputs and findings are hashed, and logs are captured inline, enabling full audit trails.
  • Simplicity: With only the standard library plus pandas, it works in air-gapped environments and keeps your dependencies minimal.

By abstracting away boilerplate, you can focus on detecting and investigating threats, while ensuring your pipelines remain robust, maintainable, and easily integrated.

Contributing

Contributions are welcome from all, regardless of rank or position.

There are no system requirements for contributing to this project. To contribute via the web:

  1. Click GitLab’s “Web IDE” button to open the online editor.
  2. Make your changes. Note: limit your changes to one part of one file per commit; for example, edit only the “Description” section here in the first commit, then the “Background and Motivation” section in a separate commit.
  3. Once finished, click the blue “Commit...” button.
  4. Write a detailed description of the changes you made in the “Commit Message” box.
  5. Select the “Create a new branch” radio button if you do not already have your own branch; otherwise, select your branch. The recommended naming convention for new branches is first.middle.last.
  6. Click the green “Commit” button.

You may also contribute to this project using your local machine by cloning this repository to your workstation, creating a new branch, committing and pushing your changes, and creating a merge request.

Contributors

This section lists project contributors. When you submit a merge request, remember to append your name to the bottom of the list below. You may also include a brief list of the sections to which you contributed.

  • Creator: Zachary Szewczyk

License

This project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. You can view the full text of the license in LICENSE.md. Read more about the license at the original author’s website. Generally speaking, this license allows individuals to remix this work provided they release their adaptation under the same license and cite this project as the original, and prevents anyone from turning this work or its derivatives into a commercial product.

Metadata

Release files for analytic-schema 1.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for analytic-schema 1.0.7
File Size Uploaded Provenance Actions
analytic_schema-1.0.7.tar.gz 26.2 kB Without provenance Details for analytic_schema-1.0.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for analytic-schema 1.0.7
File Interpreter ABI Platform Actions
analytic_schema-1.0.7-py3-none-any.whl Python 3 none any Details for analytic_schema-1.0.7-py3-none-any.whl

Total release size: 48.7 kB

Release files / analytic_schema-1.0.7.tar.gz

Download URL analytic_schema-1.0.7.tar.gz
Size 26.2 kB
Tags Source
SHA-256 checksum
How to use checksums
99b86892579e4e6da83bd63b146c10885c3ce95b4fc62af432520b5af41fecb7
BLAKE2b-256 checksum
How to use checksums
74b009d7d4332084b1ed0585a75da86973c4181714c0534809d54fa903743be5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release files / analytic_schema-1.0.7-py3-none-any.whl

Download URL analytic_schema-1.0.7-py3-none-any.whl
Size 22.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4eecf134383ba41acef21afdd74ad33488fb3a7146ab646e46f350e6eda71a89
BLAKE2b-256 checksum
How to use checksums
ef1671ef66d43d12bf8eb53bbeefbcd668ddcdffc1fee9a28cce8093d44bffed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Security for analytic-schema 1.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page