Once you have an idea what Types, methods, and ActionRuntimes you want in your Package, it's time to put it all together. This serves as an overview for the rules surrounding the creation of a C3 AI Suite package.

As an example, here is a typical directory tree you might find:

- repository.json
- myPackageDirectory
  - package.json
  - seed
    - CanonicalTypeName
      - TypeName.csv
    - FileSourceCollection
      - CanonicalTypeName.json
  - src
    - canonicals
      - CanonicalTypeName.c3typ
    - transforms
      - TransformCanonicalTypeNameToTypeName.c3typ
    - types
      - TypeName.c3typ
      - TypeName.py
      - TypeName.js
  - ui
    ...
- dependencyDirectory
  - package.json
  - seed
    ...
  - src
    ...
  - ui
    ...
...

Generally, at the top we have the 'repository.json' file. This describes the repository. Then, we have package subdirectories. One for each package. Within each package subdirectory, we have a 'package.json' file which describes the package, as detailed below.

repository.json File

At the top of your package you need a repository.json file. Here's an example from the base covid datalake repository:

{
  "name": "dtiTraining",
  "version": "1.0.0",
  "description": "DTI research/training environment",
  "dependencies": {
      "base": "7.12.0+1206",
      "c3aiDataLake": "1.0.4+4",
      "server": "7.12.0.10137"
  }
}

The fields of note here are:

  • name: The name of the repository.
  • version: The version of the repository.
  • description: A human readable description of the repository.
  • dependencies: A list of C3 AI Suite dependencies and their versions.

package.json File

Within the package subdirectory, we have the package.json file:

{
    "name": "baseCovidDataLake",
    "description": "Base Covid Datalake",
    "author": "Matthew Krafczyk <krafczyk.matthew@gmail.com>",
    "dependencies": [
        "covid19DataLake",
        "uiFramework"
    ]
}

The fields of note here are:

  • name: The name of the package.
  • description: A human readable description of the package.
  • author: The author of the package.
  • dependencies: A list of the dependencies required for this package.

Additional Resources

seed directory

The seed directory contains seed data for your package. This includes Data for canonicals, .json files defining metrics, AcitionRuntimes, and other Types such as FileSourceCollections.

Additional Resources

src directory

The src directory contains all the .c3typ and method implementation files your package needs. There is no rule about where specific .c3typ files should go, they should just be somewhere under the src directory. Usually people organize this directory into compartments for broad type categories such as 'types', 'canonicals', and 'transforms'. The implementation files should appear in the same directory as the Type definition that requires them.

Additional Resources

resource directory

See https://developer.c3.ai/docs/7.12.25/topic/resource.

ui directory

All files for your application UI are placed in the /ui/c3/meta subdirectory of your application package. This subdirectory contains the:

  • UI pages configuration files.
  • UI components configuration files.

The /ui/c3/meta/ directory of your package can be organized in any manner desired.

See the official C3 AI developer documentation here for more details.

  • No labels