/* clinical - do Clinical section. */ #include "common.h" #include "hash.h" #include "linefile.h" #include "dystring.h" #include "cheapcgi.h" #include "spDb.h" #include "gsidSubj.h" #include "hdb.h" #include "net.h" static boolean clinicalExists(struct section *section, struct sqlConnection *conn, char *subjId) /* Return TRUE if clinicalAll table exists and it has an entry with the gene symbol */ { if (sqlTableExists(conn, "gsidClinicRec") == TRUE) { return(TRUE); } return(FALSE); } static void clinicalPrint(struct section *section, struct sqlConnection *conn, char *subjId) /* Print out Clinical section. */ { char bigQuery[2000]; struct sqlResult *sr; char **row; char *specimenId, *labCode, *daysCollection, *hivQuan, *cd4Count; char *naString = strdup("N/A"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); /* complex query to ensure date is correctly sorted */ safef(bigQuery, sizeof(bigQuery), "select specimenId, labCode, daysCollection, hivQuan, cd4Count from gsidClinicRec where subjId='%s' order by daysCollection", subjId); sr = sqlMustGetResult(conn, bigQuery); row = sqlNextRow(sr); /* special processing if this subject does not have any clinical data */ if (row == NULL) { /*specimenId = row[0]; labCode = row[1]; daysCollection = row[2]; hivQuan = row[3]; cd4Count = row[4]; */ daysCollection = naString; hivQuan = naString; cd4Count = naString; printf(""); printf("\n", daysCollection); printf("\n", hivQuan); printf("\n", cd4Count); printf(""); } while (row != NULL) { specimenId = row[0]; labCode = row[1]; daysCollection = row[2]; hivQuan = row[3]; cd4Count = row[4]; if (daysCollection == NULL) daysCollection = naString; if (hivQuan == NULL) hivQuan = naString; if (cd4Count == NULL) cd4Count = naString; printf(""); printf("\n", daysCollection); //printf("\n", cd4Count); if (sameWord(hivQuan, "1000000")) { printf("\n"); } else { if (sameWord(hivQuan, "200")) { printf("\n"); } else { printf("\n", hivQuan); } } if (sameWord(cd4Count, "0")) { printf("\n"); } else { printf("\n", cd4Count); } printf(""); row = sqlNextRow(sr); } sqlFreeResult(&sr); printf("
Days After Estimated
Infection (DAEI)*
HIV-1 RNA
copies/mL
CD4
cells/microliter
%s%s%s
%s%s> 1000000< 400%sN/A%s
"); printf("
* Estimated Study Day of Infection (ESDI), "); printf("click here "); printf(" for further explanation.\n"); printf("
* Days After Estimated Infection (DAEI), "); printf("click here "); printf(" for further explanation.\n"); return; } struct section *clinicalSection(struct sqlConnection *conn, struct hash *sectionRa) /* Create clinical section. */ { struct section *section = sectionNew(sectionRa, "clinical"); section->exists = clinicalExists; section->print = clinicalPrint; return section; }