use of org.akaza.openclinica.bean.managestudy.StudyGroupClassBean in project OpenClinica by OpenClinica.
the class ExtractBean method computeReportData.
public void computeReportData(ReportBean answer) {
answer.nextCell("Subject Event Item Values (Item-CRF-Ordinal)");
answer.nextRow();
// ///////////////////
// //
// COLUMNS //
// //
// ///////////////////
answer.nextCell("SubjID");
answer.nextCell("ProtocolID");
// then CRF info
if (dataset.isShowSubjectDob()) {
if (study.getStudyParameterConfig().getCollectDob().equals("2")) {
answer.nextCell("YOB");
} else if (study.getStudyParameterConfig().getCollectDob().equals("1")) {
answer.nextCell("DOB");
}
}
if (dataset.isShowSubjectGender()) {
answer.nextCell("Gender");
}
// TODO add additional labels here
if (dataset.isShowSubjectStatus()) {
answer.nextCell("SubjectStatus");
eventDescriptions.put("SubjectStatus", "Subject Status");
}
// TODO set datainfo-settable code here, tbh
if (dataset.isShowSubjectUniqueIdentifier() && "1".equals(showUniqueId)) {
answer.nextCell("UniqueID");
eventDescriptions.put("UniqueID", "Unique ID");
}
if (dataset.isShowSubjectSecondaryId()) {
answer.nextCell("SecondaryID");
eventDescriptions.put("SecondaryID", "SecondaryID");
}
// subject group info here, tbh
if (dataset.isShowSubjectGroupInformation()) {
// logger.info("got this far in subject group columns...");
for (int y = 0; y < studyGroupClasses.size(); y++) {
// logger.info("found a study group class here: "+y);
StudyGroupClassBean studyGroupClassBean = (StudyGroupClassBean) studyGroupClasses.get(y);
answer.nextCell(studyGroupClassBean.getName());
// logger.info("found the name:
// "+studyGroupClassBean.getName());
// YW 10-31-2007, for SPSS, eventHeader probably doesn't match
// the final header which will be validated
eventDescriptions.put(studyGroupClassBean.getName(), studyGroupClassBean.getName());
}
}
// ////////////////////
// sed column labels
int numSEDs = getNumSEDs();
for (int i = 1; i <= numSEDs; i++) {
int numSamples = getSEDNumSamples(i);
for (int j = 1; j <= numSamples; j++) {
if (dataset.isShowEventLocation()) {
String location = getColumnLabel(i, j, "Location", numSamples);
String description = getColumnDescription(i, j, "Location For ", currentDef.getName(), numSamples);
answer.nextCell(location);
eventHeaders.add(location);
eventDescriptions.put(location, description);
}
if (dataset.isShowEventStart()) {
String start = getColumnLabel(i, j, "StartDate", numSamples);
String description = getColumnDescription(i, j, "Start Date For ", currentDef.getName(), numSamples);
answer.nextCell(start);
eventHeaders.add(start);
eventDescriptions.put(start, description);
}
if (dataset.isShowEventEnd()) {
String end = getColumnLabel(i, j, "EndDate", numSamples);
String description = getColumnDescription(i, j, "End Date For ", currentDef.getName(), numSamples);
answer.nextCell(end);
eventHeaders.add(end);
eventDescriptions.put(end, description);
}
if (dataset.isShowEventStatus()) {
String eventStatus = getColumnLabel(i, j, "SubjectEventStatus", numSamples);
String description = getColumnDescription(i, j, "Event Status For ", currentDef.getName(), numSamples);
answer.nextCell(eventStatus);
eventHeaders.add(eventStatus);
eventDescriptions.put(eventStatus, description);
}
if (dataset.isShowSubjectAgeAtEvent() && ("1".equals(study.getStudyParameterConfig().getCollectDob()) || "2".equals(study.getStudyParameterConfig().getCollectDob()))) {
String subjectAgeAtEvent = getColumnLabel(i, j, "AgeAtEvent", numSamples);
String description = getColumnDescription(i, j, "Age At Event for ", currentDef.getName(), numSamples);
answer.nextCell(subjectAgeAtEvent);
eventHeaders.add(subjectAgeAtEvent);
eventDescriptions.put(subjectAgeAtEvent, description);
}
}
}
// item-crf-ordinal column labels
for (int i = 1; i <= numSEDs; i++) {
int numSamples = getSEDNumSamples(i);
// int numSEDCRFs = getSEDNumCRFs(i);
for (int j = 1; j <= numSamples; j++) {
int numSEDCRFs = getSEDNumCRFs(i);
if (dataset.isShowCRFcompletionDate()) {
// logger.info();
String crfCompletionDate = getColumnLabel(i, j, "CompletionDate", numSamples);
// FIXME
String description = getColumnDescription(i, j, "Completion Date for ", currentDef.getName(), numSamples);
// is
// this
// correct?
answer.nextCell(crfCompletionDate);
eventHeaders.add(crfCompletionDate);
eventDescriptions.put(crfCompletionDate, description);
}
if (dataset.isShowCRFinterviewerDate()) {
String interviewerDate = getColumnLabel(i, j, "InterviewDate", numSamples);
// FIXME
String description = getColumnDescription(i, j, "Interviewed Date for ", currentDef.getName(), numSamples);
// is
// this
// correct?
answer.nextCell(interviewerDate);
eventHeaders.add(interviewerDate);
eventDescriptions.put(interviewerDate, description);
}
if (dataset.isShowCRFinterviewerName()) {
String interviewerName = getColumnLabel(i, j, "InterviewerName", numSamples);
// FIXME
String description = getColumnDescription(i, j, "Interviewer Name for ", currentDef.getName(), numSamples);
// is
// this
// correct?
answer.nextCell(interviewerName);
eventHeaders.add(interviewerName);
eventDescriptions.put(interviewerName, description);
}
if (dataset.isShowCRFstatus()) {
// numSamples
String crfStatus = getColumnLabel(i, j, "CRFVersionStatus", numSamples);
// ?
// ?
// ?
// FIXME
String description = getColumnDescription(i, j, "Event CRF Status for ", currentDef.getName(), numSamples);
// is
// this
// correct?
answer.nextCell(crfStatus);
eventHeaders.add(crfStatus);
eventDescriptions.put(crfStatus, description);
}
if (dataset.isShowCRFversion()) {
String crfCompletionDate = getColumnLabel(i, j, "VersionName", numSamples);
// FIXME
String description = getColumnDescription(i, j, "CRF Version Name for ", currentDef.getName(), numSamples);
// is
// this
// correct?
answer.nextCell(crfCompletionDate);
eventHeaders.add(crfCompletionDate);
eventDescriptions.put(crfCompletionDate, description);
}
}
}
for (int i = 1; i <= numSEDs; i++) {
int numSamples = getSEDNumSamples(i);
for (int j = 1; j <= numSamples; j++) {
int numSEDCRFs = getSEDNumCRFs(i);
for (int k = 1; k <= numSEDCRFs; k++) {
// add CRF level descriptions here, tbh
int numItems = getNumItems(i, k);
for (int l = 1; l <= numItems; l++) {
// for (int m = 0; m <= maxItemDataBeanOrdinal; m++) {
for (Iterator iter = groupNames.entrySet().iterator(); iter.hasNext(); ) {
java.util.Map.Entry groupEntry = (java.util.Map.Entry) iter.next();
String groupName = (String) groupEntry.getKey();
logger.info("*** Found a row in groupNames: key " + groupName);
// groupName, it will not be added to item title
if (inKeys(i, j, k, l, groupName)) {
Integer groupCount = (Integer) groupEntry.getValue();
for (int m = 1; m <= groupCount.intValue(); m++) {
answer.nextCell(getColumnItemLabel(i, j, k, l, numSamples, m, groupName));
DisplayItemHeaderBean dih = new DisplayItemHeaderBean();
dih.setItemHeaderName(getColumnItemLabel(i, j, k, l, numSamples, m, groupName));
// ItemBean item = new ItemBean();
dih.setItem(currentItem);
itemNames.add(dih);
}
}
}
}
}
}
}
answer.nextRow();
// ////////////////
for (int h = 1; h <= getNumSubjects(); h++) {
DisplayItemDataBean didb = new DisplayItemDataBean();
String label = getSubjectStudyLabel(h);
answer.nextCell(label);
didb.setSubjectName(label);
String protocolId = getParentProtocolId();
answer.nextCell(protocolId);
didb.setStudyLabel(protocolId);
// subject column data
if (dataset.isShowSubjectDob()) {
if (study.getStudyParameterConfig().getCollectDob().equals("2")) {
String yob = getSubjectYearOfBirth(h);
answer.nextCell(yob);
didb.setSubjectDob(yob);
} else if (study.getStudyParameterConfig().getCollectDob().equals("1")) {
String dob = getSubjectDateOfBirth(h);
answer.nextCell(dob);
didb.setSubjectDob(dob);
}
}
if (dataset.isShowSubjectGender()) {
String gender = getSubjectGender(h);
answer.nextCell(gender);
didb.setSubjectGender(gender);
}
// TODO column headers above, column values here, tbh
if (dataset.isShowSubjectStatus()) {
String status = getSubjectStatusName(h);
answer.nextCell(status);
didb.setSubjectStatus(status);
}
if (dataset.isShowSubjectUniqueIdentifier() && "1".equals(showUniqueId)) {
String uniqueName = getSubjectUniqueIdentifier(h);
answer.nextCell(uniqueName);
didb.setSubjectUniqueId(uniqueName);
}
if (dataset.isShowSubjectSecondaryId()) {
String secondaryId = getSubjectSecondaryId(h);
answer.nextCell(secondaryId);
didb.setSubjectSecondaryId(secondaryId);
}
if (dataset.isShowSubjectGroupInformation()) {
ArrayList studyGroupList = new ArrayList();
// studyGroupMap =
studyGroupList = getStudyGroupMap(h);
// "+studyGroupMap.toString());
for (int y = 0; y < studyGroupClasses.size(); y++) {
StudyGroupClassBean sgcBean = (StudyGroupClassBean) studyGroupClasses.get(y);
// if the subject is in the group...
// logger.info("iterating through keys:
// "+sgcBean.getId());
Iterator iter = studyGroupList.iterator();
/*
* case 0 - no groups assigned - should just have a blank
* here
*/
if (!iter.hasNext()) {
answer.nextCell("");
didb.setGroupName(Integer.valueOf(sgcBean.getId()), "");
}
/*
* case 1 - one or more groups assigned - runs through the
* maps and assigns them in rows
*/
while (iter.hasNext()) {
studyGroupMap = (HashMap) iter.next();
if (studyGroupMap.containsKey(Integer.valueOf(sgcBean.getId()))) {
StudyGroupBean groupBean = (StudyGroupBean) studyGroupMap.get(Integer.valueOf(sgcBean.getId()));
// logger.info("found a group name in a group
// class: "+groupBean.getName());
answer.nextCell(groupBean.getName());
didb.setGroupName(Integer.valueOf(sgcBean.getId()), groupBean.getName());
break;
// didb.setGroupName(groupBean.getName());
// otherwise we don't enter anything...
} else {
answer.nextCell("");
didb.setGroupName(Integer.valueOf(sgcBean.getId()), "");
}
// end if
}
// end while
}
// end for
}
// sed column values
for (int i = 1; i <= numSEDs; i++) {
int numSamples = getSEDNumSamples(i);
// add event-specific attributes here, tbh
for (int j = 1; j <= numSamples; j++) {
if (dataset.isShowEventLocation()) {
String location = getEventLocation(h, i, j);
answer.nextCell(location);
didb.getEventValues().add(location);
}
if (dataset.isShowEventStart()) {
String start = getEventStart(h, i, j);
answer.nextCell(start);
didb.getEventValues().add(start);
}
if (dataset.isShowEventEnd()) {
String end = getEventEnd(h, i, j);
answer.nextCell(end);
didb.getEventValues().add(end);
}
if (dataset.isShowEventStatus()) {
String status = getEventStatus(h, i, j);
answer.nextCell(status);
didb.getEventValues().add(status);
}
if (dataset.isShowSubjectAgeAtEvent() && ("1".equals(study.getStudyParameterConfig().getCollectDob()) || "2".equals(study.getStudyParameterConfig().getCollectDob()))) {
String ageAtEvent = currentSubject.getDateOfBirth() != null ? getAgeAtEvent(h, i, j) : "";
answer.nextCell(ageAtEvent);
didb.getEventValues().add(ageAtEvent);
}
}
}
// item-crf-ordinal column labels
for (int i = 1; i <= numSEDs; i++) {
int numSamples = getSEDNumSamples(i);
for (int j = 1; j <= numSamples; j++) {
if (dataset.isShowCRFcompletionDate()) {
String completionDate = getCRFCompletionDate(h, i, j);
answer.nextCell(completionDate);
didb.getEventValues().add(completionDate);
}
if (dataset.isShowCRFinterviewerDate()) {
String interviewerDate = getCRFInterviewerDate(h, i, j);
answer.nextCell(interviewerDate);
didb.getEventValues().add(interviewerDate);
}
if (dataset.isShowCRFinterviewerName()) {
String interviewerName = getCRFInterviewerName(h, i, j);
answer.nextCell(interviewerName);
didb.getEventValues().add(interviewerName);
}
if (dataset.isShowCRFstatus()) {
String crfStatus = getSEDCRFStatus(h, i, j);
answer.nextCell(crfStatus);
didb.getEventValues().add(crfStatus);
}
if (dataset.isShowCRFversion()) {
String crfVersion = getSEDCRFVersionName(h, i, j);
answer.nextCell(crfVersion);
didb.getEventValues().add(crfVersion);
}
}
// end j
}
for (int i = 1; i <= numSEDs; i++) {
int numSamples = getSEDNumSamples(i);
// restart j so that text reports match tbh 03/08
for (int j = 1; j <= numSamples; j++) {
int numSEDCRFs = getSEDNumCRFs(i);
for (int k = 1; k <= numSEDCRFs; k++) {
// add CRF-level column data here, tbh
int numItems = getNumItems(i, k);
for (int l = 1; l <= numItems; l++) {
// {
for (java.util.Iterator iter = groupNames.entrySet().iterator(); iter.hasNext(); ) {
java.util.Map.Entry groupEntry = (java.util.Map.Entry) iter.next();
String groupName = (String) groupEntry.getKey();
if (inKeys(i, j, k, l, groupName)) {
// logger.info("found group name at line
// 703: " + groupName);
Integer groupCount = (Integer) groupEntry.getValue();
// groupCount);
for (int m = 1; m <= groupCount.intValue(); m++) {
String data = getDataByIndex(h, i, j, k, l, m, groupName);
// a guard clause here to take care of
// empties...
// if (!data.equals("") ||
// !groupName.equals(UNGROUPED)) {
answer.nextCell(data);
didb.getItemValues().add(data);
}
}
// }
// removing guard clause for now, tbh
// and the column code above should look about
// the same, tbh
}
}
}
}
}
rowValues.add(didb);
answer.nextRow();
}
}
use of org.akaza.openclinica.bean.managestudy.StudyGroupClassBean in project OpenClinica by OpenClinica.
the class StudyGroupClassDAO method findAllByStudy.
@Override
public ArrayList findAllByStudy(StudyBean study) {
ArrayList answer = new ArrayList();
this.setTypesExpected();
this.setTypeExpected(11, TypeNames.STRING);
this.setTypeExpected(12, TypeNames.STRING);
HashMap variables = new HashMap();
variables.put(new Integer(1), new Integer(study.getId()));
variables.put(new Integer(2), new Integer(study.getId()));
ArrayList alist = this.select(digester.getQuery("findAllByStudy"), variables);
Iterator it = alist.iterator();
while (it.hasNext()) {
HashMap hm = (HashMap) it.next();
StudyGroupClassBean group = (StudyGroupClassBean) this.getEntityFromHashMap(hm);
group.setStudyName((String) hm.get("study_name"));
logger.info("study Name" + group.getStudyName());
group.setGroupClassTypeName((String) hm.get("type_name"));
answer.add(group);
}
return answer;
}
use of org.akaza.openclinica.bean.managestudy.StudyGroupClassBean in project OpenClinica by OpenClinica.
the class UpdateSubjectGroupClassServlet method processRequest.
@Override
public void processRequest() throws Exception {
String action = request.getParameter("action");
FormProcessor fp = new FormProcessor(request);
int classId = fp.getInt("id");
if (classId == 0) {
addPageMessage(respage.getString("please_choose_a_subject_group_class_to_edit"));
forwardPage(Page.SUBJECT_GROUP_CLASS_LIST_SERVLET);
} else {
StudyGroupClassDAO sgcdao = new StudyGroupClassDAO(sm.getDataSource());
StudyGroupDAO sgdao = new StudyGroupDAO(sm.getDataSource());
if (!fp.isSubmitted()) {
StudyGroupClassBean sgcb = (StudyGroupClassBean) sgcdao.findByPK(classId);
ArrayList groups = sgdao.findAllByGroupClass(sgcb);
request.setAttribute("groupTypes", GroupClassType.toArrayList());
session.setAttribute("group", sgcb);
session.setAttribute("studyGroups", groups);
forwardPage(Page.UPDATE_SUBJECT_GROUP_CLASS);
} else {
if (action.equalsIgnoreCase("confirm")) {
confirmGroup();
} else if (action.equalsIgnoreCase("submit")) {
submitGroup();
} else {
addPageMessage(respage.getString("no_action_specified"));
forwardPage(Page.SUBJECT_GROUP_CLASS_LIST_SERVLET);
}
}
}
}
use of org.akaza.openclinica.bean.managestudy.StudyGroupClassBean in project OpenClinica by OpenClinica.
the class ListStudySubjectTableFactory method getColumnNamesMap.
private void getColumnNamesMap() {
ArrayList<String> columnNamesList = new ArrayList<String>();
columnNamesList.add("studySubject.label");
columnNamesList.add("studySubject.status");
columnNamesList.add("enrolledAt");
columnNamesList.add("studySubject.oid");
columnNamesList.add("subject.charGender");
columnNamesList.add("studySubject.secondaryLabel");
for (StudyGroupClassBean studyGroupClass : getStudyGroupClasses()) {
columnNamesList.add("sgc_" + studyGroupClass.getId());
}
for (StudyEventDefinitionBean studyEventDefinition : getStudyEventDefinitions()) {
columnNamesList.add("sed_" + studyEventDefinition.getId());
}
columnNamesList.add("actions");
columnNames = columnNamesList.toArray(columnNames);
}
use of org.akaza.openclinica.bean.managestudy.StudyGroupClassBean in project OpenClinica by OpenClinica.
the class ListStudySubjectTableFactory method getColumnNames.
private void getColumnNames() {
ArrayList<String> columnNamesList = new ArrayList<String>();
columnNamesList.add("label");
columnNamesList.add("status");
columnNamesList.add("enrolledAt");
columnNamesList.add("oid");
columnNamesList.add("subject.charGender");
columnNamesList.add("secondaryLabel");
for (StudyGroupClassBean studyGroupClass : getStudyGroupClasses()) {
columnNamesList.add("sgc_" + studyGroupClass.getId());
}
for (StudyEventDefinitionBean studyEventDefinition : getStudyEventDefinitions()) {
columnNamesList.add("sed_" + studyEventDefinition.getId());
}
columnNamesList.add("actions");
columnNames = columnNamesList.toArray(columnNames);
}
Aggregations