<commit_before>import React, {Component, PropTypes} from 'react'
import {fetchVariableDefinitions} from '../../actions/variableDefinitions'
import cx from 'classnames'
import {connect} from 'react-redux'

class CardMetadata extends Component {
  static propTypes = {
    metadata: PropTypes.shape({
      description: PropTypes.string,
      terminology: PropTypes.string,
      source: PropTypes.string,
      measuredAt: PropTypes.string
    }),
    dimensions: PropTypes.arrayOf(PropTypes.shape({
      name: PropTypes.string,
      variables: PropTypes.arrayOf(PropTypes.string)
    })),
    variableDefinitions: PropTypes.arrayOf(PropTypes.shape({
      name: PropTypes.string,
      variables: PropTypes.arrayOf(PropTypes.string)
    })),
    dispatch: PropTypes.func
  }

  constructor() {
    super()
    this.state = {
      expanded: false
    }
  }

  componentDidMount() {
    this.props.dispatch(fetchVariableDefinitions())
  }

  handleClick(e) {
    e.preventDefault()
    this.setState({expanded: !this.state.expanded})
  }

  renderVariableDefinitions() {
    const {dimensions, variableDefinitions} = this.props

    return dimensions.map(findDimensionDefinition).map(definition => (<commit_msg>Fix proptypes so it matches what emerges from the backend<commit_after>import React, {Component, PropTypes} from 'react'
import {fetchVariableDefinitions} from '../../actions/variableDefinitions'
import cx from 'classnames'
import {connect} from 'react-redux'

class CardMetadata extends Component {
  static propTypes = {
    metadata: PropTypes.shape({
      description: PropTypes.string,
      terminology: PropTypes.string,
      source: PropTypes.string,
      measuredAt: PropTypes.string
    }),
    dimensions: PropTypes.arrayOf(PropTypes.shape({
      name: PropTypes.string,
      variables: PropTypes.arrayOf(PropTypes.string)
    })),
    variableDefinitions: PropTypes.shape({
      items: PropTypes.arrayOf(PropTypes.shape({
        dimension: PropTypes.string,
        dimensionDescription: PropTypes.string,
        variableDescription: PropTypes.string
      }))
    }),
    dispatch: PropTypes.func
  }

  constructor() {
    super()
    this.state = {
      expanded: false
    }
  }

  componentDidMount() {
    this.props.dispatch(fetchVariableDefinitions())
  }

  handleClick(e) {
    e.preventDefault()
    this.setState({expanded: !this.state.expanded})
  }

  renderVariableDefinitions() {
    const {dimensions, variableDefinitions} = this.props

    return dimensions.map(findDimensionDefinition).map(definition => (
{'fraction_non_alphanumeric': 0.11180609851446442, 'fraction_numerical': 0.0, 'mean_word_length': 3.61913357400722, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1198256', 'n_tokens_mistral': 697, 'n_tokens_neox': 712, 'n_words': 145}