Package: asreview-datatools
ASReview DatatoolsASReview Datatools is an extension toASReview
LABthat can be used to:Describebasic properties of a datasetConvertfile formatsDeduplicatedataStackmultiple datasetsComposea single (labeled, partly labeled, or unlabeled) dataset from multiple datasets.Severaltutorialsare available that show howASReview-Datatoolscan be used in different scenarios.ASReview datatools is available for ASReview LAB version 1 or later.
If you are using ASReview LAB version 0.x, useASReview-statisticsinstead of ASReview datatools.InstallationASReview Datatools requires Python 3.7+ andASReview LABversion 1.1 or later.The easiest way to install the extension is to install it from PyPI:pipinstallasreview-datatoolsAfter installation of the datatools extension,asreviewshould automatically
detect it. Test this with the following command:asreview--helpThe extension is successfully installed if it listsasreview data.Getting startedASReview Datatools is a command line tool that extends ASReview LAB. Each
subsection below describes one of the tools. The structure isasreviewdataNAME_OF_TOOLwhereNAME_OF_TOOLis the name of one of the tools below (describe,convert,dedup,vstack, orcompose)
followed by positional arguments and optional arguments.Each tool has its own help description which is available withasreviewdataNAME_OF_TOOL-hToolsData DescribeDescribe the content of a datasetasreviewdatadescribeMY_DATASET.csvExport the results to a file (output.json)asreviewdatadescribeMY_DATASET.csv-ooutput.jsonDescribe thevan_de_schoot_2017dataset from thebenchmark
platform.asreviewdatadescribebenchmark:van_de_schoot_2017-ooutput.json{
  "asreviewVersion": "1.0",
  "apiVersion": "1.0",
  "data": {
    "items": [
      {
        "id": "n_records",
        "title": "Number of records",
        "description": "The number of records in the dataset.",
        "value": 6189
      },
      {
        "id": "n_relevant",
        "title": "Number of relevant records",
        "description": "The number of relevant records in the dataset.",
        "value": 43
      },
      {
        "id": "n_irrelevant",
        "title": "Number of irrelevant records",
        "description": "The number of irrelevant records in the dataset.",
        "value": 6146
      },
      {
        "id": "n_unlabeled",
        "title": "Number of unlabeled records",
        "description": "The number of unlabeled records in the dataset.",
        "value": 0
      },
      {
        "id": "n_missing_title",
        "title": "Number of records with missing title",
        "description": "The number of records in the dataset with missing title.",
        "value": 5
      },
      {
        "id": "n_missing_abstract",
        "title": "Number of records with missing abstract",
        "description": "The number of records in the dataset with missing abstract.",
        "value": 764
      },
      {
        "id": "n_duplicates",
        "title": "Number of duplicate records (basic algorithm)",
        "description": "The number of duplicate records in the dataset based on similar text.",
        "value": 104
      }
    ]
  }
}Data ConvertConvert the format of a dataset. For example, convert a RIS dataset into a
CSV, Excel, or TAB dataset.asreview data convert MY_DATASET.ris MY_OUTPUT.csvData DedupRemove duplicate records with a simple and straightforward deduplication
algorithm. The algorithm first removes all duplicates based on a persistent
identifier (PID). Then it concatenates the title and abstract, whereafter it
removes all non-alphanumeric tokens. Then the duplicates are removed.asreview data dedup MY_DATASET.risExport the deduplicated dataset to a file (output.csv)asreview data dedup MY_DATASET.ris -o output.csvBy default, the PID is set to 'doi'. Thededupfunction offers the option to
use a different PID. Consider a dataset with PubMed identifiers (PMID), the
identifier can be used for deduplication.asreview data dedup MY_DATASET.csv -o output.csv --pid PMIDUsing thevan_de_schoot_2017dataset from thebenchmark
platform.asreviewdatadedupbenchmark:van_de_schoot_2017-ovan_de_schoot_2017_dedup.csvRemoved 104 records from dataset with 6189 records.Data Vstack (Experimental)Vertical stacking: combine as many datasets in the same file format as you want into a single dataset.❗ Vstack is an experimental feature. We would love to hear your feedback.
Please keep in mind that this feature can change in the future.Stack several datasets on top of each other:asreview data vstack output.csv MY_DATASET_1.csv MY_DATASET_2.csv MY_DATASET_3.csvHere, three datasets are exported into a single datasetoutput.csv.
The output path can be followed by any number of datasets to be stacked.This is an example using thedemo datasets:asreviewdatavstackoutput.risdataset_1.risdataset_2.risData Compose (Experimental)Compose is where datasets containing records with different labels (or no
labels) can be assembled into a single dataset.❗ Compose is an experimental feature. We would love to hear your feedback.
Please keep in mind that this feature can change in the future.Overview of possible input files and corresponding properties, use at least
one of the following arguments:ArgumentsAction--relevant,-rLabel all records from this dataset asrelevantin the composed dataset.--irrelevant,-iLabel all records from this dataset asirrelevantin the composed dataset.--labeled,-lUse existing labels from this dataset in the composed dataset.--unlabeled,-uRemove all labels from this dataset in the composed dataset.The output path should always be specified.Duplicate checking is based on title/abstract and a persistent identifier
(PID) like the digital object identifier (DOI). By default,doiis used as
PID. It is possible to use the flag--pidto specify a persistent
identifier other thandoi. In case duplicate records are detected, the user
is warned, and the conflicting records are shown. To specify what happens in
case of conflicts, use the--conflict_resolve/-cflag. This is set tokeep_oneby default, options are:Resolve methodAction in case of conflictkeep_oneKeep one label, using--hierarchyto determine which label to keepkeep_allKeep conflicting records as duplicates in the composed dataset (ignoring--hierarchy)abortAbortIn case of an ambiguously labeled record (e.g., one record with two different
labels), use--hierarchyto specify a hierarchy of labels. Pass the lettersr(relevant),i(irrelevant), andu(unlabeled) in any order to set
label hierarchy. By default, the order isriumeaning that relevant labels
are prioritized over irrelevant and unlabeled, and irrelevant labels are
prioritized over unlabeled ones.Asume you have records inMY_DATASET_1.risfrom which you want to keep all
existing labels and records inMY_DATASET_2.riswhich you want to keep
unlabeled. Both datasets can be composed into a single dataset using:asreviewdatacomposecomposed_output.ris-lMY_DATASET_1.ris-uMY_DATASET_2.ris-ouir-cabortBecause of the flag-c abortin case of conflicting/contradictory labels,
the user is warned, records with inconsistent labels are shown, and the script
is aborted. The flag-o uirresults in the following hierarch if any
duplicate ambiguously labeled records exist: unlabeled is prioritized over
irrelevant and relevant labels, and irrelevant labels are prioritized over
relevant labels.LicenseThis extension is published under theMIT license.ContactThis extension is part of the ASReview project (asreview.ai). It is maintained by the
maintainers of ASReview LAB. SeeASReview
LABfor contact information and more
resources.