Repository: aeye-lab/pymovements
Pull request #806 (2024-09-22 09:50:53)

added fakenews dataset
followed the format for copco 
- unsure about experimental setup: distance_cm & origin were not explicitly stated 
mirror link I'm not sure about but I think is correct? 
- do I need to cite the dataset? 

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/aeye-lab/pymovements/pull/806?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aeye-lab) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 99.93%. Comparing base [(`cc1559e`)](https://app.codecov.io/gh/aeye-lab/pymovements/commit/cc1559ecc2202766bd4a4571f37918024578d6b6?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aeye-lab) to head [(`131ee7a`)](https://app.codecov.io/gh/aeye-lab/pymovements/commit/131ee7acb378eea4c5e261b13ef9b48f95c1fd91?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aeye-lab).

<details><summary>Additional details and impacted files</summary>


```diff
@@             Coverage Diff             @@
##              main     #806      +/-   ##
===========================================
- Coverage   100.00%   99.93%   -0.07%     
===========================================
  Files           70       70              
  Lines         3202     3202              
  Branches       913      913              
===========================================
- Hits          3202     3200       -2     
- Misses           0        1       +1     
- Partials         0        1       +1     
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/aeye-lab/pymovements/pull/806?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aeye-lab).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aeye-lab).

SiQube: thank you for finding this dataset and the great contribution to our project!

there are some minor changes required, I added a review above.

additionally, there are some things missing:


to be able to access the dataset class, we need to add it to the in the [datasets init](https://github.com/aeye-lab/pymovements/blob/main/src/pymovements/datasets/__init__.py).
more specifically, alphabetically below EMTeC, [here](https://github.com/aeye-lab/pymovements/blob/main/src/pymovements/datasets/__init__.py#L52) and [here](https://github.com/aeye-lab/pymovements/blob/main/src/pymovements/datasets/__init__.py#L68)


additionally, please add the dataset to the [tests](https://github.com/aeye-lab/pymovements/blob/main/tests/unit/datasets/datasets_test.py)


lastly, we need to cite the paper in the docstring, and add the citation to the [bibliography](https://github.com/aeye-lab/pymovements/blob/main/docs/source/bibliography.bib)

Patch:
diff --git a/.gitignore b/.gitignore
index 4e4da2d..391b951 100644
--- a/.gitignore
+++ b/.gitignore
@@ -59,3 +59,4 @@ coverage.xml
 htmlcov/
 tests/preprocessed/
 toy_dataset/
+.DS_Store
diff --git a/docs/source/bibliography.bib b/docs/source/bibliography.bib
index 0603bb6..46f3c73 100644
--- a/docs/source/bibliography.bib
+++ b/docs/source/bibliography.bib
@@ -271,3 +271,14 @@ Milham, Michael P.},
   booktitle={Proceedings of the 18th ACM Conference on Embedded Networked Sensor Systems (SenSys)},
   year={2020}
 }
+
+@article{FakeNewsPerception,
+author = {Sümer, Ömer and Bozkir, Efe and Kübler, Thomas and Grüner, Sven and Utz, Sonja and Kasneci, Enkelejda},
+year = {2021},
+month = {03},
+pages = {106909},
+title = {FakeNewsPerception: An Eye Movement Dataset on the Perceived Believability of News Stories},
+volume = {35},
+journal = {Data in Brief},
+doi = {10.1016/j.dib.2021.106909}
+}
diff --git a/pylintrc b/pylintrc
index a020cb7..7bc80a6 100644
--- a/pylintrc
+++ b/pylintrc
@@ -103,6 +103,7 @@ disable=
     too-many-arguments,
     too-many-instance-attributes,
     too-many-locals,
+    too-many-positional-arguments,
 
 [REPORTS]
 
diff --git a/src/pymovements/datasets/__init__.py b/src/pymovements/datasets/__init__.py
index 8521fe5..d68e6c1 100644
--- a/src/pymovements/datasets/__init__.py
+++ b/src/pymovements/datasets/__init__.py
@@ -50,6 +50,7 @@
 from pymovements.datasets.copco import CopCo
 from pymovements.datasets.didec import DIDEC
 from pymovements.datasets.emtec import EMTeC
+from pymovements.datasets.fakenews import FakeNewsPerception
 from pymovements.datasets.gaze_graph import GazeGraph
 from pymovements.datasets.gaze_on_faces import GazeOnFaces
 from pymovements.datasets.gazebase import GazeBase
@@ -66,6 +67,7 @@ __all__ = [
     'CopCo',
     'DIDEC',
     'EMTeC',
+    'FakeNewsPerception',
     'GazeBase',
     'GazeBaseVR',
     'GazeGraph',
diff --git a/src/pymovements/datasets/fakenews.py b/src/pymovements/datasets/fakenews.py
new file mode 100644
index 0000000..c352dbf
--- /dev/null
+++ b/src/pymovements/datasets/fakenews.py
@@ -0,0 +1,128 @@
+# Copyright (c) 2022-2024 The pymovements Project Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+"""Provides a definition for the FakeNewsPerception dataset."""
+from __future__ import annotations
+
+from dataclasses import dataclass
+from dataclasses import field
+from typing import Any
+
+from pymovements.dataset.dataset_definition import DatasetDefinition
+from pymovements.dataset.dataset_library import register_dataset
+from pymovements.gaze.experiment import Experiment
+
+
+@register_dataset
+@dataclass
+class FakeNewsPerception(DatasetDefinition):
+    """FakeNewsPerception dataset :cite:p:`FakeNewsPerception`.
+
+    FakeNewsPerception dataset consists of eye movements during reading,
+    perceived believability scores, and questionnaires including Cognitive Reflection Test (CRT)
+    and News-Find-Me (NFM) perception, collected from 25 participants with 60 news items.
+    Eye movements are recorded to provide objective measures
+    of information processing during news reading.
+
+    For more details see :cite:p:`FakeNewsPerception`.
+
+    Attributes
+    ----------
+    name : str
+        The name of the dataset.
+    mirrors : tuple[str, ...]
+        A tuple of mirrors of the dataset. Each entry must be of type `str` and end with a '/'.
+    resources : tuple[dict[str, str], ...]
+        A tuple of dataset gaze_resources. Each list entry must be a dictionary with the following
+        keys:
+        - `resource`: The url suffix of the resource. This will be concatenated with the mirror.
+        - `filename`: The filename under which the file is saved as.
+        - `md5`: The MD5 checksum of the respective file.
+    experiment : Experiment
+        The experiment definition.
+    filename_format : str
+        Regular expression which will be matched before trying to load the file. Namedgroups will
+        appear in the `fileinfo` dataframe.
+    filename_format_dtypes : dict[str, type], optional
+        If named groups are present in the `filename_format`, this makes it possible to cast
+        specific named groups to a particular datatype.
+    column_map : dict[str, str]
+        The keys are the columns to read, the values are the names to which they should be renamed.
+    custom_read_kwargs : dict[str, Any], optional
+        If specified, these keyword arguments will be passed to the file reading function.
+    """
+
+    name: str = 'FakeNewsPerception'
+    has_files: dict[str, bool] = field(
+        default_factory=lambda: {
+            'gaze': False,
+            'precomputed_events': True,
+            'precomputed_reading_measures': False,
+        },
+    )
+    extract: dict[str, bool] = field(default_factory=lambda: {'precomputed_events': True})
+    mirrors: dict[str, tuple[str, ...]] = field(
+        default_factory=lambda: {
+            'precomputed_events': ('https://doi.org/10.7910/DVN/C1UD2A',),
+        },
+    )
+    resources: dict[str, tuple[dict[str, str], ...]] = field(
+        default_factory=lambda: {
+            'precomputed_events': (
+                {
+                    'resource': 'api/access/datafile/4200164',
+                    'filename': 'D3-Eye-movements-data.zip',
+                    'md5': 'ab009f28cd703f433e9b6c02b0bb38d2',
+                },
+            ),
+        },
+    )
+    experiment: Experiment = Experiment(
+        screen_width_px=1920,
+        screen_height_px=1080,
+        screen_width_cm=52.7,
+        screen_height_cm=29.6,
+        distance_cm=None,
+        origin=None,
+        sampling_rate=600,
+    )
+
+    filename_format: dict[str, str] = field(
+        default_factory=lambda: {
+            'precomputed_events': r'P{subject_id:d}_{session_id:d}_{truth_value:s}.csv',
+        },
+    )
+    filename_format_dtypes: dict[str, dict[str, type]] = field(
+        default_factory=lambda: {
+            'precomputed_events': {'subject_id': int, 'session_id': int, 'truth_value': str},
+        },
+    )
+    trial_columns: list[str] = field(default_factory=lambda: [])
+    time_column: str = 'starttime'
+    time_unit: str = 'milliseconds'
+    pixel_columns: list[str] = field(default_factory=lambda: [])
+    column_map: dict[str, str] = field(default_factory=lambda: {})
+    custom_read_kwargs: dict[str, Any] = field(
+        default_factory=lambda: {
+            'precomputed_events': {
+                'null_values': 'NA',
+                'quote_char': '"',
+            },
+        },
+    )


Test patch:
diff --git a/tests/functional/dataset_processing_test.py b/tests/functional/dataset_processing_test.py
index 74a3aa6..48abacb 100644
--- a/tests/functional/dataset_processing_test.py
+++ b/tests/functional/dataset_processing_test.py
@@ -215,7 +215,6 @@ def fixture_dataset_init_kwargs(request):
             filename_format_dtypes={'gaze': {}},
             trial_columns=None,
         ),
-
     }
     yield pm.dataset.Dataset(
         definition=init_param_dict[request.param],
diff --git a/tests/unit/datasets/datasets_test.py b/tests/unit/datasets/datasets_test.py
index aaca041..b717004 100644
--- a/tests/unit/datasets/datasets_test.py
+++ b/tests/unit/datasets/datasets_test.py
@@ -34,6 +34,7 @@ import pymovements as pm
         pytest.param(pm.datasets.CopCo, 'CopCo', id='CopCo'),
         pytest.param(pm.datasets.DIDEC, 'DIDEC', id='DIDEC'),
         pytest.param(pm.datasets.EMTeC, 'EMTeC', id='EMTeC'),
+        pytest.param(pm.datasets.FakeNewsPerception, 'FakeNewsPerception', id='FakeNewsPerception'),
         pytest.param(pm.datasets.GazeBase, 'GazeBase', id='GazeBase'),
         pytest.param(pm.datasets.GazeBaseVR, 'GazeBaseVR', id='GazeBaseVR'),
         pytest.param(pm.datasets.GazeOnFaces, 'GazeOnFaces', id='GazeOnFaces'),