OpenPRA technical schema is based on the latest standards for Advanced Non-Light Water Reactor Nuclear Power Plants. This directory provides the formal definitions, examples, and documentation of the OpenPRA schema, enabling its use in both OpenPRA applications and other related applications in the nuclear domain.
To download the JSON Schema for technical elements, visit /schema-download.html
when running the documentation server. The schema can be used to validate your PRA data structures and ensure compliance with the OpenPRA technical elements specification.
The documentation uses several TypeScript concepts to define and organize the PRA technical elements:
A way to logically group related code elements. These namespaces reflect the PRA Elements in the standard.
namespace EventSequenceAnalysis {
// Contains all event sequence related types
}
A contract that defines the structure of an object, specifying what properties and methods it must have.
interface EventSequence {
sequenceId: string;
description: string;
initiatingEventId: string;
// ... other properties
}
Individual fields within an interface or type that define what data can be stored.
interface DesignInformation {
sourceId: string; // A property of type string
}
A named storage location for data that can hold values of specific types.
const EventSequenceAnalysisSchema = typia.json.application<[EventSequenceAnalysis]>();
// Stores the JSON validation schema for event sequences
A name given to a specific type or combination of types, making complex types more readable and reusable.
interface EndState {
name: "Controlled Release";
category: string;
releaseType: string;
classification: string;
}
A set of named constants that represent distinct values.
enum PreventionMitigationLevel {
FULL = "FULL",
PARTIAL = "PARTIAL",
NONE = "NONE"
}
A reusable block of code that performs a specific task, can accept parameters and return values.
function validateTemporalPhase(phase: TemporalPhase): boolean {
// Validates the timing and sequence of component states
return true;
}
Each of these concepts is used throughout the documentation to create a type-safe representation of PRA technical elements.
# Install dependencies
npm install
# Install Typedoc for documentation generation
npm install typedoc --save-dev
# Generate and serve documentation
npm run docs # Generates documentation
npm run serve # Serves documentation at http://localhost:8080
The documentation will be available at http://localhost:8080
.
The package includes a schema generation feature that allows you to generate JSON Schema definitions for various technical elements.
To generate schemas for specific elements, use the following command:
npm run generate-schema:element -- <element-name>
For example:
npm run generate-schema:element -- event-sequence-analysis
If you're in the root folder (openpra-monorepo
), you can run the command with the --project
flag to specify the package:
npm run generate-schema:element -- --project=shared-types event-sequence-analysis
This will generate JSON Schema definitions for the specified element, which can be used for validation and documentation purposes.
404 Errors: If you see 404 errors for module pages, try:
rm -rf docs
npm run docs
TypeDoc Warnings: Some warnings about undefined types are expected and won't affect the documentation generation.
Port Conflict Resolution: If you encounter a port conflict while serving documentation, you can specify a different port using the --port
option with npm run serve
. For example, to serve on port 8081 instead of the default 8080:
npm run serve -- --port 8081
If you encounter any issues with the documentation generation or serving:
# Remove generated documentation
rm -rf docs
# Remove dependencies and lock file
rm -rf node_modules
rm -f package-lock.json
# Reinstall dependencies
npm install
npm run docs
npm run serve
git checkout -b feature/your-feature-name
npm run docs
npm run serve
git add .
git commit -m "Description of changes"
git push origin feature/your-feature-name
File Visibility
index.ts
in the directory if not present:export * from './risk-integration/risk-integration';
tsconfig.json
's include
pathsDocumentation Comments
/** */
syntax/**
* Represents the risk integration configuration
* @interface RiskIntegration
*/
export interface RiskIntegration {
// ... properties
}
Verify Documentation
npm run docs
The OpenPRA Technical Elements package follows semantic versioning (MAJOR.MINOR.PATCH) to ensure clear communication of changes and maintain compatibility.
The package provides several npm scripts for version management:
# For bug fixes and documentation updates
npm run version:patch
# For new features or non-breaking changes
npm run version:minor
# For breaking schema changes
npm run version:major
# To verify version consistency
npm run version:check
A breaking change is defined as any change that:
Non-breaking changes include:
When making changes that require a version update:
For detailed version history and guidelines, see CHANGELOG.md.
The technical elements package uses a three-level versioning hierarchy to manage changes at different scopes:
SCHEMA_VERSION
constant{
metadata: {
versionInfo: {
version: "1.0.0", // Technical element version
schemaVersion: "0.1.0", // Must match SCHEMA_VERSION
lastUpdated: "2024-03-30",
deprecatedFields: []
}
}
}
// Package version (package.json)
"version": "0.1.0"
// Schema version (core/version.ts)
SCHEMA_VERSION = "0.1.0"
// Individual technical elements can have different versions
systemsAnalysis.metadata.versionInfo.version = "2.1.0"
eventSequenceAnalysis.metadata.versionInfo.version = "1.3.0"
// Both must have schemaVersion = "0.1.0"
For version update guidelines and procedures, see the Versioning section above.