<commit_before>/* @flow */
// Vendor
import React from 'react';
import Measure from 'react-measure';
import Relay from 'react-relay';
import { connect } from 'react-redux';
import * as d3 from 'd3';
import { compose, withState, withProps, lifecycle } from 'recompose';
import JSURL from 'jsurl';

// Custom
import Column from '@ncigdc/uikit/Flex/Column';
import Row from '@ncigdc/uikit/Flex/Row';
import SpinnerParticle from '@ncigdc/uikit/Loaders/Particle';

import withRouter from '@ncigdc/utils/withRouter';
import { fetchApi } from '@ncigdc/utils/ajax';
import { setFilter, mergeQuery } from '@ncigdc/utils/filters';
import { removeEmptyKeys } from '@ncigdc/utils/uri';

import DoubleRingChart from '@ncigdc/components/Charts/DoubleRingChart';
import StackedBarChart from '@ncigdc/components/Charts/StackedBarChart';

import styled from '@ncigdc/theme/styled';
import { withTheme } from '@ncigdc/theme';

const Container = styled(Row, {
  marginBottom: '2rem',
  backgroundColor: 'white',
  border: '1px solid #ddd',
  borderRadius: '4px',
  height: '300px',
});

const initialState = {
  topGenesWithCasesPerProject: {},
  numUniqueCases: 0,
  projectsIsFetching: true,
  genesIsFetching: true,
};

const ProjectsChartsComponent = compose(
  withState('state', 'setState', initialState),
  withRouter,
  connect(state => ({ relayProgress: state.relayProgress })),
  withProps({
    async fetchData(props): Promise<*> {
      const projectIds = props.hits.edges.map(x => x.node.project_id);

      const { data } = await fetchApi(
        `analysis/top_mutated_genes_by_project?fields=gene_id,symbol&filters=${
          JSON.stringify(
            {
              op: 'AND',
              content: [
                projectIds.length && {
                  op: 'in',
                  content: {
                    field: 'case.project.project_id',<commit_msg>✨ PRTL-958 bump gene-limit of graph above project list page to 20 (#1463)<commit_after>/* @flow */
// Vendor
import React from 'react';
import Measure from 'react-measure';
import Relay from 'react-relay';
import { connect } from 'react-redux';
import * as d3 from 'd3';
import { compose, withState, withProps, lifecycle } from 'recompose';
import JSURL from 'jsurl';

// Custom
import Column from '@ncigdc/uikit/Flex/Column';
import Row from '@ncigdc/uikit/Flex/Row';
import SpinnerParticle from '@ncigdc/uikit/Loaders/Particle';

import withRouter from '@ncigdc/utils/withRouter';
import { fetchApi } from '@ncigdc/utils/ajax';
import { setFilter, mergeQuery } from '@ncigdc/utils/filters';
import { removeEmptyKeys } from '@ncigdc/utils/uri';

import DoubleRingChart from '@ncigdc/components/Charts/DoubleRingChart';
import StackedBarChart from '@ncigdc/components/Charts/StackedBarChart';

import styled from '@ncigdc/theme/styled';
import { withTheme } from '@ncigdc/theme';

const Container = styled(Row, {
  marginBottom: '2rem',
  backgroundColor: 'white',
  border: '1px solid #ddd',
  borderRadius: '4px',
  height: '300px',
});

const initialState = {
  topGenesWithCasesPerProject: {},
  numUniqueCases: 0,
  projectsIsFetching: true,
  genesIsFetching: true,
};

const ProjectsChartsComponent = compose(
  withState('state', 'setState', initialState),
  withRouter,
  connect(state => ({ relayProgress: state.relayProgress })),
  withProps({
    async fetchData(props): Promise<*> {
      const projectIds = props.hits.edges.map(x => x.node.project_id);

      const { data } = await fetchApi(
        `analysis/top_mutated_genes_by_project?size=20&fields=gene_id,symbol&filters=${
          JSON.stringify(
            {
              op: 'AND',
              content: [
                projectIds.length && {
                  op: 'in',
                  content: {
                    field: 'case.project.project_id',
{'fraction_non_alphanumeric': 0.13157894736842105, 'fraction_numerical': 0.007631578947368421, 'mean_word_length': 3.652386780905753, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '6611417', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1189, 'n_words': 287}