/* demog - do Demographic section. */ #include "common.h" #include "hash.h" #include "linefile.h" #include "dystring.h" #include "cheapcgi.h" #include "spDb.h" #include "gsidSubj3.h" #include "hdb.h" #include "net.h" static boolean demogExists(struct section *section, struct sqlConnection *conn, char *subjId) /* Return TRUE if demogAll table exists and it has an entry with the gene symbol */ { if (sqlTableExists(conn, "gsidSubjInfo") == TRUE) { return(TRUE); } return(FALSE); } static void demogPrint(struct section *section, struct sqlConnection *conn, char *subjId) /* Print out GAD section. */ { char *gender, *age, *race; char *location; char query[256]; struct sqlResult *sr; char **row; char *weight, *riskFactor; char *comment; safef(query, sizeof(query), "select gender, age, race, geography, riskFactor, weight, comment from gsidSubjInfo where subjId='%s'", subjId); sr = sqlMustGetResult(conn, query); row = sqlNextRow(sr); if (row != NULL) { printf(""); gender = row[0]; age = row[1]; race = row[2]; location = row[3]; riskFactor = row[4]; weight = row[5]; comment = row[6]; printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); printf("
"); printf("subject ID: %s%s", subjId, GSBLANKS); printf("
"); printf("gender: %s%s", gender, GSBLANKS); printf(""); printf("age: %s%s", age, GSBLANKS); printf(""); printf("risk factor: %s%s", riskFactor, GSBLANKS); printf("
"); printf("race: %s%s\n", race, GSBLANKS); printf(""); printf("weight(kg): %s\n", weight); printf(""); printf("location: %s\n", location); printf("
"); /* put out the special comment if it exists */ if (!sameWord(comment, "")) { printf("
"); printf("Special Comment: %s\n", comment); } } sqlFreeResult(&sr); return; } struct section *demogSection(struct sqlConnection *conn, struct hash *sectionRa) /* Create demog section. */ { struct section *section = sectionNew(sectionRa, "demog"); section->exists = demogExists; section->print = demogPrint; return section; }