<commit_before>
// subscribe to the OnChange event for the model_name listbox
var model_list = document.getElementById('id_model_name');
model_list.addEventListener('change', show_model_details);

// Build a text area to display model information
var div = document.getElementById("div_id_model_name");
var desc = document.createElement("div");
desc.id = 'div_mp_details';
desc.style.height = "auto";
//desc.overflow= auto;
desc.style.width = "100%";
//desc.style.backgroundColor = '#f0f0f0';
desc.style.border = "1px solid #a0a0a0";
div.appendChild(desc);

// set the initial visibility of the description div
setTextAreaVisibility();
if (!desc.hidden){
    show_model_details(null);
}

function setTextAreaVisibility() {
    // get the text value of the select list
    var txt = model_list.item(model_list.selectedIndex).text

    // set the visibility of the text area
    if (txt != 'Unknown') {
        desc.hidden = false;
    }
    else {
        desc.hidden = true;
    }
}

function show_model_details(e) {

    // update the text area visibility
    setTextAreaVisibility();

    // get the id of the current model program name
    var shortid = model_list.item(model_list.selectedIndex).value;

    // call django view to get model program metadata
    $.ajax({
        type: "GET",
        url: '/hsapi/_internal/get-model-metadata/',
        data: {resource_id:shortid},
        success: function (data) {

            // if the data is empty, hide the table
            if (Object.keys(data).length == 0){
                // set the visibility of the table element
                table = document.getElementById('progam_details_div');
                table.style.display = 'none';
            }
            // if the data is not empty, populate the model details table
            else {
                // set the visibility of the table element
                table_div = document.getElementById('progam_details_div');<commit_msg>Removed old/unused code from model_instance.js [#383]<commit_after>
// subscribe to the OnChange event for the model_name listbox
var model_list = document.getElementById('id_model_name');
if(model_list){
    model_list.addEventListener('change', show_model_details);
}
function show_model_details(e) {

    // get the id of the current model program name
    var shortid = model_list.item(model_list.selectedIndex).value;

    // call django view to get model program metadata
    $.ajax({
        type: "GET",
        url: '/hsapi/_internal/get-model-metadata/',
        data: {resource_id:shortid},
        success: function (data) {

            // if the data is empty, hide the table
            if (Object.keys(data).length == 0){
                // set the visibility of the table element
                table = document.getElementById('progam_details_div');
                table.style.display = 'none';
            }
            // if the data is not empty, populate the model details table
            else {
                // set the visibility of the table element
                table_div = document.getElementById('progam_details_div');
{'fraction_non_alphanumeric': 0.102803738317757, 'fraction_numerical': 0.004834031582339671, 'mean_word_length': 2.5884393063583815, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4659621', 'n_tokens_mistral': 856, 'n_tokens_neox': 822, 'n_words': 260}