@@ -10,10 +10,9 @@ class OMI(Base):
1010 def __init__ (
1111 self ,
1212 security_token : str ,
13+ control_area_domain : str , # Required - EIC code of Scheduling Area
1314 period_start : Optional [int ] = None ,
1415 period_end : Optional [int ] = None ,
15- # Domain parameters - required based on query type
16- control_area_domain : Optional [str ] = None ,
1716 # Alternative period parameters for update-based queries
1817 period_start_update : Optional [int ] = None ,
1918 period_end_update : Optional [int ] = None ,
@@ -30,11 +29,11 @@ def __init__(
3029
3130 Args:
3231 security_token: API security token
32+ control_area_domain: EIC code of Scheduling Area (required)
3333 period_start: Start period (YYYYMMDDHHMM format, optional if
34- period_start_update is defined)
34+ period_start_update and period_end_update are defined)
3535 period_end: End period (YYYYMMDDHHMM format, optional if
36- period_end_update is defined)
37- control_area_domain: EIC code of Scheduling Area (typically required)
36+ period_start_update and period_end_update are defined)
3837 period_start_update: Start of update period (YYYYMMDDHHMM format,
3938 mandatory if period_start and period_end not defined)
4039 period_end_update: End of update period (YYYYMMDDHHMM format,
@@ -48,13 +47,17 @@ def __init__(
4847
4948 Raises:
5049 ValueError: If doc_status is not one of A05, A09, A13
50+ ValueError: If neither (period_start, period_end) nor
51+ (period_start_update, period_end_update) are provided
5152
5253 Notes:
5354 - Document type is fixed to B47 (Other Market Information)
5455 - Used for various market notifications and information not covered
5556 by other specific document types
5657 - Supports both standard period queries and update-based queries
5758 - Time range limitations may apply depending on query type
59+ - Either (period_start, period_end) OR (period_start_update,
60+ period_end_update) must be provided
5861 """
5962 # Validate doc_status if provided
6063 if doc_status is not None :
@@ -64,25 +67,33 @@ def __init__(
6467 f"doc_status must be one of { valid_statuses } , got: { doc_status } "
6568 )
6669
70+ # Validate that either (period_start, period_end) or
71+ # (period_start_update, period_end_update) are provided
72+ has_period = period_start is not None and period_end is not None
73+ has_update_period = (
74+ period_start_update is not None and period_end_update is not None
75+ )
76+
77+ if not has_period and not has_update_period :
78+ raise ValueError (
79+ "Either (period_start, period_end) or "
80+ "(period_start_update, period_end_update) must be provided"
81+ )
82+
6783 # Initialize base parameters using proper encapsulation
6884 super ().__init__ (
6985 document_type = "B47" , # Fixed to B47 for Other Market Information
7086 security_token = security_token ,
7187 period_start = period_start ,
7288 period_end = period_end ,
7389 timeout = timeout ,
74- offset = offset ,
90+ offset = 0 , # Don't pass offset to base, we'll handle it with correct name
7591 )
7692
77- # Add update period parameters
78- self .add_update_params (
79- period_start_update = period_start_update ,
80- period_end_update = period_end_update ,
81- )
82-
83- # Add domain parameters
84- self .add_domain_params (control_area_domain = control_area_domain )
85-
86- # Add OMI-specific parameters
87- self .add_optional_param ("docStatus" , doc_status )
93+ # Add OMI-specific parameters using exact JSON parameter names
94+ self .add_optional_param ("ControlArea_Domain" , control_area_domain )
95+ self .add_optional_param ("DocStatus" , doc_status )
96+ self .add_optional_param ("PeriodStartUpdate" , period_start_update )
97+ self .add_optional_param ("PeriodEndUpdate" , period_end_update )
98+ self .add_optional_param ("Offset" , offset )
8899 self .add_optional_param ("mRID" , m_rid )
0 commit comments