<commit_before>import os

from tornado.web import authenticated

from amgut.lib.config_manager import AMGUT_CONFIG
from amgut.util import AG_DATA_ACCESS
from amgut.handlers.base_handlers import BaseHandler
from amgut import media_locale


def _format_data_path(base, dir, barcode, ext):
    return os.path.join(base, dir, '.'.join([barcode, ext]))


class SampleOverviewHandler(BaseHandler):

    def _sample_overview_renderer(self):
        barcode = self.get_argument('barcode')

        sample_data = AG_DATA_ACCESS.getAGBarcodeDetails(barcode)

        fs_base = AMGUT_CONFIG.base_data_dir
        web_base = '/results'

        fs_barcode_pdf = _format_data_path(fs_base, 'pdfs', barcode, 'pdf')
        fs_barcode_txt = _format_data_path(fs_base, 'taxa-summaries', barcode,
                                        'txt')
        web_barcode_pdf = _format_data_path(web_base, 'pdfs', barcode, 'pdf')
        web_barcode_txt = _format_data_path(web_base, 'taxa-summaries',
                                            barcode, 'txt')

        if not os.path.exists(fs_barcode_pdf):
            web_barcode_pdf = None
        if not os.path.exists(fs_barcode_txt):
            web_barcode_txt = None

        sample_time = sample_data['sample_time']
        sample_date = sample_data['sample_date']<commit_msg>BUG: sitebase not honored, thanks @antgonza<commit_after>import os

from tornado.web import authenticated

from amgut.lib.config_manager import AMGUT_CONFIG
from amgut.util import AG_DATA_ACCESS
from amgut.handlers.base_handlers import BaseHandler
from amgut import media_locale


def _format_data_path(base, dir, barcode, ext):
    return os.path.join(base, dir, '.'.join([barcode, ext]))


class SampleOverviewHandler(BaseHandler):

    def _sample_overview_renderer(self):
        barcode = self.get_argument('barcode')

        sample_data = AG_DATA_ACCESS.getAGBarcodeDetails(barcode)

        fs_base = AMGUT_CONFIG.base_data_dir
        web_base = "%s/results" % media_locale['SITEBASE']

        fs_barcode_pdf = _format_data_path(fs_base, 'pdfs', barcode, 'pdf')
        fs_barcode_txt = _format_data_path(fs_base, 'taxa-summaries', barcode,
                                        'txt')
        web_barcode_pdf = _format_data_path(web_base, 'pdfs', barcode, 'pdf')
        web_barcode_txt = _format_data_path(web_base, 'taxa-summaries',
                                            barcode, 'txt')

        if not os.path.exists(fs_barcode_pdf):
            web_barcode_pdf = None
        if not os.path.exists(fs_barcode_txt):
            web_barcode_txt = None

        sample_time = sample_data['sample_time']
        sample_date = sample_data['sample_date']
{'fraction_non_alphanumeric': 0.08982482295937383, 'fraction_numerical': 0.0, 'mean_word_length': 2.9821958456973294, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3809539', 'n_tokens_mistral': 872, 'n_tokens_neox': 842, 'n_words': 161}