<commit_before>'use strict';
var React = require('react');
var globals = require('../../globals');
var evidenceCodes = require('./mapping/evidence_code.json');

var queryKeyValue = globals.queryKeyValue;
var editQueryValue = globals.editQueryValue;

// Display met criteria
var CurationInterpretationCriteria = module.exports.CurationInterpretationCriteria = React.createClass({
	propTypes: {
        interpretation: React.PropTypes.object
    },

    getInitialState: function() {
        return {
            interpretation: this.props.interpretation
        };
    },

    componentWillReceiveProps: function(nextProps) {
    	if (nextProps.interpretation && this.props.interpretation) {
    		this.setState({interpretation: nextProps.interpretation});
    	}
    },

    handleCriteria: function() {
    	var criteria;
    	for (let n of evidenceCodes) {

    	}
    },

	render: function() {
        return (
            <div className="curation-criteria curation-variant">
            	{(this.state.interpretation) ?
            		<div className="criteria-bar btn-toolbar" role="toolbar" aria-label="Criteria bar with code buttons">
            			<div className="criteria-group btn-group btn-group-sm" role="group" aria-label="Criteria code button group">
            				{evidenceCodes.map(function(evidence, i) {
            					return (
                                    <button type="button" className={'btn btn-default ' + evidence.class} key={i}
                                    	data-toggle="tooltip" data-placement="top" data-tooltip={evidence.definition}>
                                        <span>{evidence.code}</span>
                                    </button>
                                );
            				})}
            			</div>
            		</div>
            	: null}
            </div>
        );
    }
});<commit_msg>Added method to fake the different states of criteria - 'unable to evaluate (until associated with disease)', 'able to evaluate, but not evaluated', and 'evaluated' - for demo purpose<commit_after>'use strict';
var React = require('react');
var globals = require('../../globals');
var evidenceCodes = require('./mapping/evidence_code.json');

var queryKeyValue = globals.queryKeyValue;
var editQueryValue = globals.editQueryValue;

// Display met criteria
var CurationInterpretationCriteria = module.exports.CurationInterpretationCriteria = React.createClass({
	propTypes: {
        interpretation: React.PropTypes.object
    },

    getInitialState: function() {
        return {
            interpretation: this.props.interpretation
        };
    },

    componentWillReceiveProps: function(nextProps) {
    	if (nextProps.interpretation && this.props.interpretation) {
    		this.setState({interpretation: nextProps.interpretation});
    	}
    },

    // FIXME: fake data attribute to flag criteria that can be evaluated but not yet evaluated
    // after associating a disease with interpretation.
    // Shall be removed when actual functionality is implemented.
    handleCriteria: function(criteria_code) {
		var status;
		var evaluated = ["BS1", "BS2", "BP1", "BP3", "BP7", "PP3", "PM2", "PM4", "PM5", "PS1", "PS4"];
		var not_evaluated = ["BS3", "BS4", "BP2", "BP4", "PP1", "PP2", "PM1", "PS3"];
		for (let x of evaluated) {
			if (x === criteria_code) {
				status = "evaluated";
			}
		}
		for (let y of not_evaluated) {
			if (y === criteria_code) {
				status = "not_evaluated";
			}
		}
		return status;
    },

	render: function() {
		var self =this;

        return (
            <div className="curation-criteria curation-variant">
            	{(this.state.interpretation) ?
            		<div className="criteria-bar btn-toolbar" role="toolbar" aria-label="Criteria bar with code buttons">
            			<div className="criteria-group btn-group btn-group-sm" role="group" aria-label="Criteria code button group">
							{/* FIXME: Remove 'data-status' attribute when actual functionality is implemented to handle 'met' criteria */}
            				{evidenceCodes.map(function(evidence, i) {
            					return (
                                    <button type="button" className={'btn btn-default ' + evidence.class} key={i} data-status={self.handleCriteria(evidence.code)}
                                    	data-toggle="tooltip" data-placement="top" data-tooltip={evidence.definition}>
                                        <span>{evidence.code}</span>
                                    </button>
                                );
            				})}
            			</div>
            		</div>
            	: null}
            </div>
        );
    }
});
{'fraction_non_alphanumeric': 0.12333476579286635, 'fraction_numerical': 0.0040825096691018475, 'mean_word_length': 2.1709809264305178, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '141507', 'n_tokens_mistral': 1309, 'n_tokens_neox': 1244, 'n_words': 294}