/* vaccine - do Vacceine and HIV Status 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 vaccineExists(struct section *section, struct sqlConnection *conn, char *subjId) /* Return TRUE if vaccineAll table exists and it has an entry with the gene symbol */ { if (sqlTableExists(conn, "gsidSubjInfo") == TRUE) { return(TRUE); } return(FALSE); } void vxprintf(char *templ, char *string) /* print "N/A" if the string to be printed is NULL */ { if (string == NULL) printf(templ, "N/A"); else printf(templ, string); } static void vaccinePrint(struct section *section, struct sqlConnection *conn, char *subjId) /* Print out Vaccine section. */ { char *immunStatus = NULL; char *daysInfectF = NULL; char *daysInfectL = NULL; char *injections = NULL; char *startDate = NULL; char *lastSeroNegDay = NULL; char *firstSeroPosDay = NULL; char *firstRNAPosDay = NULL; char *ESDBasis = NULL; char *seqDay = NULL; char *art_daei = NULL; char *art_sequencing = NULL; char query[256]; struct sqlResult *sr; char **row; printf(""); safef(query, sizeof(query), "select art_daei, art_sequencing from hgFixed.artDaei where subjId='%s'", subjId); sr = sqlMustGetResult(conn, query); row = sqlNextRow(sr); if (row != NULL) { art_daei = cloneString(row[0]); art_sequencing = cloneString(row[1]); } sqlFreeResult(&sr); safef(query, sizeof(query), "select immunStatus, daysInfectF, daysInfectL, injections from gsidSubjInfo where subjId='%s'", subjId); sr = sqlMustGetResult(conn, query); row = sqlNextRow(sr); if (row != NULL) { immunStatus = cloneString(row[0]); daysInfectF = cloneString(row[1]); daysInfectL = cloneString(row[2]); injections = cloneString(row[3]); } sqlFreeResult(&sr); safef(query, sizeof(query), "select startDate,lastSeroNegDay,firstSeroPosDay,firstRNAPosDay,ESDBasis,seqDay from hgFixed.testDates where subjId='%s'", subjId); sr = sqlMustGetResult(conn, query); row = sqlNextRow(sr); if (row != NULL) { startDate = cloneString(row[0]); lastSeroNegDay = cloneString(row[1]); firstSeroPosDay = cloneString(row[2]); firstRNAPosDay = cloneString(row[3]); ESDBasis = cloneString(row[4]); seqDay = cloneString(row[5]); } sqlFreeResult(&sr); printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); /* removed the following item per GSID user feedback */ /*printf(""); */ printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); printf(""); printf("
"); printf("Vaccine/Placebo: %s%s", immunStatus, GSBLANKS); printf(""); vxprintf("ART at Sequencing? %s", art_sequencing); printf("
"); /* !!! currently all subjects in the database are infected. */ /* update this when non-infected subjects addded into DB */ printf("HIV Status: %s%s", "Infected", GSBLANKS); printf(""); vxprintf("DAEI for ART Start: %s", art_daei); printf("
"); printf("Days of infection relative to last negative date: %s\n", daysInfectL); printf("
"); printf("Injections:  %s%s", injections, GSBLANKS); printf(""); if (sameWord(lastSeroNegDay, "-1")) printf("Study Day of Last Serology-Negative HIV Test: %s\n", "N/A"); else vxprintf("Study Day of Last Serology-Negative HIV Test: %s\n", lastSeroNegDay); printf("
"); vxprintf("Date of Study Start: %s\n", startDate); printf(""); vxprintf("Study Day of First Serology-Positive HIV Test: %s\n", firstSeroPosDay); printf("
"); vxprintf("Estimated Study Day of Infection (ESDI)*: %s\n", daysInfectF); printf(""); vxprintf("Study Day of First RNA-positive HIV Test (NAT): %s\n", firstRNAPosDay); printf("
"); if (sameWord(seqDay, "-1")) printf("Study Day of Sequencing: N/A\n"); else vxprintf("Study Day of Sequencing: %s\n", seqDay); printf(""); vxprintf("Basis for ESDI: %s\n", ESDBasis); printf("
"); return; } struct section *vaccineSection(struct sqlConnection *conn, struct hash *sectionRa) /* Create vaccine section. */ { struct section *section = sectionNew(sectionRa, "vaccine"); section->exists = vaccineExists; section->print = vaccinePrint; return section; }