Esempio n. 1
0
def getCoursesForField(fieldId):
    course_names = []
    cols = COURSES_ARRAY[fieldId]
    for i in xrange(len(cols)):
        tmp = CHART_DATA.loc[1:, [
            corse_title_coll[i][0], corse_title_coll[i][1], cdt_course[i][0],
            cdt_course[i][1], cdt_course[i][2], cdt_course[i][3], cdt_course[i]
            [4], cdt_course[i][5], cdt_course[i][6], cdt_course[i][7],
            cdt_course[i][8], coursefocus[i][0], coursefocus[i][1],
            coursefocus[i][2], coursefocus[i][3], coursefocus[i][4],
            coursefocus[i][5], coursefocus[i][6], coursefocus[i][7],
            coursefocus[i][8], corse_title_coll[i][2], "Q4_1", "Q3_1_TEXT"
        ]]
        tmp = tmp.dropna(subset=[coursefocus[i][get_No_FieldIds(fieldId)]])
        tmp = tmp.fillna("0")
        for row in tmp.itertuples():
            create_cross_ref_map(
                [fieldId, fieldId + "_C1", fieldId + "_C1_I1"], row[1],
                cross_ref_dict)

            f = []
            for j in xrange(12, 21):
                if row[j] == "1":
                    f.append(getNameforId(get_Fields_Ids(str(j))))

            prof = ""
            if row[22] == "1":
                prof = row[23]
                create_cross_ref_map(get_content_data(row[23]), row[1],
                                     ultimate_cross_ref_dict)
                create_cross_ref_map([row[23].lower()], row[1],
                                     ultimate_cross_ref_names)

            t = {
                #"parent_id" : fieldId+"_C1_I1",
                "i_type": "courses",
                "i_header_text": row[1],
                "i_content_text": row[2],
                "i_keywords": row[21],
                "i_professor": prof,
                "i_focus": f
            }
            s = []
            for i in range(3, 12):
                mystr = cdt_ids[(i - 2)] + "_" + fieldId + "_C1"
                if row[i] == "1":
                    cross_ref_cdt[mystr] = 1
                    s.append(mystr)
                else:
                    if mystr not in cross_ref_cdt:
                        cross_ref_cdt[mystr] = 0

            t['cdt'] = s
            course_names.append(t)

            cross_ref_size[fieldId + "_C1"] = len(course_names)
            create_cross_ref_map(s, row[1], ultimate_cross_ref_cdt)
    return course_names
def getProjectsForField(fieldId):
	project_names = []
	cols = PROJECTS_ARRAY[fieldId]
	for i in xrange(len(cols)):
		tmp = CHART_DATA.loc[1:,[project_title_coll[i][0],project_title_coll[i][1],cdt_project[i][0],cdt_project[i][1],
		cdt_project[i][2],cdt_project[i][3],cdt_project[i][4],cdt_project[i][5],cdt_project[i][6],cdt_project[i][7],
		cdt_project[i][8],projectfocus[i][0],projectfocus[i][1],projectfocus[i][2],projectfocus[i][3],projectfocus[i][4],
		projectfocus[i][5],projectfocus[i][6],projectfocus[i][7],projectfocus[i][8],project_title_coll[i][2],project_title_coll[i][3],
		project_title_coll[i][4],project_title_coll[i][5]]]
		tmp = tmp.dropna(subset=[project_title_coll[i][0],projectfocus[i][get_No_FieldIds(fieldId)]])
		tmp = tmp.fillna("0");
		for row in tmp.itertuples():
			create_cross_ref_map([fieldId,fieldId+"_R1",fieldId+"_R1_I1"],row[1],cross_ref_dict)

			f = []
			for j in xrange(12,21):
				if row[j] == "1":
					f.append(getNameforId(get_Fields_Ids(str(j))))

			create_cross_ref_map(get_content_data(row[2]),row[1],ultimate_cross_ref_dict)
			create_cross_ref_map(get_content_data(row[24]),row[1],ultimate_cross_ref_dict)
			create_cross_ref_map([row[2].lower(),row[24].lower()],row[1],ultimate_cross_ref_names)

			t={
			#"parent_id" : fieldId+"_R1_I1",
			"i_type" : "projects",
			"i_header_text" : row[1],
			"i_content_text" : row[2],
			"i_website" : row[21],
			"i_ncsu_team" : row[24],
			"i_start_date" : row[22],
			"i_end_date" : row[23],
			"i_focus" : f
			}
			s = []
			for i in xrange(3,12):
				mystr = cdt_ids[(i-2)]+"_"+fieldId+"_R1"
				if row[i] == "1" :
					cross_ref_cdt[mystr] = 1
					s.append(mystr)
				else:
					if mystr not in cross_ref_cdt: 
						cross_ref_cdt[mystr] = 0

			t['cdt'] = s
			project_names.append(t)

			cross_ref_size[fieldId+"_R1"] = len(project_names)
			create_cross_ref_map(s,row[1],ultimate_cross_ref_cdt)
	return project_names
def getCoursesForField(fieldId):
	course_names = []
	cols = COURSES_ARRAY[fieldId]
	for i in xrange(len(cols)):
		tmp = CHART_DATA.loc[1:,[corse_title_coll[i][0],corse_title_coll[i][1],cdt_course[i][0],
		cdt_course[i][1],cdt_course[i][2],cdt_course[i][3],cdt_course[i][4],cdt_course[i][5],
		cdt_course[i][6],cdt_course[i][7],cdt_course[i][8],coursefocus[i][0],coursefocus[i][1],coursefocus[i][2]
		,coursefocus[i][3],coursefocus[i][4],coursefocus[i][5],coursefocus[i][6],coursefocus[i][7],coursefocus[i][8]
		,corse_title_coll[i][2],"Q4_1","Q3_1_TEXT"]]
		tmp = tmp.dropna(subset=[coursefocus[i][get_No_FieldIds(fieldId)]])
		tmp = tmp.fillna("0");
		for row in tmp.itertuples():
			create_cross_ref_map([fieldId,fieldId+"_C1",fieldId+"_C1_I1"],row[1],cross_ref_dict)
			
			f = []
			for j in xrange(12,21):
				if row[j] == "1":
					f.append(getNameforId(get_Fields_Ids(str(j))))

			prof = ""
			if row[22] == "1":
				prof = row[23]
				create_cross_ref_map(get_content_data(row[23]),row[1],ultimate_cross_ref_dict)
				create_cross_ref_map([row[23].lower()],row[1],ultimate_cross_ref_names)

			t = {
			#"parent_id" : fieldId+"_C1_I1",
			"i_type" : "courses",
			"i_header_text" : row[1],
			"i_content_text" : row[2],
			"i_keywords" : row[21],
			"i_professor": prof,
			"i_focus" : f
			}
			s = []
			for i in range(3,12):
				mystr = cdt_ids[(i-2)]+"_"+fieldId+"_C1"
				if row[i] == "1" :
					cross_ref_cdt[mystr] = 1
					s.append(mystr)
				else:
					if mystr not in cross_ref_cdt: 
						cross_ref_cdt[mystr] = 0

			t['cdt'] = s
			course_names.append(t)

			cross_ref_size[fieldId+"_C1"] = len(course_names)
			create_cross_ref_map(s,row[1],ultimate_cross_ref_cdt)
	return course_names
def create_chart_data():
	chartObject = WRAPPER_DATA
	wrap = chartObject["children"];
	for field in wrap:

		child = field["children"]
		child[0]["children"][0]["content"] = sorted(getPeopleForField(field["id"]),key=lambda k: k['i_header_text'])
		s = len(child[0]["children"][0]["content"])
		child[0]["children"][0]["size"] = s
		child[0]["header_text"] = getNameforId(field["id"])
		child[0]["mid_text"] = "People"
		child[0]["content_text"] = "This survey uncovered "+str(s)+" people whose work relates to "+getNameforId(field["id"])
		child[0]["children"][0]["header_text"] = getNameforId(field["id"])
		child[0]["children"][0]["mid_text"] = "People"
		child[0]["children"][0]["content_text"] = "This survey uncovered "+str(s)+" people whose work relates to "+getNameforId(field["id"])

		child[1]["children"][0]["content"] = sorted(getCoursesForField(field["id"]),key=lambda k: k['i_header_text'])
		s = len(child[1]["children"][0]["content"])
		child[1]["children"][0]["size"] = s
		child[1]["header_text"] = getNameforId(field["id"])
		child[1]["mid_text"] = "Courses"
		child[1]["content_text"] = "This survey uncovered "+str(s)+" courses exploring "+getNameforId(field["id"])
		child[1]["children"][0]["header_text"] = getNameforId(field["id"])
		child[1]["children"][0]["mid_text"] = "Courses"
		child[1]["children"][0]["content_text"] = "This survey uncovered "+str(s)+" courses exploring "+getNameforId(field["id"])

		child[2]["children"][0]["content"] = sorted(getProjectsForField(field["id"]),key=lambda k: k['i_header_text'])
		s = len(child[2]["children"][0]["content"])
		child[2]["children"][0]["size"] = s
		child[2]["header_text"] = getNameforId(field["id"])
		child[2]["mid_text"] = "Projects"
		child[2]["content_text"] = "This survey uncovered "+str(s)+" current or recent projects researching "+getNameforId(field["id"])
		child[2]["children"][0]["header_text"] = getNameforId(field["id"])
		child[2]["children"][0]["mid_text"] = "Projects"
		child[2]["children"][0]["content_text"] = "This survey uncovered "+str(s)+" current or recent projects researching "+getNameforId(field["id"])

	return chartObject
def getPeopleForField(fieldId):
	people_names = []
	col = FIELDS_ARRAY[fieldId]
	tmp = CHART_DATA.loc[1:,[name_coll[0],name_coll[1],cdt_ppl[0],cdt_ppl[1],cdt_ppl[2],cdt_ppl[3],cdt_ppl[4],cdt_ppl[5],
	cdt_ppl[6],cdt_ppl[7],name_coll[2],pplfocus[0],pplfocus[1],pplfocus[2],pplfocus[3],pplfocus[4],pplfocus[5],pplfocus[6],
	pplfocus[7],pplfocus[8],corse_title_coll[0][0],corse_title_coll[0][1],corse_title_coll[1][0],corse_title_coll[1][1],
	corse_title_coll[2][0],corse_title_coll[2][1],corse_title_coll[3][0],corse_title_coll[3][1],corse_title_coll[4][0],
	corse_title_coll[4][1],project_title_coll[0][0],project_title_coll[0][1],project_title_coll[1][0],project_title_coll[1][1],
	project_title_coll[2][0],project_title_coll[2][1],project_title_coll[3][0],project_title_coll[3][1],project_title_coll[4][0],
	project_title_coll[4][1],name_coll[3],name_coll[4]]]

	tmp = tmp.dropna(subset=[pplfocus[get_No_FieldIds(fieldId)],name_coll[0]])
	tmp = tmp.fillna("0");

	for row in tmp.itertuples():
		create_cross_ref_map([fieldId,fieldId+"_P1",fieldId+"_P1_I1"],row[1],cross_ref_dict)
		
		f = []
		for i in xrange(12,21):
			if row[i] == "1":
				f.append(getNameforId(get_Fields_Ids(str(i))))
		c = []

		for i in xrange(21,31,2):
			if row[i] != "0" :
				a = {
				"course_no" : row[i],
				"course_title" : row[i+1]
				}
				c.append(a)
				create_cross_ref_map(get_content_data(row[i]),row[1],ultimate_cross_ref_dict)
				create_cross_ref_map([row[i].lower()],row[1],ultimate_cross_ref_names)
		p = []
		
		for i in xrange(31,41,2):
			if row[i] != "0" :
				b = {
				"project_title" : row[i],
				"project_investigator" : row[i+1]
				}
				p.append(b)
				create_cross_ref_map(get_content_data(row[i]),row[1],ultimate_cross_ref_dict)
				create_cross_ref_map([row[i].lower()],row[1],ultimate_cross_ref_names)		

		t={
		#"parent_id" : fieldId+"_P1_I1",
		"i_type" : "people",
		"i_header_text" : row[1],
		"i_content_text" : row[2],
		"i_degree_text" : row[11],
		"i_focus" : f,
		"i_courses" : c,
		"i_projects" : p,
		"i_department": row[41],
		"i_college": row[42]
		}
		s = []
		for i in xrange(3,11):
			mystr = cdt_ids[(i-2)]+"_"+fieldId+"_P1"
			if row[i] == "1" :
				cross_ref_cdt[mystr] = 1
				s.append(mystr)
			else:
				if mystr not in cross_ref_cdt: 
					cross_ref_cdt[mystr] = 0
				
		cross_ref_cdt["CDT9"+"_"+fieldId+"_P1"] = 0			
		t['cdt'] = s
		people_names.append(t)

		cross_ref_size[fieldId+"_P1"] = len(people_names)
		create_cross_ref_map(s,row[1],ultimate_cross_ref_cdt)

	return people_names
Esempio n. 6
0
def create_chart_data():
    chartObject = WRAPPER_DATA
    wrap = chartObject["children"]
    for field in wrap:

        child = field["children"]
        child[0]["children"][0]["content"] = sorted(
            getPeopleForField(field["id"]), key=lambda k: k['i_header_text'])
        s = len(child[0]["children"][0]["content"])
        child[0]["children"][0]["size"] = s
        child[0]["header_text"] = getNameforId(field["id"])
        child[0]["mid_text"] = "People"
        child[0]["content_text"] = "This survey uncovered " + str(
            s) + " people whose work relates to " + getNameforId(field["id"])
        child[0]["children"][0]["header_text"] = getNameforId(field["id"])
        child[0]["children"][0]["mid_text"] = "People"
        child[0]["children"][0][
            "content_text"] = "This survey uncovered " + str(
                s) + " people whose work relates to " + getNameforId(
                    field["id"])

        child[1]["children"][0]["content"] = sorted(
            getCoursesForField(field["id"]), key=lambda k: k['i_header_text'])
        s = len(child[1]["children"][0]["content"])
        child[1]["children"][0]["size"] = s
        child[1]["header_text"] = getNameforId(field["id"])
        child[1]["mid_text"] = "Courses"
        child[1]["content_text"] = "This survey uncovered " + str(
            s) + " courses exploring " + getNameforId(field["id"])
        child[1]["children"][0]["header_text"] = getNameforId(field["id"])
        child[1]["children"][0]["mid_text"] = "Courses"
        child[1]["children"][0][
            "content_text"] = "This survey uncovered " + str(
                s) + " courses exploring " + getNameforId(field["id"])

        child[2]["children"][0]["content"] = sorted(
            getProjectsForField(field["id"]), key=lambda k: k['i_header_text'])
        s = len(child[2]["children"][0]["content"])
        child[2]["children"][0]["size"] = s
        child[2]["header_text"] = getNameforId(field["id"])
        child[2]["mid_text"] = "Projects"
        child[2]["content_text"] = "This survey uncovered " + str(
            s) + " current or recent projects researching " + getNameforId(
                field["id"])
        child[2]["children"][0]["header_text"] = getNameforId(field["id"])
        child[2]["children"][0]["mid_text"] = "Projects"
        child[2]["children"][0][
            "content_text"] = "This survey uncovered " + str(
                s) + " current or recent projects researching " + getNameforId(
                    field["id"])

    return chartObject
Esempio n. 7
0
def getProjectsForField(fieldId):
    project_names = []
    cols = PROJECTS_ARRAY[fieldId]
    for i in xrange(len(cols)):
        tmp = CHART_DATA.loc[1:, [
            project_title_coll[i][0], project_title_coll[i][1], cdt_project[i]
            [0], cdt_project[i][1], cdt_project[i][2], cdt_project[i][3],
            cdt_project[i][4], cdt_project[i][5], cdt_project[i][6],
            cdt_project[i][7], cdt_project[i][8], projectfocus[i][0],
            projectfocus[i][1], projectfocus[i][2], projectfocus[i][3],
            projectfocus[i][4], projectfocus[i][5], projectfocus[i][6],
            projectfocus[i][7], projectfocus[i][8], project_title_coll[i][2],
            project_title_coll[i][3], project_title_coll[i][4],
            project_title_coll[i][5]
        ]]
        tmp = tmp.dropna(subset=[
            project_title_coll[i][0], projectfocus[i][get_No_FieldIds(fieldId)]
        ])
        tmp = tmp.fillna("0")
        for row in tmp.itertuples():
            create_cross_ref_map(
                [fieldId, fieldId + "_R1", fieldId + "_R1_I1"], row[1],
                cross_ref_dict)

            f = []
            for j in xrange(12, 21):
                if row[j] == "1":
                    f.append(getNameforId(get_Fields_Ids(str(j))))

            create_cross_ref_map(get_content_data(row[2]), row[1],
                                 ultimate_cross_ref_dict)
            create_cross_ref_map(get_content_data(row[24]), row[1],
                                 ultimate_cross_ref_dict)
            create_cross_ref_map([row[2].lower(), row[24].lower()], row[1],
                                 ultimate_cross_ref_names)

            t = {
                #"parent_id" : fieldId+"_R1_I1",
                "i_type": "projects",
                "i_header_text": row[1],
                "i_content_text": row[2],
                "i_website": row[21],
                "i_ncsu_team": row[24],
                "i_start_date": row[22],
                "i_end_date": row[23],
                "i_focus": f
            }
            s = []
            for i in xrange(3, 12):
                mystr = cdt_ids[(i - 2)] + "_" + fieldId + "_R1"
                if row[i] == "1":
                    cross_ref_cdt[mystr] = 1
                    s.append(mystr)
                else:
                    if mystr not in cross_ref_cdt:
                        cross_ref_cdt[mystr] = 0

            t['cdt'] = s
            project_names.append(t)

            cross_ref_size[fieldId + "_R1"] = len(project_names)
            create_cross_ref_map(s, row[1], ultimate_cross_ref_cdt)
    return project_names
Esempio n. 8
0
def getPeopleForField(fieldId):
    people_names = []
    col = FIELDS_ARRAY[fieldId]
    tmp = CHART_DATA.loc[1:, [
        name_coll[0], name_coll[1], cdt_ppl[0], cdt_ppl[1], cdt_ppl[2],
        cdt_ppl[3], cdt_ppl[4], cdt_ppl[5], cdt_ppl[6], cdt_ppl[7],
        name_coll[2], pplfocus[0], pplfocus[1], pplfocus[2], pplfocus[3],
        pplfocus[4], pplfocus[5], pplfocus[6], pplfocus[7], pplfocus[8],
        corse_title_coll[0][0], corse_title_coll[0][1], corse_title_coll[1][0],
        corse_title_coll[1][1], corse_title_coll[2][0], corse_title_coll[2][1],
        corse_title_coll[3][0], corse_title_coll[3][1], corse_title_coll[4][0],
        corse_title_coll[4][1], project_title_coll[0][0], project_title_coll[0]
        [1], project_title_coll[1][0], project_title_coll[1][1],
        project_title_coll[2][0], project_title_coll[2][1], project_title_coll[
            3][0], project_title_coll[3][1], project_title_coll[4][0],
        project_title_coll[4][1], name_coll[3], name_coll[4]
    ]]

    tmp = tmp.dropna(subset=[pplfocus[get_No_FieldIds(fieldId)], name_coll[0]])
    tmp = tmp.fillna("0")

    for row in tmp.itertuples():
        create_cross_ref_map([fieldId, fieldId + "_P1", fieldId + "_P1_I1"],
                             row[1], cross_ref_dict)

        f = []
        for i in xrange(12, 21):
            if row[i] == "1":
                f.append(getNameforId(get_Fields_Ids(str(i))))
        c = []

        for i in xrange(21, 31, 2):
            if row[i] != "0":
                a = {"course_no": row[i], "course_title": row[i + 1]}
                c.append(a)
                create_cross_ref_map(get_content_data(row[i]), row[1],
                                     ultimate_cross_ref_dict)
                create_cross_ref_map([row[i].lower()], row[1],
                                     ultimate_cross_ref_names)
        p = []

        for i in xrange(31, 41, 2):
            if row[i] != "0":
                b = {
                    "project_title": row[i],
                    "project_investigator": row[i + 1]
                }
                p.append(b)
                create_cross_ref_map(get_content_data(row[i]), row[1],
                                     ultimate_cross_ref_dict)
                create_cross_ref_map([row[i].lower()], row[1],
                                     ultimate_cross_ref_names)

        t = {
            #"parent_id" : fieldId+"_P1_I1",
            "i_type": "people",
            "i_header_text": row[1],
            "i_content_text": row[2],
            "i_degree_text": row[11],
            "i_focus": f,
            "i_courses": c,
            "i_projects": p,
            "i_department": row[41],
            "i_college": row[42]
        }
        s = []
        for i in xrange(3, 11):
            mystr = cdt_ids[(i - 2)] + "_" + fieldId + "_P1"
            if row[i] == "1":
                cross_ref_cdt[mystr] = 1
                s.append(mystr)
            else:
                if mystr not in cross_ref_cdt:
                    cross_ref_cdt[mystr] = 0

        cross_ref_cdt["CDT9" + "_" + fieldId + "_P1"] = 0
        t['cdt'] = s
        people_names.append(t)

        cross_ref_size[fieldId + "_P1"] = len(people_names)
        create_cross_ref_map(s, row[1], ultimate_cross_ref_cdt)

    return people_names