Skip to content

Data Quality Indicators

This part of the project documentation focuses on an information-oriented approach. Use it as a reference for the technical implementation of the pact_methodology project code.

Data Quality Indicators (DQIs) are used to assess the quality of data used in Pathfinder Framework calculations. These indicators are applied to different aspects of data quality, such as technological representativeness, temporal representativeness, geographical representativeness, completeness, and reliability.

Each DQI is represented as a set of attributes, including a reference period and various data quality ratings.

This module provides the DataQualityIndicators class to encapsulate and validate DQI values.

DataQualityIndicators

Represents quantitative data quality indicators.

Attributes:

Name Type Description
reference_period ReferencePeriod

The reference period for the data quality assessment.

coverage_percent float | None

Percentage of PCF included in the assessment (>5% emissions threshold).

technological_dqr DataQualityRating | None

Data quality rating for technological representativeness.

temporal_dqr DataQualityRating | None

Data quality rating for temporal representativeness.

geographical_dqr DataQualityRating | None

Data quality rating for geographical representativeness.

completeness_dqr DataQualityRating | None

Data quality rating for data completeness.

reliability_dqr DataQualityRating | None

Data quality rating for data reliability.

Examples:

>>> from pact_methodology.datetime import DateTime
>>> dqi = DataQualityIndicators(
...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
...     coverage_percent=50.0,
...     technological_dqr=DataQualityRating(3),
...     temporal_dqr=DataQualityRating(3),
...     geographical_dqr=DataQualityRating(3),
...     completeness_dqr=DataQualityRating(3),
...     reliability_dqr=DataQualityRating(3)
... )
>>> dqi.reference_period
ReferencePeriod(start=DateTime.now(), end=DateTime.now())
>>> dqi.coverage_percent
50.0
Source code in pact_methodology/data_quality_indicators/data_quality_indicators.py
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
class DataQualityIndicators:
    """
    Represents quantitative data quality indicators.

    Attributes:
        reference_period (ReferencePeriod): The reference period for the data quality assessment.
        coverage_percent (float | None): Percentage of PCF included in the assessment (>5% emissions threshold).
        technological_dqr (DataQualityRating | None): Data quality rating for technological representativeness.
        temporal_dqr (DataQualityRating | None): Data quality rating for temporal representativeness.
        geographical_dqr (DataQualityRating | None): Data quality rating for geographical representativeness.
        completeness_dqr (DataQualityRating | None): Data quality rating for data completeness.
        reliability_dqr (DataQualityRating | None): Data quality rating for data reliability.

    Examples:
        >>> from pact_methodology.datetime import DateTime
        >>> dqi = DataQualityIndicators(
        ...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
        ...     coverage_percent=50.0,
        ...     technological_dqr=DataQualityRating(3),
        ...     temporal_dqr=DataQualityRating(3),
        ...     geographical_dqr=DataQualityRating(3),
        ...     completeness_dqr=DataQualityRating(3),
        ...     reliability_dqr=DataQualityRating(3)
        ... )
        >>> dqi.reference_period
        ReferencePeriod(start=DateTime.now(), end=DateTime.now())
        >>> dqi.coverage_percent
        50.0
    """

    def __init__(
        self,
        *,
        reference_period: ReferencePeriod,
        coverage_percent: float | None = None,
        technological_dqr: DataQualityRating | None = None,
        temporal_dqr: DataQualityRating | None = None,
        geographical_dqr: DataQualityRating | None = None,
        completeness_dqr: DataQualityRating | None = None,
        reliability_dqr: DataQualityRating | None = None,
    ):
        """
        Initializes a new DataQualityIndicators instance.

        Args:
            reference_period (ReferencePeriod): The reference period for the data quality assessment.
            coverage_percent (float, optional): Defaults to None if before 2025.
            technological_dqr (DataQualityRating, optional): Defaults to None if before 2025.
            temporal_dqr (DataQualityRating, optional): Defaults to None if before 2025.
            geographical_dqr (DataQualityRating, optional): Defaults to None if before 2025.
            completeness_dqr (DataQualityRating, optional): Defaults to None if before 2025.
            reliability_dqr (DataQualityRating, optional): Defaults to None if before 2025.

        Raises:
            ValueError: If a required attribute is missing or None for reporting periods
                        including 2025 or later.

        Examples:
            >>> from pact_methodology.datetime import DateTime
            >>> dqi = DataQualityIndicators(
            ...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
            ...     coverage_percent=50.0,
            ...     technological_dqr=DataQualityRating(3),
            ...     temporal_dqr=DataQualityRating(3),
            ...     geographical_dqr=DataQualityRating(3),
            ...     completeness_dqr=DataQualityRating(3),
            ...     reliability_dqr=DataQualityRating(3)
            ... )
        """
        self.reference_period = reference_period
        self.coverage_percent = coverage_percent
        self.technological_dqr = technological_dqr
        self.temporal_dqr = temporal_dqr
        self.geographical_dqr = geographical_dqr
        self.completeness_dqr = completeness_dqr
        self.reliability_dqr = reliability_dqr

        required_attributes_after_2025 = [
            "coverage_percent",
            "technological_dqr",
            "temporal_dqr",
            "geographical_dqr",
            "completeness_dqr",
            "reliability_dqr",
        ]

        if reference_period is not None and reference_period.includes_2025_or_later():
            for attr in required_attributes_after_2025:
                if not hasattr(self, attr) or getattr(self, attr) is None:
                    raise ValueError(
                        f"Attribute '{attr}' must be defined and not None for reporting periods including 2025 or later"
                    )

    @property
    def reference_period(self):
        """
        Gets the reference period for the data quality assessment.

        Returns:
            ReferencePeriod: The reference period.
        """
        return self._reference_period

    @reference_period.setter
    def reference_period(self, value):
        """
        Sets the reference period for the data quality assessment.

        Args:
            value (ReferencePeriod): The reference period to set.

        Raises:
            ValueError: If value is not an instance of ReferencePeriod.

        Examples:
            >>> from pact_methodology.datetime import DateTime
            >>> dqi = DataQualityIndicators(
            ...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
            ...     coverage_percent=50.0,
            ...     technological_dqr=DataQualityRating(3),
            ...     temporal_dqr=DataQualityRating(3),
            ...     geographical_dqr=DataQualityRating(3),
            ...     completeness_dqr=DataQualityRating(3),
            ...     reliability_dqr=DataQualityRating(3)
            ... )
            >>> dqi.reference_period = ReferencePeriod(start=DateTime.now(), end=DateTime.now())
        """
        if not isinstance(value, ReferencePeriod):
            raise ValueError("reference_period must be an instance of ReferencePeriod")
        self._reference_period = value

    @property
    def coverage_percent(self):
        """
        Gets the coverage percentage of the PCF included in the assessment.

        Returns:
            float | None: The coverage percentage.
        """
        return self._coverage_percent

    @coverage_percent.setter
    def coverage_percent(self, value):
        """
        Sets the coverage percentage of the PCF included in the assessment.

        Args:
            value (float | None): The coverage percentage to set.

        Raises:
            ValueError: If value is not a number.

        Examples:
            >>> from pact_methodology.datetime import DateTime
            >>> dqi = DataQualityIndicators(
            ...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
            ...     coverage_percent=50.0,
            ...     technological_dqr=DataQualityRating(3),
            ...     temporal_dqr=DataQualityRating(3),
            ...     geographical_dqr=DataQualityRating(3),
            ...     completeness_dqr=DataQualityRating(3),
            ...     reliability_dqr=DataQualityRating(3)
            ... )
            >>> dqi.coverage_percent = 60.0
        """
        if value is not None and not isinstance(value, (int, float)):
            raise ValueError("coverage_percent must be a number")
        self._coverage_percent = value

    @property
    def technological_dqr(self):
        """
        Gets the data quality rating for technological representativeness.

        Returns:
            DataQualityRating | None: The technological data quality rating.
        """
        return self._technological_dqr

    @technological_dqr.setter
    def technological_dqr(self, value):
        """
        Sets the data quality rating for technological representativeness.

        Args:
            value (DataQualityRating | None): The technological data quality rating to set.

        Raises:
            TypeError: If value is not an instance of DataQualityRating.

        Examples:
            >>> from pact_methodology.datetime import DateTime
            >>> dqi = DataQualityIndicators(
            ...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
            ...     coverage_percent=50.0,
            ...     technological_dqr=DataQualityRating(3),
            ...     temporal_dqr=DataQualityRating(3),
            ...     geographical_dqr=DataQualityRating(3),
            ...     completeness_dqr=DataQualityRating(3),
            ...     reliability_dqr=DataQualityRating(3)
            ... )
            >>> dqi.technological_dqr = DataQualityRating(2)
        """
        if value is not None and not isinstance(value, DataQualityRating):
            raise TypeError("technological_dqr must be an instance of DataQualityRating")
        self._technological_dqr = value

    @property
    def temporal_dqr(self):
        """
        Gets the data quality rating for temporal representativeness.

        Returns:
            DataQualityRating | None: The temporal data quality rating.
        """
        return self._temporal_dqr

    @temporal_dqr.setter
    def temporal_dqr(self, value):
        """
        Sets the data quality rating for temporal representativeness.

        Args:
            value (DataQualityRating | None): The temporal data quality rating to set.

        Raises:
            TypeError: If value is not an instance of DataQualityRating.

        Examples:
            >>> from pact_methodology.datetime import DateTime
            >>> dqi = DataQualityIndicators(
            ...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
            ...     coverage_percent=50.0,
            ...     technological_dqr=DataQualityRating(3),
            ...     temporal_dqr=DataQualityRating(3),
            ...     geographical_dqr=DataQualityRating(3),
            ...     completeness_dqr=DataQualityRating(3),
            ...     reliability_dqr=DataQualityRating(3)
            ... )
            >>> dqi.temporal_dqr = DataQualityRating(2)
        """
        if value is not None and not isinstance(value, DataQualityRating):
            raise TypeError("temporal_dqr must be an instance of DataQualityRating")
        self._temporal_dqr = value

    @property
    def geographical_dqr(self):
        """
        Gets the data quality rating for geographical representativeness.

        Returns:
            DataQualityRating | None: The geographical data quality rating.
        """
        return self._geographical_dqr

    @geographical_dqr.setter
    def geographical_dqr(self, value):
        """
        Sets the data quality rating for geographical representativeness.

        Args:
            value (DataQualityRating | None): The geographical data quality rating to set.

        Raises:
            TypeError: If value is not an instance of DataQualityRating.

        Examples:
            >>> from pact_methodology.datetime import DateTime
            >>> dqi = DataQualityIndicators(
            ...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
            ...     coverage_percent=50.0,
            ...     technological_dqr=DataQualityRating(3),
            ...     temporal_dqr=DataQualityRating(3),
            ...     geographical_dqr=DataQualityRating(3),
            ...     completeness_dqr=DataQualityRating(3),
            ...     reliability_dqr=DataQualityRating(3)
            ... )
            >>> dqi.geographical_dqr = DataQualityRating(2)
        """
        if value is not None and not isinstance(value, DataQualityRating):
            raise TypeError("geographical_dqr must be an instance of DataQualityRating")
        self._geographical_dqr = value

    @property
    def completeness_dqr(self):
        """
        Gets the data quality rating for data completeness.

        Returns:
            DataQualityRating | None: The completeness data quality rating.
        """
        return self._completeness_dqr

    @completeness_dqr.setter
    def completeness_dqr(self, value):
        """
        Sets the data quality rating for data completeness.

        Args:
            value (DataQualityRating | None): The completeness data quality rating to set.

        Raises:
            TypeError: If value is not an instance of DataQualityRating.

        Examples:
            >>> from pact_methodology.datetime import DateTime
            >>> dqi = DataQualityIndicators(
            ...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
            ...     coverage_percent=50.0,
            ...     technological_dqr=DataQualityRating(3),
            ...     temporal_dqr=DataQualityRating(3),
            ...     geographical_dqr=DataQualityRating(3),
            ...     completeness_dqr=DataQualityRating(3),
            ...     reliability_dqr=DataQualityRating(3)
            ... )
            >>> dqi.completeness_dqr = DataQualityRating(2)
        """
        if value is not None and not isinstance(value, DataQualityRating):
            raise TypeError("completeness_dqr must be an instance of DataQualityRating")
        self._completeness_dqr = value

    @property
    def reliability_dqr(self):
        """
        Gets the data quality rating for data reliability.

        Returns:
            DataQualityRating | None: The reliability data quality rating.
        """
        return self._reliability_dqr

    @reliability_dqr.setter
    def reliability_dqr(self, value):
        """
        Sets the data quality rating for data reliability.

        Args:
            value (DataQualityRating | None): The reliability data quality rating to set.

        Raises:
            TypeError: If value is not an instance of DataQualityRating.

        Examples:
            >>> from pact_methodology.datetime import DateTime
            >>> dqi = DataQualityIndicators(
            ...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
            ...     coverage_percent=50.0,
            ...     technological_dqr=DataQualityRating(3),
            ...     temporal_dqr=DataQualityRating(3),
            ...     geographical_dqr=DataQualityRating(3),
            ...     completeness_dqr=DataQualityRating(3),
            ...     reliability_dqr=DataQualityRating(3)
            ... )
            >>> dqi.reliability_dqr = DataQualityRating(2)
        """
        if value is not None and not isinstance(value, DataQualityRating):
            raise TypeError("reliability_dqr must be an instance of DataQualityRating")
        self._reliability_dqr = value

    def __str__(self):
        """
        Returns the string representation of the data quality indicators.

        Returns:
            str: The string representation of the data quality indicators.

        Examples:
            >>> from pact_methodology.datetime import DateTime
            >>> dqi = DataQualityIndicators(
            ...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
            ...     coverage_percent=50.0,
            ...     technological_dqr=DataQualityRating(3),
            ...     temporal_dqr=DataQualityRating(3),
            ...     geographical_dqr=DataQualityRating(3),
            ...     completeness_dqr=DataQualityRating(3),
            ...     reliability_dqr=DataQualityRating(3)
            ... )
            >>> str(dqi)
            'DataQualityIndicators(reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()), coverage_percent=50.0, technological_dqr=DataQualityRating(3), temporal_dqr=DataQualityRating(3), geographical_dqr=DataQualityRating(3), completeness_dqr=DataQualityRating(3), reliability_dqr=DataQualityRating(3))'
        """
        return (
            f"DataQualityIndicators("
            f"reference_period={self.reference_period}, "
            f"coverage_percent={self.coverage_percent}, "
            f"technological_dqr={self.technological_dqr}, "
            f"temporal_dqr={self.temporal_dqr}, "
            f"geographical_dqr={self.geographical_dqr}, "
            f"completeness_dqr={self.completeness_dqr}, "
            f"reliability_dqr={self.reliability_dqr})"
        )

    def __repr__(self):
        """
        Returns the official string representation of the data quality indicators.

        Returns:
            str: The official string representation of the data quality indicators.

        Examples:
            >>> from pact_methodology.datetime import DateTime
            >>> dqi = DataQualityIndicators(
            ...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
            ...     coverage_percent=50.0,
            ...     technological_dqr=DataQualityRating(3),
            ...     temporal_dqr=DataQualityRating(3),
            ...     geographical_dqr=DataQualityRating(3),
            ...     completeness_dqr=DataQualityRating(3),
            ...     reliability_dqr=DataQualityRating(3)
            ... )
            >>> repr(dqi)
            'DataQualityIndicators(reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()), coverage_percent=50.0, technological_dqr=DataQualityRating(3), temporal_dqr=DataQualityRating(3), geographical_dqr=DataQualityRating(3), completeness_dqr=DataQualityRating(3), reliability_dqr=DataQualityRating(3))'
        """
        return (
            f"DataQualityIndicators("
            f"reference_period={repr(self.reference_period)}, "
            f"coverage_percent={repr(self.coverage_percent)}, "
            f"technological_dqr={repr(self.technological_dqr)}, "
            f"temporal_dqr={repr(self.temporal_dqr)}, "
            f"geographical_dqr={repr(self.geographical_dqr)}, "
            f"completeness_dqr={repr(self.completeness_dqr)}, "
            f"reliability_dqr={repr(self.reliability_dqr)})"
        )

    def __eq__(self, other):
        """
        Compares two DataQualityIndicators instances for equality.

        Args:
            other (DataQualityIndicators): The other DataQualityIndicators instance to compare.

        Returns:
            bool: True if the instances are equal, False otherwise.

        Examples:
            >>> from pact_methodology.datetime import DateTime
            >>> dqi1 = DataQualityIndicators(
            ...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
            ...     coverage_percent=50.0,
            ...     technological_dqr=DataQualityRating(3),
            ...     temporal_dqr=DataQualityRating(3),
            ...     geographical_dqr=DataQualityRating(3),
            ...     completeness_dqr=DataQualityRating(3),
            ...     reliability_dqr=DataQualityRating(3)
            ... )
            >>> dqi2 = DataQualityIndicators(
            ...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
            ...     coverage_percent=50.0,
            ...     technological_dqr=DataQualityRating(3),
            ...     temporal_dqr=DataQualityRating(3),
            ...     geographical_dqr=DataQualityRating(3),
            ...     completeness_dqr=DataQualityRating(3),
            ...     reliability_dqr=DataQualityRating(3)
            ... )
            >>> dqi1 == dqi2
            True
        """
        if not isinstance(other, DataQualityIndicators):
            return NotImplemented
        return (
            self.reference_period == other.reference_period
            and self.coverage_percent == other.coverage_percent
            and self.technological_dqr == other.technological_dqr
            and self.temporal_dqr == other.temporal_dqr
            and self.geographical_dqr == other.geographical_dqr
            and self.completeness_dqr == other.completeness_dqr
            and self.reliability_dqr == other.reliability_dqr
        )

completeness_dqr property writable

Gets the data quality rating for data completeness.

Returns:

Type Description

DataQualityRating | None: The completeness data quality rating.

coverage_percent property writable

Gets the coverage percentage of the PCF included in the assessment.

Returns:

Type Description

float | None: The coverage percentage.

geographical_dqr property writable

Gets the data quality rating for geographical representativeness.

Returns:

Type Description

DataQualityRating | None: The geographical data quality rating.

reference_period property writable

Gets the reference period for the data quality assessment.

Returns:

Name Type Description
ReferencePeriod

The reference period.

reliability_dqr property writable

Gets the data quality rating for data reliability.

Returns:

Type Description

DataQualityRating | None: The reliability data quality rating.

technological_dqr property writable

Gets the data quality rating for technological representativeness.

Returns:

Type Description

DataQualityRating | None: The technological data quality rating.

temporal_dqr property writable

Gets the data quality rating for temporal representativeness.

Returns:

Type Description

DataQualityRating | None: The temporal data quality rating.

__eq__(other)

Compares two DataQualityIndicators instances for equality.

Parameters:

Name Type Description Default
other DataQualityIndicators

The other DataQualityIndicators instance to compare.

required

Returns:

Name Type Description
bool

True if the instances are equal, False otherwise.

Examples:

>>> from pact_methodology.datetime import DateTime
>>> dqi1 = DataQualityIndicators(
...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
...     coverage_percent=50.0,
...     technological_dqr=DataQualityRating(3),
...     temporal_dqr=DataQualityRating(3),
...     geographical_dqr=DataQualityRating(3),
...     completeness_dqr=DataQualityRating(3),
...     reliability_dqr=DataQualityRating(3)
... )
>>> dqi2 = DataQualityIndicators(
...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
...     coverage_percent=50.0,
...     technological_dqr=DataQualityRating(3),
...     temporal_dqr=DataQualityRating(3),
...     geographical_dqr=DataQualityRating(3),
...     completeness_dqr=DataQualityRating(3),
...     reliability_dqr=DataQualityRating(3)
... )
>>> dqi1 == dqi2
True
Source code in pact_methodology/data_quality_indicators/data_quality_indicators.py
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
def __eq__(self, other):
    """
    Compares two DataQualityIndicators instances for equality.

    Args:
        other (DataQualityIndicators): The other DataQualityIndicators instance to compare.

    Returns:
        bool: True if the instances are equal, False otherwise.

    Examples:
        >>> from pact_methodology.datetime import DateTime
        >>> dqi1 = DataQualityIndicators(
        ...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
        ...     coverage_percent=50.0,
        ...     technological_dqr=DataQualityRating(3),
        ...     temporal_dqr=DataQualityRating(3),
        ...     geographical_dqr=DataQualityRating(3),
        ...     completeness_dqr=DataQualityRating(3),
        ...     reliability_dqr=DataQualityRating(3)
        ... )
        >>> dqi2 = DataQualityIndicators(
        ...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
        ...     coverage_percent=50.0,
        ...     technological_dqr=DataQualityRating(3),
        ...     temporal_dqr=DataQualityRating(3),
        ...     geographical_dqr=DataQualityRating(3),
        ...     completeness_dqr=DataQualityRating(3),
        ...     reliability_dqr=DataQualityRating(3)
        ... )
        >>> dqi1 == dqi2
        True
    """
    if not isinstance(other, DataQualityIndicators):
        return NotImplemented
    return (
        self.reference_period == other.reference_period
        and self.coverage_percent == other.coverage_percent
        and self.technological_dqr == other.technological_dqr
        and self.temporal_dqr == other.temporal_dqr
        and self.geographical_dqr == other.geographical_dqr
        and self.completeness_dqr == other.completeness_dqr
        and self.reliability_dqr == other.reliability_dqr
    )

__init__(*, reference_period, coverage_percent=None, technological_dqr=None, temporal_dqr=None, geographical_dqr=None, completeness_dqr=None, reliability_dqr=None)

Initializes a new DataQualityIndicators instance.

Parameters:

Name Type Description Default
reference_period ReferencePeriod

The reference period for the data quality assessment.

required
coverage_percent float

Defaults to None if before 2025.

None
technological_dqr DataQualityRating

Defaults to None if before 2025.

None
temporal_dqr DataQualityRating

Defaults to None if before 2025.

None
geographical_dqr DataQualityRating

Defaults to None if before 2025.

None
completeness_dqr DataQualityRating

Defaults to None if before 2025.

None
reliability_dqr DataQualityRating

Defaults to None if before 2025.

None

Raises:

Type Description
ValueError

If a required attribute is missing or None for reporting periods including 2025 or later.

Examples:

>>> from pact_methodology.datetime import DateTime
>>> dqi = DataQualityIndicators(
...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
...     coverage_percent=50.0,
...     technological_dqr=DataQualityRating(3),
...     temporal_dqr=DataQualityRating(3),
...     geographical_dqr=DataQualityRating(3),
...     completeness_dqr=DataQualityRating(3),
...     reliability_dqr=DataQualityRating(3)
... )
Source code in pact_methodology/data_quality_indicators/data_quality_indicators.py
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
def __init__(
    self,
    *,
    reference_period: ReferencePeriod,
    coverage_percent: float | None = None,
    technological_dqr: DataQualityRating | None = None,
    temporal_dqr: DataQualityRating | None = None,
    geographical_dqr: DataQualityRating | None = None,
    completeness_dqr: DataQualityRating | None = None,
    reliability_dqr: DataQualityRating | None = None,
):
    """
    Initializes a new DataQualityIndicators instance.

    Args:
        reference_period (ReferencePeriod): The reference period for the data quality assessment.
        coverage_percent (float, optional): Defaults to None if before 2025.
        technological_dqr (DataQualityRating, optional): Defaults to None if before 2025.
        temporal_dqr (DataQualityRating, optional): Defaults to None if before 2025.
        geographical_dqr (DataQualityRating, optional): Defaults to None if before 2025.
        completeness_dqr (DataQualityRating, optional): Defaults to None if before 2025.
        reliability_dqr (DataQualityRating, optional): Defaults to None if before 2025.

    Raises:
        ValueError: If a required attribute is missing or None for reporting periods
                    including 2025 or later.

    Examples:
        >>> from pact_methodology.datetime import DateTime
        >>> dqi = DataQualityIndicators(
        ...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
        ...     coverage_percent=50.0,
        ...     technological_dqr=DataQualityRating(3),
        ...     temporal_dqr=DataQualityRating(3),
        ...     geographical_dqr=DataQualityRating(3),
        ...     completeness_dqr=DataQualityRating(3),
        ...     reliability_dqr=DataQualityRating(3)
        ... )
    """
    self.reference_period = reference_period
    self.coverage_percent = coverage_percent
    self.technological_dqr = technological_dqr
    self.temporal_dqr = temporal_dqr
    self.geographical_dqr = geographical_dqr
    self.completeness_dqr = completeness_dqr
    self.reliability_dqr = reliability_dqr

    required_attributes_after_2025 = [
        "coverage_percent",
        "technological_dqr",
        "temporal_dqr",
        "geographical_dqr",
        "completeness_dqr",
        "reliability_dqr",
    ]

    if reference_period is not None and reference_period.includes_2025_or_later():
        for attr in required_attributes_after_2025:
            if not hasattr(self, attr) or getattr(self, attr) is None:
                raise ValueError(
                    f"Attribute '{attr}' must be defined and not None for reporting periods including 2025 or later"
                )

__repr__()

Returns the official string representation of the data quality indicators.

Returns:

Name Type Description
str

The official string representation of the data quality indicators.

Examples:

>>> from pact_methodology.datetime import DateTime
>>> dqi = DataQualityIndicators(
...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
...     coverage_percent=50.0,
...     technological_dqr=DataQualityRating(3),
...     temporal_dqr=DataQualityRating(3),
...     geographical_dqr=DataQualityRating(3),
...     completeness_dqr=DataQualityRating(3),
...     reliability_dqr=DataQualityRating(3)
... )
>>> repr(dqi)
'DataQualityIndicators(reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()), coverage_percent=50.0, technological_dqr=DataQualityRating(3), temporal_dqr=DataQualityRating(3), geographical_dqr=DataQualityRating(3), completeness_dqr=DataQualityRating(3), reliability_dqr=DataQualityRating(3))'
Source code in pact_methodology/data_quality_indicators/data_quality_indicators.py
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
def __repr__(self):
    """
    Returns the official string representation of the data quality indicators.

    Returns:
        str: The official string representation of the data quality indicators.

    Examples:
        >>> from pact_methodology.datetime import DateTime
        >>> dqi = DataQualityIndicators(
        ...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
        ...     coverage_percent=50.0,
        ...     technological_dqr=DataQualityRating(3),
        ...     temporal_dqr=DataQualityRating(3),
        ...     geographical_dqr=DataQualityRating(3),
        ...     completeness_dqr=DataQualityRating(3),
        ...     reliability_dqr=DataQualityRating(3)
        ... )
        >>> repr(dqi)
        'DataQualityIndicators(reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()), coverage_percent=50.0, technological_dqr=DataQualityRating(3), temporal_dqr=DataQualityRating(3), geographical_dqr=DataQualityRating(3), completeness_dqr=DataQualityRating(3), reliability_dqr=DataQualityRating(3))'
    """
    return (
        f"DataQualityIndicators("
        f"reference_period={repr(self.reference_period)}, "
        f"coverage_percent={repr(self.coverage_percent)}, "
        f"technological_dqr={repr(self.technological_dqr)}, "
        f"temporal_dqr={repr(self.temporal_dqr)}, "
        f"geographical_dqr={repr(self.geographical_dqr)}, "
        f"completeness_dqr={repr(self.completeness_dqr)}, "
        f"reliability_dqr={repr(self.reliability_dqr)})"
    )

__str__()

Returns the string representation of the data quality indicators.

Returns:

Name Type Description
str

The string representation of the data quality indicators.

Examples:

>>> from pact_methodology.datetime import DateTime
>>> dqi = DataQualityIndicators(
...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
...     coverage_percent=50.0,
...     technological_dqr=DataQualityRating(3),
...     temporal_dqr=DataQualityRating(3),
...     geographical_dqr=DataQualityRating(3),
...     completeness_dqr=DataQualityRating(3),
...     reliability_dqr=DataQualityRating(3)
... )
>>> str(dqi)
'DataQualityIndicators(reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()), coverage_percent=50.0, technological_dqr=DataQualityRating(3), temporal_dqr=DataQualityRating(3), geographical_dqr=DataQualityRating(3), completeness_dqr=DataQualityRating(3), reliability_dqr=DataQualityRating(3))'
Source code in pact_methodology/data_quality_indicators/data_quality_indicators.py
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
def __str__(self):
    """
    Returns the string representation of the data quality indicators.

    Returns:
        str: The string representation of the data quality indicators.

    Examples:
        >>> from pact_methodology.datetime import DateTime
        >>> dqi = DataQualityIndicators(
        ...     reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()),
        ...     coverage_percent=50.0,
        ...     technological_dqr=DataQualityRating(3),
        ...     temporal_dqr=DataQualityRating(3),
        ...     geographical_dqr=DataQualityRating(3),
        ...     completeness_dqr=DataQualityRating(3),
        ...     reliability_dqr=DataQualityRating(3)
        ... )
        >>> str(dqi)
        'DataQualityIndicators(reference_period=ReferencePeriod(start=DateTime.now(), end=DateTime.now()), coverage_percent=50.0, technological_dqr=DataQualityRating(3), temporal_dqr=DataQualityRating(3), geographical_dqr=DataQualityRating(3), completeness_dqr=DataQualityRating(3), reliability_dqr=DataQualityRating(3))'
    """
    return (
        f"DataQualityIndicators("
        f"reference_period={self.reference_period}, "
        f"coverage_percent={self.coverage_percent}, "
        f"technological_dqr={self.technological_dqr}, "
        f"temporal_dqr={self.temporal_dqr}, "
        f"geographical_dqr={self.geographical_dqr}, "
        f"completeness_dqr={self.completeness_dqr}, "
        f"reliability_dqr={self.reliability_dqr})"
    )