<commit_before>#!/usr/bin/env python

SQL_SETTINGS_FN = "mega_sql_settings"

TOTAL_SCANS_TABLE_NAME = "Total Scans"
MASTER_CODE_PREFIX = "SL"
STUDY_CODE_FIELD_NAME = "Study Code"
MASTER_CODE_FIELD_NAME = "Lab Code"

#=== A list of synonymous field names ===#
# First column is the field name in the SQL database
# The first column contains all valid field names
measNames = [["age"], 
             ["Sex", "gender"]]


if __name__ == "__main__":
    import os
    import sys
    from scai_utils import *

    bVerbose = (sys.argv.count("-v") > 0)

    #=== Determine field name ===#
    ifld = sys.argv[1]

    bFound = False
    for (i0, t_row) in enumerate(measNames):
        for (i1, t_item) in enumerate(t_row):
            if ifld.lower() == t_item.lower():
                bFound = True
                fld = t_row[0]
                break;
    
    if not bFound:
        raise Exception, "Unrecognized data field name: %s" % ifld


    #=== Determine subject info mode (--mc or --id) ===#
    if sys.argv[2] == "--mc":<commit_msg>Added new flds to get_subjects_info.py<commit_after>#!/usr/bin/env python

SQL_SETTINGS_FN = "mega_sql_settings"

TOTAL_SCANS_TABLE_NAME = "Total Scans"
MASTER_CODE_PREFIX = "SL"
STUDY_CODE_FIELD_NAME = "Study Code"
MASTER_CODE_FIELD_NAME = "Lab Code"

#=== A list of synonymous field names ===#
# First column is the field name in the SQL database
# The first column contains all valid field names
measNames = [["age"], 
             ["Sex", "gender"], 
             ["B-Day", "DOB", "DoB"], 
             ["Race"],
             ["Control or Patient ID", "ctrlPtID", "grpID"], 
             ["Site"], 
             ["Date Enrolled", "dateEnrolled"], 
             ["Dates Scanned", "dateScanned"]]

def print_help():
    print("Usage")
    print(__file__ + " dataFld --id projID1,projID2,... subjID1,subjID2,...")
    print("\nList of valid values for dataFld")
    
    for (i0, t_row) in enumerate(measNames):
        t_str = "\t"
        for (i1, t_item) in enumerate(t_row):
            if t_item.count(" ") > 0:
                t_str += "`%s`" % t_item
            else:
                t_str += t_item 

            if i1 < len(t_row) - 1:
                t_str += " | "

        print(t_str)

if __name__ == "__main__":
    import os
    import sys
    from scai_utils import *

    bVerbose = (sys.argv.count("-v") > 0)

    #=== Print help message ===#
    if len(sys.argv) == 1 or \
       sys.argv.count("-h") > 0 or sys.argv.count("--help") > 0:
        print_help()
        sys.exit(0)

    #=== Determine field name ===#
    ifld = sys.argv[1]

    bFound = False
    for (i0, t_row) in enumerate(measNames):
        for (i1, t_item) in enumerate(t_row):
            if ifld.lower() == t_item.lower():
                bFound = True
                fld = t_row[0]
                break;
    
    if not bFound:
        raise Exception, "Unrecognized data field name: %s" % ifld


    #=== Determine subject info mode (--mc or --id) ===#
    if sys.argv[2] == "--mc":
{'fraction_non_alphanumeric': 0.14309373964889036, 'fraction_numerical': 0.008280887711162636, 'mean_word_length': 2.1789473684210527, 'pattern_counts': {'":': 4, '<': 4, '<?xml version=': 0, '>': 8, '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': '4076648', 'n_tokens_mistral': 1078, 'n_tokens_neox': 1012, 'n_words': 279}