# W-ASMI Rule Implementation (DISABLED)

**HISTORY:**
###### 02/02/2026: ECARS-2278 - new rule W-ASMI 
###### 18/02/2026: ECARS-2312 - disable W-ASMI in Protocol=11. Reason: already included in W-SSMI 

## Overview
This document describes the implementation of the W-ASMI (All Stage variables are Missing/unknown) validation rule.

## Rule Positioning
The W-ASMI rule has been positioned:
- **STATUS**: DISABLED
- **Priority Level**: 7 (Cross-field validation rules)
- **Protocol**: ENCR 2020

## Rule Description
**Rule Code**: W-ASMI  
**Rule Type**: WARNING  
**Description**: W-ASMI: All TNM variables are missing/unknown, stage cannot be computed.  
**Protocol**: Incidence 2020 (Protocol ID: 11)  

### Rule Logic
The W-ASMI message must be produced only in the following condition:

IF (Stage=(Unknown value or blank)  
AND ((cT and pT) = (Unknown or blank))  
AND ((cN and pN) = (Unknown or blank))  
AND ((cM and pM) = (Unknown OR blank))

**Meaning**: Stage is missing, and it cannot be computed because all TNM variables are missing/unknown.

## Implementation Files

### 1. Java Implementation
**File**: `src/main/java/eu/europa/ec/jrc/qcs/engine/rule/crossfield/encr2020/StageVariablesAllMissingRule.java`

## Testing

### Expected Behavior

#### TEST Case 1 -> TRIGGER W-ASMI (Stage Missing, all TNM pairs Missing)
- **Stage**: (Empty/UNKNOWN)
- **TNM**: (Empty)

#### TEST Case 2 -> TRIGGER W-ASMI (Stage Unknown, all TNM pairs Unknown)
- **Stage**: "9" (Unknown)
- **TNM**: "9" (Unknown)

#### TEST Case 3 -> DOES NOT TRIGGER W-ASMI (Stage PRESENT)
- **Stage**: present (known)

#### TEST Case 4 -> DOES NOT TRIGGER W-ASMI (Stage Missing, at least one TNM pair present)
- **Stage**: (Empty/UNKNOWN)
- **Example**: cT="3" (known), pT=(Empty), while N and M pairs are missing/unknown

#### TEST Case 5 -> DOES NOT TRIGGER W-ASMI (Stage Missing, TNM present)
- **Stage**: (Empty/UNKNOWN)
- **Example**: T, N and M each have at least one known value

## Files Modified/Created

### quality-check-software project:
1. `src/main/java/eu/europa/ec/jrc/qcs/engine/rule/crossfield/encr2020/StageVariablesAllMissingRule.java` (NEW)
2. `docs/rules/W-ASMI/W-ASMI_rule_registration.sql` (NEW)
3. `docs/rules/W-ASMI/W-ASMI_IMPLEMENTATION_README.md` (NEW)

