<commit_before>import React, { Component } from 'react';
import OData, { buildQuery } from 'react-odata';

const dbase = 'http://api1.mlslistings.com/resodata';
const statsbase = 'http://localhost/RETSAPI';


class MLSCount extends Component {
  render () {
    const { query } = this.props;
    const countQuery = {
      top: 0,
      count: true,
      ...query
    }
    return <MLSData {...this.props} query={countQuery}/>
  }
}

class MLSMedia extends Component {
  render() {
    const { resource = "public", collection = "Media", ListingKeyNumeric = false , MemberKeyNumeric = false, MediaType = 'Photo' } = this.props;
    const ResourceRecordKeyNumeric = ListingKeyNumeric ? ListingKeyNumeric : MemberKeyNumeric;
    const mediaQuery = {
          filter: { 
          and: [
                { ResourceRecordKeyNumeric },
                "MediaStatus eq ResourceEnums.MediaStatus'Valid'",
                `MediaCategory eq ResourceEnums.MediaCategory'${MediaType}'`
              ]
          },
          top: 1
        };
    return <MLSData {...this.props} resource={resource} collection={collection} query={mediaQuery} processed={true} />
  }
}

//Adding classes to accommodate stats and geographies
class MLSGeography extends Component {
  render() {
    const { resource = "BiEntity", collection = "vGeographyByGeographyTypes", filter="",select="", ...rest } = this.props; 
    return <MLSData base={statsbase} resource={resource} collection={collection} query={{ select, filter}} {...rest} /> 
  }
}

class MLSStats extends Component {
  render() {
    const { resource = "Growth", collection, filter, select } = this.props; 
    var actualcollection=   (collection.toLowerCase() === 'markettrends' || collection.toLowerCase() === 'year-to-year')?'MarketTrends': 
    collection.toLowerCase() === 'kpi' ? 'markettrendslast90':   
    (collection.toLowerCase() === 'member' || collection.toLowerCase() === 'office') ? 'AgentProduction':'';    
    return <MLSData {...this.props} base={statsbase} resource={resource} collection={actualcollection} query={{ select, filter}}/> 
  }
}

//end

class MLSData extends Component {
  render() {
    const { base = dbase, token, collection, authHeader = { headers: { ...typeof this.props.token !== "undefined" && { Authorization: `Bearer ${this.props.token}` }, 'Accept': 'application/json' } }, link, resource = 'www', limit, processed = false } = this.props;

    if (link) {
      return <OData {...this.props} baseUrl={link} options={authHeader} />
    }

    if (collection.toLowerCase() === 'media' && !processed ) {
      return <MLSMedia {...this.props} collection={collection} resource={resource} options={authHeader} />
    }

    return <OData {...this.props} baseUrl={`${base}/${resource}/${collection}`} options={authHeader} />
  }
}

export { MLSMedia, MLSCount,MLSGeography,MLSStats};<commit_msg>Casing changed for KPI entity<commit_after>import React, { Component } from 'react';
import OData, { buildQuery } from 'react-odata';

const dbase = 'http://api1.mlslistings.com/resodata';
const statsbase = 'http://localhost/RETSAPI';


class MLSCount extends Component {
  render () {
    const { query } = this.props;
    const countQuery = {
      top: 0,
      count: true,
      ...query
    }
    return <MLSData {...this.props} query={countQuery}/>
  }
}

class MLSMedia extends Component {
  render() {
    const { resource = "public", collection = "Media", ListingKeyNumeric = false , MemberKeyNumeric = false, MediaType = 'Photo' } = this.props;
    const ResourceRecordKeyNumeric = ListingKeyNumeric ? ListingKeyNumeric : MemberKeyNumeric;
    const mediaQuery = {
          filter: { 
          and: [
                { ResourceRecordKeyNumeric },
                "MediaStatus eq ResourceEnums.MediaStatus'Valid'",
                `MediaCategory eq ResourceEnums.MediaCategory'${MediaType}'`
              ]
          },
          top: 1
        };
    return <MLSData {...this.props} resource={resource} collection={collection} query={mediaQuery} processed={true} />
  }
}

//Adding classes to accommodate stats and geographies
class MLSGeography extends Component {
  render() {
    const { resource = "BiEntity", collection = "vGeographyByGeographyTypes", filter="",select="", ...rest } = this.props; 
    return <MLSData base={statsbase} resource={resource} collection={collection} query={{ select, filter}} {...rest} /> 
  }
}

class MLSStats extends Component {
  render() {
    const { resource = "Growth", collection, filter, select } = this.props; 
    var actualcollection=   (collection.toLowerCase() === 'markettrends' || collection.toLowerCase() === 'year-to-year')?'MarketTrends': 
    collection.toLowerCase() === 'kpi' ? 'MarketTrendsLast90':   
    (collection.toLowerCase() === 'member' || collection.toLowerCase() === 'office') ? 'AgentProduction':'';    
    return <MLSData {...this.props} base={statsbase} resource={resource} collection={actualcollection} query={{ select, filter}}/> 
  }
}

//end

class MLSData extends Component {
  render() {
    const { base = dbase, token, collection, authHeader = { headers: { ...typeof this.props.token !== "undefined" && { Authorization: `Bearer ${this.props.token}` }, 'Accept': 'application/json' } }, link, resource = 'www', limit, processed = false } = this.props;

    if (link) {
      return <OData {...this.props} baseUrl={link} options={authHeader} />
    }

    if (collection.toLowerCase() === 'media' && !processed ) {
      return <MLSMedia {...this.props} collection={collection} resource={resource} options={authHeader} />
    }

    return <OData {...this.props} baseUrl={`${base}/${resource}/${collection}`} options={authHeader} />
  }
}

export { MLSMedia, MLSCount,MLSGeography,MLSStats};
{'fraction_non_alphanumeric': 0.1582608695652174, 'fraction_numerical': 0.0017391304347826088, 'mean_word_length': 3.461598138091544, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2792040', 'n_tokens_mistral': 1704, 'n_tokens_neox': 1666, 'n_words': 391}