diff --git a/src/process/twitter_visualization.py b/src/process/twitter_visualization.py index 17a29ba..b375a87 100644 --- a/src/process/twitter_visualization.py +++ b/src/process/twitter_visualization.py @@ -234,7 +234,7 @@ def report_histograms(sample: Sample) -> None: x = [f.data for f in sample.frequencies] title = f'COVID-related posting frequency for {sample.name}' report_histogram(x, f'freq/{sample.name}-hist-outliers.png', title, False, 100) - x = [p for p in x if p > 0.0005] + x = [p for p in x if p > 0.001] report_histogram(x, f'freq/{sample.name}-hist.png', title, True) x = [f.data for f in sample.popularity_ratios] @@ -259,7 +259,7 @@ def report_stats(samples: list[Sample]) -> None: Reporter('pop/stats.md').table(table, [s.name for s in samples], True) xs = [[d.data for d in s.frequencies if d.data > 0.0005] for s in samples] - table = tabulate_stats([get_statistics(remove_outliers(x)) for x in xs]) + table = tabulate_stats([get_statistics(x) for x in xs], percent=True) Reporter('freq/stats.md').table(table, [s.name for s in samples], True) @@ -289,7 +289,7 @@ def report_all() -> None: debug('Creating reports...') report_ignored(samples) - report_pop_stats(samples) + report_stats(samples) for s in samples: report_top_20_tables(s) report_histograms(s) diff --git a/src/report/report.py b/src/report/report.py index 895e9da..7a5cbfc 100644 --- a/src/report/report.py +++ b/src/report/report.py @@ -24,9 +24,16 @@ def generate_report() -> str: for i in range(len(md)): line = md[i] if line.startswith('@include'): - line = line[line.index('`') + 1:] - line = line[:line.index('`')] - md[i] = read(REPORT_DIR + line) + path = line[line.index('`') + 1:] + path = path[:path.index('`')] + md[i] = read(REPORT_DIR + path) + + if line.startswith('@include-cut'): + args = [int(i) for i in line.split()[2:]] + if len(args) == 1: + md[i] = '\n'.join(md[i].split('\n')[args[0]:]) + if len(args) == 2: + md[i] = '\n'.join(md[i].split('\n')[args[0]:args[1]]) return '\n'.join(md) diff --git a/src/report/report_document.md b/src/report/report_document.md index 4466eab..878aa5a 100644 --- a/src/report/report_document.md +++ b/src/report/report_document.md @@ -24,6 +24,10 @@ We might graph the frequencies on a histogram to gain more insight: (You can cli
