<commit_before>import React from 'react';
import {Loader} from './components/Loader'
import { Query} from '@labkey/api';

// Styling imports
import './DataAccess.scss';

interface QueryInfo {
    schema: string;
    query: string;
    label: string
}

const analyzedResults = [
    {schema: "study", query: "fcs_analyzed_result", label: "Flow cytometry analyzed results"},
    {schema: "gene_expression", query: "DGEA_filteredGEAR", label: "Differential gene expression analysis results"}
]; 

const demographicsQuery = {schema: "study", query: "demographics", label: "Demographics"}

const getQueries = () => {
    return new Promise((resolve, reject) => {
        const res = Query.selectRows({
            schemaName: 'study',
            queryName: 'ISC_datasets',
            failure: (error) => {
                reject(error.exception) },
            success: (data) => {
                resolve(data) }
        })
    })
}


export const DataAccess: React.FC = () => {
    const [selectedQuery, setSelectedQuery] = React.useState<QueryInfo>({schema: "study", query: "demographics", label: "Demographics"})
    const [webpartReady, setWebpartReady] = React.useState<Boolean>(false)
    const [dropdownConfig, setDropdownConfig] = React.useState(null)

    React.useEffect(() => {
        getQueries().then((data: any) => {
            const rows = data.rows
            const ds = rows.map(row => ({schema: "study", query: row.Name, label: row.Label}))
            const dc = {
                text: "Choose Dataset",
                items: [
                    {
                        text: "Demographics",
                        handler: () => setSelectedQuery(demographicsQuery)
                    },
                    {
                        text: "Assays",
                        items: ds.map((queryInfo) => ({
                            text: queryInfo.label,
                            handler: () => setSelectedQuery(queryInfo)
                        })
                        )
                    },
                    {
                        text: "Analyzed Results",
                        items: analyzedResults.map((queryInfo) => ({
                            text: queryInfo.label,
                            handler: () => setSelectedQuery(queryInfo)
                        })
                        )
                    }
        
                ]
            }
            setDropdownConfig(dc)
            // initialize QueryWebPart
            new LABKEY.QueryWebPart({
                renderTo: "data-access-grid",
                title: selectedQuery.label, 
                schemaName: selectedQuery.schema,
                queryName: selectedQuery.query,
                showRstudioButton: true, 
                showSurroundingBorder: false,<commit_msg>DataAccess: remove analyzed results section<commit_after>import React from 'react';
import {Loader} from './components/Loader'
import { Query} from '@labkey/api';

// Styling imports
import './DataAccess.scss';

interface QueryInfo {
    schema: string;
    query: string;
    label: string
}

const analyzedResults = [
    {schema: "study", query: "fcs_analyzed_result", label: "Flow cytometry analyzed results"},
    {schema: "gene_expression", query: "DGEA_filteredGEAR", label: "Differential gene expression analysis results"}
]; 

const demographicsQuery = {schema: "study", query: "demographics", label: "Demographics"}

const getQueries = () => {
    return new Promise((resolve, reject) => {
        const res = Query.selectRows({
            schemaName: 'study',
            queryName: 'ISC_datasets',
            failure: (error) => {
                reject(error.exception) },
            success: (data) => {
                resolve(data) }
        })
    })
}


export const DataAccess: React.FC = () => {
    const [selectedQuery, setSelectedQuery] = React.useState<QueryInfo>({schema: "study", query: "demographics", label: "Demographics"})
    const [webpartReady, setWebpartReady] = React.useState<Boolean>(false)
    const [dropdownConfig, setDropdownConfig] = React.useState(null)

    React.useEffect(() => {
        getQueries().then((data: any) => {
            const rows = data.rows
            const ds = rows.map(row => ({ schema: "study", query: row.Name, label: row.Label }))
            const dc = {
                text: "Choose Dataset",
                items: [
                    {
                        text: "Demographics",
                        handler: () => setSelectedQuery(demographicsQuery)
                    },
                    '-',
                    ...ds.map((queryInfo) => ({
                        text: queryInfo.label,
                        handler: () => setSelectedQuery(queryInfo)
                    }))
                ]
            }
            setDropdownConfig(dc)
            // initialize QueryWebPart
            new LABKEY.QueryWebPart({
                renderTo: "data-access-grid",
                title: selectedQuery.label, 
                schemaName: selectedQuery.schema,
                queryName: selectedQuery.query,
                showRstudioButton: true, 
                showSurroundingBorder: false,
{'fraction_non_alphanumeric': 0.11807692307692308, 'fraction_numerical': 0.0, 'mean_word_length': 1.689245087900724, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 31, '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': '3740754', 'n_tokens_mistral': 1385, 'n_tokens_neox': 1282, 'n_words': 295}