Skip to content

Fixes #407 - Modify script to create report about DNR rules

Pedro Diogo Machado requested to merge 407-report_dnr_rules_by_filter into master

This modifies the "convertSubscription.js" script to add the functionality of generating a report. When converting the subscriptions to DNR rules we can extract information about the number of DNR rules that are generated, as well as the number of content x URL rules, and save this data as CSV files that can be consulted to provide insights about the filters that each subscription contains.

Usage: To call this code and generate the report you should run the subs-convert script and pass the flag --report true or -r true. Optionally, you can pass the --reportOutput or -ro to choose the directory where the report should be created. The default is "scriptsOutput/report". Example:

npm exec subs-convert -- -r true -ro data/report

This MR basically adds calls to the functions setUpCounter(), accountForRule(), writeSubsReport() and writeReportSummary() to the normal flow of the script and these functions will handle the calculations necessary to generate most of the data and the writing of the files. Also, in order not to add any modifications to the core, it was necessary to create a customCreateConverter() function which substitutes the default createConverter() and allow us to count the amount of URL x Content filters while the filters are being parsed.

Edited by Pedro Diogo Machado

Merge request reports