<commit_before># Packages
from flask import Blueprint, Response
# PRoject
from datapunt_geosearch.datasource import AtlasDataSource, NapMeetboutenDataSource

health = Blueprint('health', __name__)


@health.route('/status/health', methods=['GET', 'HEAD', 'OPTIONS'])
def search_list():
    """Execute test query against datasources"""
    x, y, response_text = 120993, 485919, []
    # Trying to load the data sources
    try:
        atlas_dsn, nap_dsn = AtlasDataSource(), NapMeetboutenDataSource()
    except Exception as e:
        return repr(e), 500
    # Attempting to query
    try:
        results = atlas_dsn.query(x, y)
    except Exception as e:
        return repr(e), 500

    if results['type'] == 'Error':
        return Response(results['message'], content_type='text/plain', status=500)

    if not len(results['features']):
        response_text.append('No results from atlas dataset')

    results = nap_dsn.query(x, y)

    if not len(results['features']):
        response_text.append('No results from nap/meetbouten dataset')

    if not len(response_text):
        return Response(' - '.join(response_text), content_type='text/plain', status=500)

    return Response('Connectivity OK', content_type='text/plain')<commit_msg>TG-387 config changes also in health check<commit_after># Packages
from flask import Blueprint, Response, current_app
# PRoject
from datapunt_geosearch.datasource import AtlasDataSource, NapMeetboutenDataSource

health = Blueprint('health', __name__)


@health.route('/status/health', methods=['GET', 'HEAD', 'OPTIONS'])
def search_list():
    """Execute test query against datasources"""
    x, y, response_text = 120993, 485919, []
    # Trying to load the data sources
    try:
        atlas_dsn = AtlasDataSource(dsn=current_app.config['DSN_ATLAS'])
        nap_dsn = NapMeetboutenDataSource(dsn=current_app.config['DSN_NAP'])
    except Exception as e:
        return repr(e), 500
    # Attempting to query
    try:
        results = atlas_dsn.query(x, y)
    except Exception as e:
        return repr(e), 500

    if results['type'] == 'Error':
        return Response(results['message'], content_type='text/plain', status=500)

    if not len(results['features']):
        response_text.append('No results from atlas dataset')

    results = nap_dsn.query(x, y)

    if not len(results['features']):
        response_text.append('No results from nap/meetbouten dataset')

    if not len(response_text):
        return Response(' - '.join(response_text), content_type='text/plain', status=500)

    return Response('Connectivity OK', content_type='text/plain')
{'fraction_non_alphanumeric': 0.12194189602446483, 'fraction_numerical': 0.0194954128440367, 'mean_word_length': 3.9377358490566037, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4260249', 'n_tokens_mistral': 851, 'n_tokens_neox': 769, 'n_words': 210}