feat(iace): integrate ISO 12100 machine risk model with 4-factor assessment
All checks were successful
CI/CD / go-lint (push) Has been skipped
CI/CD / python-lint (push) Has been skipped
CI/CD / nodejs-lint (push) Has been skipped
CI/CD / test-go-ai-compliance (push) Successful in 36s
CI/CD / test-python-backend-compliance (push) Successful in 36s
CI/CD / test-python-document-crawler (push) Successful in 22s
CI/CD / test-python-dsms-gateway (push) Successful in 18s
CI/CD / validate-canonical-controls (push) Successful in 12s
CI/CD / Deploy (push) Successful in 2s
All checks were successful
CI/CD / go-lint (push) Has been skipped
CI/CD / python-lint (push) Has been skipped
CI/CD / nodejs-lint (push) Has been skipped
CI/CD / test-go-ai-compliance (push) Successful in 36s
CI/CD / test-python-backend-compliance (push) Successful in 36s
CI/CD / test-python-document-crawler (push) Successful in 22s
CI/CD / test-python-dsms-gateway (push) Successful in 18s
CI/CD / validate-canonical-controls (push) Successful in 12s
CI/CD / Deploy (push) Successful in 2s
Add dual-mode risk engine: legacy S×E×P (avoidance=0) and ISO mode S×F×P×A (avoidance>=1) with new thresholds (low/medium/high/very_high/not_acceptable). - 150+ hazard library entries across 28 categories incl. physical hazards (mechanical, electrical, thermal, pneumatic/hydraulic, noise/vibration, ergonomic, material/environmental) - 160-entry protective measures library with 3-step hierarchy validation (design → protective → information) - 25 lifecycle phases, 20 affected person roles, 50 evidence types - 10 verification methods (expanded from 7) - New API endpoints: lifecycle-phases, roles, evidence-types, protective-measures-library, validate-mitigation-hierarchy - DB migrations 018+019 for extended schema - Frontend: 4-slider risk assessment, hierarchy warnings, measures library modal - MkDocs wiki updated with ISO mode docs and legal notice (no norm text) All content uses original wording — norms referenced as methodology only. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,8 @@ const (
|
||||
ComponentTypeActuator ComponentType = "actuator"
|
||||
ComponentTypeController ComponentType = "controller"
|
||||
ComponentTypeNetwork ComponentType = "network"
|
||||
ComponentTypeMechanical ComponentType = "mechanical"
|
||||
ComponentTypeElectrical ComponentType = "electrical"
|
||||
ComponentTypeOther ComponentType = "other"
|
||||
)
|
||||
|
||||
@@ -75,11 +77,13 @@ const (
|
||||
type RiskLevel string
|
||||
|
||||
const (
|
||||
RiskLevelCritical RiskLevel = "critical"
|
||||
RiskLevelHigh RiskLevel = "high"
|
||||
RiskLevelMedium RiskLevel = "medium"
|
||||
RiskLevelLow RiskLevel = "low"
|
||||
RiskLevelNegligible RiskLevel = "negligible"
|
||||
RiskLevelNotAcceptable RiskLevel = "not_acceptable" // ISO 12100 mode: > 300
|
||||
RiskLevelVeryHigh RiskLevel = "very_high" // ISO 12100 mode: 151-300
|
||||
RiskLevelCritical RiskLevel = "critical"
|
||||
RiskLevelHigh RiskLevel = "high"
|
||||
RiskLevelMedium RiskLevel = "medium"
|
||||
RiskLevelLow RiskLevel = "low"
|
||||
RiskLevelNegligible RiskLevel = "negligible"
|
||||
)
|
||||
|
||||
// ReductionType represents the type of risk reduction measure
|
||||
@@ -105,10 +109,20 @@ const (
|
||||
type VerificationMethod string
|
||||
|
||||
const (
|
||||
VerificationMethodTest VerificationMethod = "test"
|
||||
VerificationMethodAnalysis VerificationMethod = "analysis"
|
||||
VerificationMethodInspection VerificationMethod = "inspection"
|
||||
VerificationMethodReview VerificationMethod = "review"
|
||||
VerificationMethodTest VerificationMethod = "test"
|
||||
VerificationMethodAnalysis VerificationMethod = "analysis"
|
||||
VerificationMethodInspection VerificationMethod = "inspection"
|
||||
VerificationMethodReview VerificationMethod = "review"
|
||||
VerificationMethodDesignReview VerificationMethod = "design_review"
|
||||
VerificationMethodCalculation VerificationMethod = "calculation"
|
||||
VerificationMethodTestReport VerificationMethod = "test_report"
|
||||
VerificationMethodValidation VerificationMethod = "validation"
|
||||
VerificationMethodElectricalTest VerificationMethod = "electrical_test"
|
||||
VerificationMethodSoftwareTest VerificationMethod = "software_test"
|
||||
VerificationMethodPenetrationTest VerificationMethod = "penetration_test"
|
||||
VerificationMethodAcceptanceProtocol VerificationMethod = "acceptance_protocol"
|
||||
VerificationMethodUserTest VerificationMethod = "user_test"
|
||||
VerificationMethodDocRelease VerificationMethod = "documentation_release"
|
||||
)
|
||||
|
||||
// TechFileSectionStatus represents the status of a technical file section
|
||||
@@ -143,6 +157,48 @@ const (
|
||||
AuditActionVerify AuditAction = "verify"
|
||||
)
|
||||
|
||||
// LifecyclePhase represents a machine lifecycle phase per ISO 12100 methodology
|
||||
type LifecyclePhase string
|
||||
|
||||
const (
|
||||
LPTransport LifecyclePhase = "transport"
|
||||
LPStorage LifecyclePhase = "storage"
|
||||
LPAssembly LifecyclePhase = "assembly"
|
||||
LPInstallation LifecyclePhase = "installation"
|
||||
LPCommissioning LifecyclePhase = "commissioning"
|
||||
LPParameterization LifecyclePhase = "parameterization"
|
||||
LPSetup LifecyclePhase = "setup"
|
||||
LPNormalOperation LifecyclePhase = "normal_operation"
|
||||
LPAutoOperation LifecyclePhase = "automatic_operation"
|
||||
LPManualOperation LifecyclePhase = "manual_operation"
|
||||
LPTeachMode LifecyclePhase = "teach_mode"
|
||||
LPProductionStart LifecyclePhase = "production_start"
|
||||
LPProductionStop LifecyclePhase = "production_stop"
|
||||
LPProcessMonitoring LifecyclePhase = "process_monitoring"
|
||||
LPCleaning LifecyclePhase = "cleaning"
|
||||
LPMaintenance LifecyclePhase = "maintenance"
|
||||
LPInspection LifecyclePhase = "inspection"
|
||||
LPCalibration LifecyclePhase = "calibration"
|
||||
LPFaultClearing LifecyclePhase = "fault_clearing"
|
||||
LPRepair LifecyclePhase = "repair"
|
||||
LPChangeover LifecyclePhase = "changeover"
|
||||
LPSoftwareUpdate LifecyclePhase = "software_update"
|
||||
LPRemoteMaintenance LifecyclePhase = "remote_maintenance"
|
||||
LPDecommissioning LifecyclePhase = "decommissioning"
|
||||
LPDisposal LifecyclePhase = "disposal"
|
||||
)
|
||||
|
||||
// ReviewStatus represents the review state of a hazard assessment
|
||||
type ReviewStatus string
|
||||
|
||||
const (
|
||||
ReviewStatusDraft ReviewStatus = "draft"
|
||||
ReviewStatusInReview ReviewStatus = "in_review"
|
||||
ReviewStatusReviewed ReviewStatus = "reviewed"
|
||||
ReviewStatusApproved ReviewStatus = "approved"
|
||||
ReviewStatusRejected ReviewStatus = "rejected"
|
||||
)
|
||||
|
||||
// ============================================================================
|
||||
// Main Entities
|
||||
// ============================================================================
|
||||
@@ -203,13 +259,24 @@ type RegulatoryClassification struct {
|
||||
type HazardLibraryEntry struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Category string `json:"category"`
|
||||
SubCategory string `json:"sub_category,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description,omitempty"`
|
||||
DefaultSeverity int `json:"default_severity"`
|
||||
DefaultProbability int `json:"default_probability"`
|
||||
DefaultExposure int `json:"default_exposure,omitempty"`
|
||||
DefaultAvoidance int `json:"default_avoidance,omitempty"`
|
||||
ApplicableComponentTypes []string `json:"applicable_component_types"`
|
||||
RegulationReferences []string `json:"regulation_references"`
|
||||
SuggestedMitigations json.RawMessage `json:"suggested_mitigations,omitempty"`
|
||||
TypicalCauses []string `json:"typical_causes,omitempty"`
|
||||
TypicalHarm string `json:"typical_harm,omitempty"`
|
||||
RelevantLifecyclePhases []string `json:"relevant_lifecycle_phases,omitempty"`
|
||||
RecommendedMeasuresDesign []string `json:"recommended_measures_design,omitempty"`
|
||||
RecommendedMeasuresTechnical []string `json:"recommended_measures_technical,omitempty"`
|
||||
RecommendedMeasuresInformation []string `json:"recommended_measures_information,omitempty"`
|
||||
SuggestedEvidence []string `json:"suggested_evidence,omitempty"`
|
||||
RelatedKeywords []string `json:"related_keywords,omitempty"`
|
||||
IsBuiltin bool `json:"is_builtin"`
|
||||
TenantID *uuid.UUID `json:"tenant_id,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
@@ -225,7 +292,16 @@ type Hazard struct {
|
||||
Description string `json:"description,omitempty"`
|
||||
Scenario string `json:"scenario,omitempty"`
|
||||
Category string `json:"category"`
|
||||
SubCategory string `json:"sub_category,omitempty"`
|
||||
Status HazardStatus `json:"status"`
|
||||
MachineModule string `json:"machine_module,omitempty"`
|
||||
Function string `json:"function,omitempty"`
|
||||
LifecyclePhase string `json:"lifecycle_phase,omitempty"`
|
||||
HazardousZone string `json:"hazardous_zone,omitempty"`
|
||||
TriggerEvent string `json:"trigger_event,omitempty"`
|
||||
AffectedPerson string `json:"affected_person,omitempty"`
|
||||
PossibleHarm string `json:"possible_harm,omitempty"`
|
||||
ReviewStatus ReviewStatus `json:"review_status,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
@@ -397,6 +473,14 @@ type CreateHazardRequest struct {
|
||||
Description string `json:"description,omitempty"`
|
||||
Scenario string `json:"scenario,omitempty"`
|
||||
Category string `json:"category" binding:"required"`
|
||||
SubCategory string `json:"sub_category,omitempty"`
|
||||
MachineModule string `json:"machine_module,omitempty"`
|
||||
Function string `json:"function,omitempty"`
|
||||
LifecyclePhase string `json:"lifecycle_phase,omitempty"`
|
||||
HazardousZone string `json:"hazardous_zone,omitempty"`
|
||||
TriggerEvent string `json:"trigger_event,omitempty"`
|
||||
AffectedPerson string `json:"affected_person,omitempty"`
|
||||
PossibleHarm string `json:"possible_harm,omitempty"`
|
||||
}
|
||||
|
||||
// AssessRiskRequest is the API request for performing a risk assessment
|
||||
@@ -467,6 +551,8 @@ type ProjectDetailResponse struct {
|
||||
// RiskSummaryResponse is the API response for an aggregated risk overview
|
||||
type RiskSummaryResponse struct {
|
||||
TotalHazards int `json:"total_hazards"`
|
||||
NotAcceptable int `json:"not_acceptable,omitempty"`
|
||||
VeryHigh int `json:"very_high,omitempty"`
|
||||
Critical int `json:"critical"`
|
||||
High int `json:"high"`
|
||||
Medium int `json:"medium"`
|
||||
@@ -476,6 +562,54 @@ type RiskSummaryResponse struct {
|
||||
AllAcceptable bool `json:"all_acceptable"`
|
||||
}
|
||||
|
||||
// LifecyclePhaseInfo represents a machine lifecycle phase with labels
|
||||
type LifecyclePhaseInfo struct {
|
||||
ID string `json:"id"`
|
||||
LabelDE string `json:"label_de"`
|
||||
LabelEN string `json:"label_en"`
|
||||
Sort int `json:"sort_order"`
|
||||
}
|
||||
|
||||
// RoleInfo represents an affected person role with labels
|
||||
type RoleInfo struct {
|
||||
ID string `json:"id"`
|
||||
LabelDE string `json:"label_de"`
|
||||
LabelEN string `json:"label_en"`
|
||||
Sort int `json:"sort_order"`
|
||||
}
|
||||
|
||||
// EvidenceTypeInfo represents an evidence/verification type with labels
|
||||
type EvidenceTypeInfo struct {
|
||||
ID string `json:"id"`
|
||||
Category string `json:"category"`
|
||||
LabelDE string `json:"label_de"`
|
||||
LabelEN string `json:"label_en"`
|
||||
Sort int `json:"sort_order"`
|
||||
}
|
||||
|
||||
// ProtectiveMeasureEntry represents a protective measure from the library
|
||||
type ProtectiveMeasureEntry struct {
|
||||
ID string `json:"id"`
|
||||
ReductionType string `json:"reduction_type"`
|
||||
SubType string `json:"sub_type,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
HazardCategory string `json:"hazard_category,omitempty"`
|
||||
Examples []string `json:"examples,omitempty"`
|
||||
}
|
||||
|
||||
// ValidateMitigationHierarchyRequest is the request for hierarchy validation
|
||||
type ValidateMitigationHierarchyRequest struct {
|
||||
HazardID uuid.UUID `json:"hazard_id" binding:"required"`
|
||||
ReductionType ReductionType `json:"reduction_type" binding:"required"`
|
||||
}
|
||||
|
||||
// ValidateMitigationHierarchyResponse is the response from hierarchy validation
|
||||
type ValidateMitigationHierarchyResponse struct {
|
||||
Valid bool `json:"valid"`
|
||||
Warnings []string `json:"warnings,omitempty"`
|
||||
}
|
||||
|
||||
// CompletenessGate represents a single gate in the project completeness checklist
|
||||
type CompletenessGate struct {
|
||||
ID string `json:"id"`
|
||||
|
||||
Reference in New Issue
Block a user