Giter Site home page Giter Site logo

nasa-ammos / seq-json-schema Goto Github PK

View Code? Open in Web Editor NEW
7.0 15.0 2.0 169 KB

Standardized JSON Schema for authoring multi-mission sequences.

Home Page: https://nasa-ammos.github.io/seq-json-schema/

License: MIT License

Python 11.17% JavaScript 19.90% TypeScript 53.28% HTML 3.23% Svelte 12.42%
aerospace json-schema schema sequencing spacecraft nasa planning multi-mission modeling command

seq-json-schema's Introduction

npm (scoped) PyPI

seq-json-schema

Standardized JSON Schema for authoring multi-mission sequences. You can read the schema definition here.
You can use our validation site to validate a .seq.json document against the latest schema.

JavaScript or TypeScript

Install

npm install @nasa-jpl/seq-json-schema --save

Basic Usage

import seqSchema from '@nasa-jpl/seq-json-schema/schema.json' assert { type: 'json' };
console.log(seqSchema);

TypeScript Types

This library also ships with automatically generated TypeScript types from the schema. For example:

import type { Command, SeqJson } from '@nasa-jpl/seq-json-schema/types';

const command: Command = {
  args: [],
  stem: 'SEND_DATA',
  time: { type: 'COMMAND_COMPLETE' },
  type: 'command',
};

const seqJson: SeqJson = {
  id: 'sequence0',
  metadata: {},
  steps: [command],
};

console.log(seqJson);

Python

Install

pip install seq-json-schema

Basic Usage

import importlib.resources
import json

with importlib.resources.path('seq-json-schema', 'schema.json') as schemaPath:
  file = open(schemaPath)
  schema = json.load(file)
  print(schema)

Note if you are using a Python version lower than 3.7 you will have to import the schema using the importlib-resources library.

seq-json-schema's People

Contributors

camargo avatar cohansen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

jpl-jengelke

seq-json-schema's Issues

Make argument format more explicit

We need to make the argument format more explicit for the args definitions. Here is the proposed new format:

{
  "name": "some_arg_name",
  "type": "number",
  "value": 0.0
}

Each argument type (string, number, boolean, symbol, hex, repeat), should have a type and value with an optional name.

Enforce repeat arg arrays have the same types

Currently the schema allows the following:

{
  "type": "repeat",
  "value": [
    [
      { "type": "number", "value": 10 },
      { "type": "string", "value": "another_test" },
      { "type": "boolean", "value": false }
    ],
    [
      { "type": "string", "value": "5" },
      { "type": "string", "value": "repeat_test" },
      { "type": "boolean", "value": true }
    ]
  ]
}

This is objectively wrong. Can we enforce each inner-array has the same set of types (in order)? Not sure if this is possible.

Make structure of all argument types consistent

Currently the step agrs types use both primitives and objects. For example strings, booleans, and numbers just use the base JSON schema primitive types (e.g. "", false, or 0.0).

Where hex or symbol arguments use the format { "hex": "0x0001AC34" } or { "symbol": "Local_Var_A" } respectively.

This task is to make the formats consistent. So for strings, booleans, and numbers we would use the format:

{ "string": "" }
{ "boolean": false }
{ "number": 0.0 }

This would make the format of args consistent for all args and thus make downstream parsing easier.

Step Time Schema Improvements

Capturing ideas from a couple different conversations for consideration here.

  1. Enforce in the schema that absolute, epoch-relative, and command-relative times all have the tag field populated
  2. Enforce a format on the tag fields (e.g., YYYY-DOYTHH:MM:SS[.sss] for absolute, [DOYT]H:MM:SS[.sss] for command-relative, and [+|-][DT]HH:MM:SS[.sss] for epoch-relative).

Handle repeat arguments in steps

This is to add arrays to the args to handle repeat arguments. For example for a command step this would look something like:

{
  "stem": "FAKE_COMMAND1",
  "args": [
    { "hex": "0xFFFFFFFF" },
    [
      [0, 1],
      [0, 1]
    ]
  ],
  "time": { "type": "COMMAND_COMPLETE" },
  "type": "command"
}

Where the second argument is a repeat arg with two repeating arguments, each consisting of two number arguments. The first argument is not a repeat arg.

SLIM integration: Infusion of Lab-approved documentation and templating standards

Checked for duplicates

Yes -- New feature, new files.

Alternatives considered

Yes - This is a Lab-approved and suggested addition to all NASA-AMMOS repositories.

Related problems

Many repos don't provide comprehensive documentation and/or are missing key areas of standardized documentation focus. This feature adds standardized documentation per Lab-approved standards.

Describe the feature request

A number of template and documentation files are being added to the repository in support of the SLIM project. These files are suggested by MGSS and will serve to promote cohesion between NASA-AMMOS products. The files provided are tailored to the current repository with minimal integration assistance and upkeep requested of the CogE and/or developers.

See commit history in the slim_infusion branch for added files.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.