lattice

A framework for developing data models, including schema development and documentation.

https://github.com/bigladder/lattice

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (17.3%) to scientific vocabulary

Keywords

data-modeling schema
Last synced: 6 months ago · JSON representation

Repository

A framework for developing data models, including schema development and documentation.

Basic Info
  • Host: GitHub
  • Owner: bigladder
  • License: bsd-3-clause
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 3.14 MB
Statistics
  • Stars: 5
  • Watchers: 2
  • Forks: 0
  • Open Issues: 41
  • Releases: 4
Topics
data-modeling schema
Created about 5 years ago · Last pushed 6 months ago
Metadata Files
Readme License

README.md

Release

Build and Test

Web Documentation

Lattice

A Python package that provides support for a schema-based building data model framework, currently under development as ASHRAE Standard 232P, where schema are described in compliant YAML source files. Lattice performs:

  • Data model validation: Ensures the YAML schema source files are well-formed.
  • Schema generation: Translates the YAML schema source files into equivalent JSON Schema.
  • Data file validation: Validates data files against the generated JSON Schema and additional validation requirements not supported by JSON Schema (e.g., reference checking).
  • Data model documentation: Generates web documentation of the data model from the YAML schema source files and templated markdown files. This web documentation can be automatically deployed to GitHub pages.

Future additions under development include:

  • Generation of PDF documentation of the data model.
  • Generation of C/C++ source code for processing compliant data files.

Installing

To install Lattice, simply:

pip install lattice

Example Usage

lattice is Python package defining the Lattice class. Lattice relies on a predetermined structure of subdirectories:

  • schema (optional): Contains YAML source schema files describing the data model. Alternatively, if YAML source schema files are not provided in a "schema" directory, they must be in the root directory.
  • docs (optional): Contains markdown templates that are used to render model documentation. An optional subdirectory of "docs" called "web" contains additional content required for generating the web documentation including configuration settings, graphics, and supplementary content.
  • examples (optional): Example data files compliant with the data model.
  • cpp (optional):
    • base_classes (opt.): Base classes represent Data Group Templates. If no special functionality is required of those templates, this may remain empty.
    • extensions (opt.): User-supplied Python extensions inheriting from the CPP generator Python classes, Further information is available here.
    • config.yaml (opt.): A list of submodule names and URLs. See this example configuration.

The Lattice class is instantiated with the following parameters:

  • root_directory: This is the directory containing the source subdirectories.The default is the current working directory.

  • build_directory: This is the path to the directory where the content related to lattice is stored. The content itself will be located in a subdirectory determined by build_output_directory_name (below). It includes intermediate meta-schema(s), JSON Schema(s), generated markdown files, and the generated web documentation. The default is root_directory.

  • build_output_directory_name: The name of the lattice output content directory. The default is ".lattice/".

  • build_validation: A boolean indicator to automatically generate meta-schema, validate the data model, generate the schemas and validate the example data files upon instantiation. If false, these tasks must be executed after instantiation using the generate_meta_schemas, validate_schemas, generate_json_schemas, and validate_example_files methods. The default is True.

The repository's examples directory contains sample data models exemplifying different model options, such as Data Group Templates or scoped references.

More complete examples of projects using the ASHRAE Standard 232P framework include:

C++ Library Code Generation

Lattice's C++ code generation is achieved by calling the function generate_cpp_project(). (Extended configuration information is available here.)

Translations

Schema will be converted into C++ classes with the following mappings:

| Object Type | C++ type | |------------------- | -------- | | Data Group | struct | | Data Element | public data member | | Enumerator | enum | | Data Group Template | base class| |

| Data Type | C++ type | |------------------- | -------- | | Integer | int | | Numeric | float | | String | std::string | | {} | struct | | <> | enum | | [] | std::vector | | list "(A,B)" | std::unique_ptr<BaseOfAB>| |

Inheritance

The code generator will assume that Data Group schema elements with a Data Group Template parameter use that template as the element's superclass. An #include statement for the expected superclass file is listed at the top of the schema's implemenation (cpp) file (note: see Big Ladder file naming conventions). If the superclass file is not found, the C++ generator will create a stub for the class in the header associated with the schema. If it is found, any virtual functions in the superclass will appear as overridden function stubs in the subclassed Data Group's struct. Any additional code (members, methods) for the superclass itself must be provided by the lattice user.

In the event that the source schema contains a Data Element with a "selector constraint" (i.e. a list of possible Data Types combined with an associated list of possible enumerator values for the selector Data Element), the C++ generated code will assume that the Data Types in the list all derive from a common base class, named by the Data Group Template of the first Data Type in the list. (The Data Group Template may be defined in a different schema than the Data Type.) An #include statement for the base class will be generated, as above. The code that populates the Data Group (from_json, as indicated in the nlohmann::json library) will use a conditional statement to create a new object of the correct subclass and assign it to a member unique_ptr, calling directly the derived class' auto-generated from_json functions.

Note: If the first Data Type in a selector constraint list does not have a Data Group Template tag in its schema, the unique_ptr's base class may remain empty.

Build information

In addition to .h and .cpp files containing translated schema data, the code generator adds Git repository and CMake build support to the schema code, creating most of the structure necessary to test-build the schema code as a library. Necessary submodules are also downloaded as per config.yaml. To build a generated project, navigate to your lattice project's build directory, cpp subdirectory (e.g. /.lattice/cpp), and use a standard cmake build sequence:

cmake -B build

cmake --build build --config release

Owner

  • Name: Big Ladder Software
  • Login: bigladder
  • Kind: organization
  • Email: info@bigladdersoftware.com
  • Location: Denver, CO

Building Energy Simulation Tools

GitHub Events

Total
  • Issues event: 24
  • Delete event: 18
  • Issue comment event: 5
  • Push event: 81
  • Pull request review comment event: 5
  • Pull request event: 30
  • Pull request review event: 24
  • Create event: 19
Last Year
  • Issues event: 24
  • Delete event: 18
  • Issue comment event: 5
  • Push event: 81
  • Pull request review comment event: 5
  • Pull request event: 30
  • Pull request review event: 24
  • Create event: 19

Committers

Last synced: about 2 years ago

All Time
  • Total Commits: 145
  • Total Committers: 4
  • Avg Commits per committer: 36.25
  • Development Distribution Score (DDS): 0.469
Past Year
  • Commits: 32
  • Committers: 3
  • Avg Commits per committer: 10.667
  • Development Distribution Score (DDS): 0.438
Top Committers
Name Email Commits
Neal Kruis n****s@b****m 77
tanaya-bigladder 5****r 53
Tanaya Mankad t****d@b****m 14
Phil Ahrenkiel s****k@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 53
  • Total pull requests: 53
  • Average time to close issues: 12 months
  • Average time to close pull requests: about 1 month
  • Total issue authors: 3
  • Total pull request authors: 5
  • Average comments per issue: 0.21
  • Average comments per pull request: 0.49
  • Merged pull requests: 45
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 24
  • Pull requests: 30
  • Average time to close issues: 4 minutes
  • Average time to close pull requests: 16 days
  • Issue authors: 3
  • Pull request authors: 3
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.27
  • Merged pull requests: 26
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • nealkruis (35)
  • tanaya-mankad (17)
  • spahrenk (2)
Pull Request Authors
  • tanaya-mankad (30)
  • nealkruis (25)
  • tanaya-bigladder (3)
  • matthewbbrandt (2)
  • spahrenk (1)
Top Labels
Issue Labels
enhancement (20) not in ashrae 232 (8) docs (4) bug (1) documentation (1) cpp (1)
Pull Request Labels
enhancement (7) documentation (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 83 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 5
  • Total versions: 6
  • Total maintainers: 1
pypi.org: lattice

A framework for developing data models, including schema development and documentation.

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 5
  • Downloads: 83 Last month
Rankings
Dependent repos count: 6.6%
Dependent packages count: 10.1%
Average: 18.7%
Downloads: 21.8%
Stargazers count: 25.0%
Forks count: 29.8%
Maintainers (1)
Last synced: 6 months ago

Dependencies

poetry.lock pypi
  • astroid 2.8.2 develop
  • atomicwrites 1.4.0 develop
  • cloudpickle 2.0.0 develop
  • colorama 0.4.4 develop
  • doit 0.33.1 develop
  • isort 5.8.0 develop
  • lazy-object-proxy 1.6.0 develop
  • macfsevents 0.8.1 develop
  • mccabe 0.6.1 develop
  • more-itertools 8.10.0 develop
  • packaging 21.0 develop
  • platformdirs 2.4.0 develop
  • pluggy 0.13.1 develop
  • py 1.10.0 develop
  • pyinotify 0.9.6 develop
  • pylint 2.11.1 develop
  • pyparsing 2.4.7 develop
  • pytest 5.4.3 develop
  • toml 0.10.2 develop
  • typed-ast 1.4.3 develop
  • wcwidth 0.2.5 develop
  • wrapt 1.12.1 develop
  • attrs 21.2.0
  • cbor2 5.4.1
  • importlib-metadata 4.8.1
  • jinja2 3.0.2
  • jsonschema 4.0.0
  • markupsafe 2.0.1
  • pyrsistent 0.18.0
  • pyyaml 5.4.1
  • typing-extensions 3.10.0.2
  • zipp 3.6.0
pyproject.toml pypi
  • doit * develop
  • pylint * develop
  • pytest ^5.2 develop
  • Jinja2 *
  • cbor2 *
  • jsonschema *
  • python ^3.6
  • pyyaml *
.github/actions/setup-hugo/action.yml actions
  • MinoruSekine/setup-scoop main composite
  • actions/setup-node v3 composite
  • peaceiris/actions-hugo v2 composite
  • r-lib/actions/setup-pandoc v2 composite
.github/workflows/build-and-test.yaml actions
  • ./.github/actions/setup-hugo * composite
  • actions/checkout v3 composite
  • bigladder/github-actions/setup-python-poetry main composite
.github/workflows/release.yaml actions
  • ./.github/actions/setup-hugo * composite
  • actions/checkout v3 composite
  • bigladder/github-actions/setup-python-poetry main composite
  • peaceiris/actions-gh-pages v3 composite