handle items with poorly formatted b params, and mmoved to single objective function
This commit is contained in:
@ -13,20 +13,22 @@ def items_csv_to_dict(items_csv_reader, irt_model):
|
||||
else:
|
||||
item = { 'attributes': [] }
|
||||
|
||||
for key, col in enumerate(headers):
|
||||
if key == 0:
|
||||
item[col] = row[key]
|
||||
# b param - tmep fix! use irt model b param for proper reference
|
||||
elif key == (1 - len(headers)):
|
||||
item['b_param'] = row[key]
|
||||
elif key > 1:
|
||||
item['attributes'].append({
|
||||
'id': col,
|
||||
'value': row[key],
|
||||
'type': 'metadata'
|
||||
})
|
||||
# ensure that the b param is formatted correctly
|
||||
if len(re.findall(".", row[len(headers) - 1])) >= 3:
|
||||
for key, col in enumerate(headers):
|
||||
if key == 0:
|
||||
item[col] = row[key]
|
||||
# b param - tmep fix! use irt model b param for proper reference
|
||||
elif key == len(headers) - 1:
|
||||
item['b_param'] = row[key]
|
||||
elif key > 1 and key < len(headers) - 1:
|
||||
item['attributes'].append({
|
||||
'id': col,
|
||||
'value': row[key],
|
||||
'type': 'metadata'
|
||||
})
|
||||
|
||||
items.append(item)
|
||||
items.append(item)
|
||||
|
||||
return items
|
||||
|
||||
|
Reference in New Issue
Block a user