from flask import Blueprint, request
from flask_cors import *

from service.phenotypePageService import introData, tblData

phenotype = Blueprint('phenotype', __name__)
CORS(phenotype, support_credentials=True)


@phenotype.route('/phenotypePage', methods=['GET'])
def phenotypeData():
    site = request.args.get('site')
    disease = request.args.get('phenotype')
    phenotypeIntro = introData(disease)
    phenotypeTbl = tblData(disease, site)
    result = {
        'phenotypeIntro': phenotypeIntro,
        'phenotypeTbl': phenotypeTbl
    }
    return result
