use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.
the class ExtractBean method addStudyEventData.
// addStudySubjectData
/*
* public void addStudySubjectData(Integer studySubjectId, String
* studySubjectLabel, Date dateOfBirth, String gender, Integer
* subjectStatusId, Boolean dobCollected, String uniqueIdentifier, String
* subjectSecondaryLabel) { if (!subjectsAdded.containsKey(studySubjectId))
* { StudySubjectBean sub = new StudySubjectBean();
* sub.setId(studySubjectId.intValue()); sub.setLabel(studySubjectLabel);
*
* sub.setDateOfBirth(dateOfBirth); if (gender != null && gender.length() >
* 0) { sub.setGender(gender.charAt(0)); } else { sub.setGender(' '); }
* sub.setStatus(Status.get(subjectStatusId.intValue())); //
* sub.setSecondaryLabel(secondaryID);//????
* sub.setUniqueIdentifier(uniqueIdentifier);
* sub.setSecondaryLabel(subjectSecondaryLabel); //
* sub.setEnrollmentDate(enrollmentDate); // TODO need to find enrollment
* date, later, tbh subjects.add(sub); subjectsAdded.put(studySubjectId,
* Boolean.TRUE); } }
*/
/**
* @vbc 08/06/2008 NEW EXTRACT DATA IMPLEMENTATION Combines the two HashMaps
* into eventData entries - the data is already filtered for null
* values
*/
public void addStudyEventData() {
/**
* The two ArrayList are synchronized because they are extracted with
* "ORDER BY aitem_data_id"
*/
boolean isfnd = false;
// initialize
eventData = new HashMap();
for (int ik = 0; ik < aBASE_ITEMDATAID.size(); ik++) {
// get the item_group side
extractDataset_ITEMGROUPSIDE objgrp = (extractDataset_ITEMGROUPSIDE) hBASE_ITEMGROUPSIDE.get(ik);
extractDataset_EVENTSIDE objev = (extractDataset_EVENTSIDE) hBASE_EVENTSIDE.get(ik);
// sanity check - assume both are not null
Integer itemdataid = (Integer) aBASE_ITEMDATAID.get(ik);
Integer itemdataid_objgrp = objgrp.itemDataId;
Integer itemdataid_objev = objev.itemDataId;
if (itemdataid_objgrp.intValue() == itemdataid.intValue() && itemdataid_objev.intValue() == itemdataid.intValue()) {
// OK - add entries to the dataEvent
// initialize
StudyEventBean event = new StudyEventBean();
EventCRFBean eventCRF = new EventCRFBean();
//
// studyEventDefinitionName
event.setName(objev.studyEventDefinitionName);
// studyEventStart
event.setDateStarted(objev.studyEventDateStart);
// studyEventEnd
event.setDateEnded(objev.studyEventDateEnd);
// studyEventLocation
event.setLocation(objev.studyEventLoacation);
// sampleOrdinal
event.setSampleOrdinal(objev.sampleOrdinal.intValue());
// .
// intValue
// ()
// studyEventDefinitionId
event.setStudyEventDefinitionId(objev.studyEvenetDefinitionId.intValue());
// .
// intValue
// (
// )
// studySubjectId
event.setStudySubjectId(objev.studySubjectId.intValue());
// .
// intValue
// ()
// se
event.setStartTimeFlag(objev.studyEventStartTimeFlag.booleanValue());
// .
// getStartTimeFlag
// (
// )
// se
event.setEndTimeFlag(objev.studyEventEndTimeFlag.booleanValue());
// .
// getEndTimeFlag
// (
// )
// below needs to be added, tbh
// TODO - @vbc - validate this
// se
event.setStatus(Status.get(objev.studyEventStatusId.intValue()));
// .
// getStatus
// (
// )
// se
event.setSubjectEventStatus(SubjectEventStatus.get(objev.studyEventSubjectEventStatusId.intValue()));
// .
// getSubjectEventStatus
// (
// )
// @vbc 08/06/2008 NEW EXTRACT DATA IMPLEMENTATION
// the stage is set on setStatus - skip it
// event.setStage(se.getStage());
// se.getId()
event.setId(objev.studyEventId.intValue());
// end tbh, 03/08
// completionStatusId
eventCRF.setCompletionStatusId(objgrp.eventCrfCompletionStatusId);
// .
// intValue
// (
// )
// interviewerName
eventCRF.setInterviewerName(objgrp.interviewerName);
// dateCompleted
eventCRF.setDateCompleted(objgrp.eventCrfDateCompleted);
// dateValidateCompleted
eventCRF.setDateValidateCompleted(objgrp.eventCrfDateValidateCompleted);
eventCRF.setStatus(Status.get(objgrp.eventCrfStatusId));
// eventCRF.setCreatedDate();//same as interviewed date? NO
// dateInterviewedv
eventCRF.setDateInterviewed(objgrp.dateInterviewed);
// eventCRF.setStatus(status); //this is the one that we want,
// tbh
CRFVersionBean crfVersion = new CRFVersionBean();
// crfVersionName
crfVersion.setName(objgrp.crfVersionName);
// crfVersionStatusId
crfVersion.setStatus(Status.get(objgrp.crfVersionStatusId.intValue()));
// crfVersionStatusId
crfVersion.setStatusId(objgrp.crfVersionStatusId.intValue());
// .
// intValue
// (
// )
eventCRF.setCrfVersion(crfVersion);
ArrayList events = new ArrayList();
events.add(eventCRF);
// logger.info("///adding an event CRF..."
// + eventCRF.getInterviewerName());
// hmm, one to one relationship?
event.setEventCRFs(events);
// guard clause to see if it's in there already?
// not rly, the above is only used in auditlogging
// could fit in crf and crf version ids here, though
// FIXME def not one to one relationship, tbh, 03.08
String key = getStudyEventDataKey(/* studySubjectId.intValue() */
objev.studySubjectId.intValue(), /* studyEventDefinitionId.intValue() */
objev.studyEvenetDefinitionId.intValue(), /* sampleOrdinal.intValue()) */
objev.sampleOrdinal.intValue());
if (eventData == null) {
eventData = new HashMap();
}
StudyEventBean checkEvent = (StudyEventBean) eventData.get(key);
if (checkEvent == null) {
eventData.put(key, event);
// logger.info("###just CREATED key: " + key + " event: " +
// event.getName() + " int.name: " +
// eventCRF.getInterviewerName());
} else {
// OK - already saved
}
} else {
isfnd = true;
}
//
}
// for
// before return quick count
logger.debug("Number of entries in the eventData is:" + eventData.size());
}
use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.
the class ExtractBean method getCRFInterviewerDate.
protected String getCRFInterviewerDate(int h, int i, int j) {
StudyEventBean seb = getEvent(h, i, j);
EventCRFBean eventCRF = null;
if (seb.getEventCRFs().size() > 0) {
eventCRF = (EventCRFBean) seb.getEventCRFs().get(0);
}
// c.setTime(eventCRF.getDateInterviewed());
return eventCRF != null && eventCRF.getDateInterviewed() != null ? sdf.format(eventCRF.getDateInterviewed()) : "";
}
use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.
the class ExtractBean method getSEDCRFStatus.
// private String getSEDCRFName(int sedInd, int crfInd) {
// syncCRFIndex(sedInd, crfInd);
// return currentCRF.getName();
// }
// private String getSEDCRFVersionName(int h, int sedInd, int crfInd) {
// syncCRFIndex(sedInd, crfInd);
//
// StudyEventBean seb = getEvent(h, sedInd, crfInd);
//
// String returnMe = "";
// //ArrayList versions = currentCRF.getVersions();//returns zero results
// EventCRFBean eventCRF = null;
// if (seb.getEventCRFs().size() > 0) {
// logger.info("found getEventCRFs.size " + seb.getEventCRFs().size());
// for (int t = 0; t < seb.getEventCRFs().size(); t++) {
// eventCRF = (EventCRFBean) seb.getEventCRFs().get(t);
// returnMe = eventCRF.getCrfVersion().getName();
// //logger.info("found versions.size "+versions.size());
// //for (int s = 0; s < versions.size(); s++) {
// // CRFVersionBean version = (CRFVersionBean)versions.get(s);
// // if (version.getId()==eventCRF.getCRFVersionId()) {
// // returnMe = version.getName();
// //break;
// // }
// //}
// }
//
// }
// logger.info("returning the following for crf version name: " + returnMe);
// return returnMe;
// }
private String getSEDCRFStatus(int h, int sedInd, int crfInd) {
// BADS Flag
syncCRFIndex(sedInd, crfInd);
StudyEventBean seb = getEvent(h, sedInd, crfInd);
Status ecStatus = Status.AVAILABLE;
EventCRFBean eventCRF = null;
if (seb.getEventCRFs().size() > 0) {
eventCRF = (EventCRFBean) seb.getEventCRFs().get(0);
}
String crfVersionStatus = "";
SubjectEventStatus status = SubjectEventStatus.NOT_SCHEDULED;
CRFVersionBean crfv = new CRFVersionBean();
crfv.setStatus(Status.AVAILABLE);
// modified stage so that crfVersionStatus could be the same as what it
// shows in subject matrix - as required.
DataEntryStage stage = DataEntryStage.INVALID;
try {
stage = eventCRF.getStage();
ecStatus = eventCRF.getStatus();
// SubjectEventStatus.get(
status = seb.getSubjectEventStatus();
// eventCRF
// .getCompletionStatusId());
crfv = eventCRF.getCrfVersion();
} catch (NullPointerException e) {
logger.info("exception hit, status set to not scheduled");
}
// currentCRF.getStatus().getName();
//
logger.info("event crf stage: " + stage.getName() + ", event crf status: " + ecStatus.getName() + ", STATUS: " + status.getName() + " crf version: " + crfv.getStatus().getName() + " data entry stage: " + stage.getName());
if (stage.equals(DataEntryStage.INVALID) || ecStatus.equals(Status.INVALID)) {
stage = DataEntryStage.UNCOMPLETED;
}
crfVersionStatus = stage.getName();
if (status.equals(SubjectEventStatus.LOCKED) || status.equals(SubjectEventStatus.SKIPPED) || status.equals(SubjectEventStatus.STOPPED)) {
crfVersionStatus = DataEntryStage.LOCKED.getName();
} else if (status.equals(SubjectEventStatus.INVALID)) {
crfVersionStatus = DataEntryStage.LOCKED.getName();
} else if (!currentCRF.getStatus().equals(Status.AVAILABLE)) {
crfVersionStatus = DataEntryStage.LOCKED.getName();
} else if (!crfv.getStatus().equals(Status.AVAILABLE)) {
crfVersionStatus = DataEntryStage.LOCKED.getName();
}
logger.info("returning: " + crfVersionStatus);
return crfVersionStatus;
}
use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.
the class ExtractBean method getSEDCRFVersionName.
private String getSEDCRFVersionName(int h, int sedInd, int crfInd) {
// syncCRFIndex(sedInd, crfInd);
StudyEventBean seb = getEvent(h, sedInd, crfInd);
EventCRFBean eventCRF = null;
if (seb.getEventCRFs().size() > 0) {
eventCRF = (EventCRFBean) seb.getEventCRFs().get(0);
}
String returnMe = "";
// EventCRFBean eventCRF = null;
if (seb.getEventCRFs().size() > 0) {
logger.info("found getEventCRFs.size " + seb.getEventCRFs().size());
for (int t = 0; t < seb.getEventCRFs().size(); t++) {
eventCRF = (EventCRFBean) seb.getEventCRFs().get(t);
returnMe = eventCRF.getCrfVersion().getName();
// logger.info("found versions.size "+versions.size());
// for (int s = 0; s < versions.size(); s++) {
// CRFVersionBean version = (CRFVersionBean)versions.get(s);
// if (version.getId()==eventCRF.getCRFVersionId()) {
// returnMe = version.getName();
// break;
// }
// }
}
}
logger.info("returning the following for crf version name: " + returnMe);
return returnMe;
}
use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.
the class ExtractBean method getCRFStatus.
// below created to support CRF metadata, tbh
protected String getCRFStatus(int h, int i, int j) {
// return crfbean.getStatus().getName();
// return currentCRF.getStatus().getName();
StudyEventBean seb = getEvent(h, i, j);
ArrayList crfbeans = currentDef.getCrfs();
EventCRFBean eventCRF = null;
if (seb.getEventCRFs().size() > 0) {
eventCRF = (EventCRFBean) seb.getEventCRFs().get(0);
}
return eventCRF != null ? eventCRF.getStatus().getName() : "";
}
Aggregations