Ejemplo n.º 1
0
print('importing institution data')
data2008 = InstitutionData('/Users/vmd/Dropbox/Match/residency-match-simulation/matchdata2008.csv', 140, 'C', 1)
data2008.read_data_file()
data2008.prep_data()
data2008.select_data()

print('Setting Institution Attributes')
all_institutions = []
for x in data2008.finaldata:

#TODO: how to name the instances
    tname = x[1] # the Code is set as the object instance name, (I don't think this really works)
    tname = Institution() # the Code is set as the object instance name
    tname.name = x[1] #The name attribute is also set as the Code
    tname.openings = x[6] #Set the number of openings, comes from quota in the data file
    tname.prog_type = x[4] #Set the Type, for example 'C' is categorical
    tname.specialty = x[3] #Set the specialty, for example 140 is internal medicine
    tname.institution = x[2] #Set the institution number, basicly the name without the prog_type and specialty info
    tname.specialty_name = x[0] #This is the Speacialty name rather then code
    tname.obs_match = x[7] # The is the number that matched in the actual data set

    # Comment out the Following to use defualt
    tname.quality = max(min(r.gauss(50, 30), 100), 1) # on a scale 0-100
    tname.number_to_interview = 10 * tname.openings
    tname.observe_1 = r.gauss(1, .2)
    tname.observe_2 = tname.observe_2 = (r.gauss(1, .1)- tname.observe_1)
    tname.observed_1 = r.gauss(1, .2)
    tname.observed_2 = (r.gauss(1, .1)- tname.observed_1) # based on applicant interviewed, percentage
    tname.num_to_rank = 7 * tname.openings
    tname.accept_range = [.7, None] # as a % [.5, 1.5] if [.7, None] then there is no upper limit
print(('number of applicants', len(all_applicants)))

### Make the list of Institutions
##print('importing institution data')
##data2008 = InstitutionData('/Users/vmd/Dropbox/Match/rms/matchdata2008.csv', 140, 'C', 1)
##data2008.read_data_file()
##data2008.prep_data()
##data2008.select_data()

print('Setting Institution Attributes')
all_institutions = []
for x in range(1, 10):
    tname = Institution()  # the Code is set as the object instance name
    tname.name = x  #The name attribute is also set as the Code
    tname.openings = 10  #Set the number of openings, comes from quota in the data file
    tname.prog_type = 'test'  #Set the Type, for example 'C' is categorical
    tname.specialty = 'test'  #Set the specialty, for example 140 is internal medicine
    tname.institution = x  #Set the institution number, basicly the name without the prog_type and specialty info
    tname.specialty_name = 'test'  #This is the Speacialty name rather then code
    tname.obs_match = 0  # The is the number that matched in the actual data set
    # Comment out the Following to use defualt
    tname.quality = max(min(r.gauss(50, 30), 100), 1)  # on a scale 0-100
    tname.number_to_interview = 50
    tname.observe_1 = 1  #r.gauss(1, .2)
    tname.observe_2 = 1  #tname.observe_2 = (r.gauss(1, .1)- tname.observe_1)
    tname.observed_1 = 1  #r.gauss(1, .2)
    tname.observed_2 = 1  #(r.gauss(1, .1)- tname.observed_1) # based on applicant interviewed, percentage
    tname.num_to_rank = 40
    tname.accept_range = [
        .01, None
    ]  # as a % [.5, 1.5] if [.7, None] then there is no upper limit