Search in sources :

Example 96 with EventCRFBean

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());
}
Also used : EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean)

Example 97 with EventCRFBean

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()) : "";
}
Also used : EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean)

Example 98 with EventCRFBean

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;
}
Also used : Status(org.akaza.openclinica.bean.core.Status) SubjectEventStatus(org.akaza.openclinica.bean.core.SubjectEventStatus) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) SubjectEventStatus(org.akaza.openclinica.bean.core.SubjectEventStatus) DataEntryStage(org.akaza.openclinica.bean.core.DataEntryStage)

Example 99 with EventCRFBean

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;
}
Also used : EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean)

Example 100 with EventCRFBean

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() : "";
}
Also used : EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) ArrayList(java.util.ArrayList) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean)

Aggregations

EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)198 ArrayList (java.util.ArrayList)118 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)89 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)85 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)68 ItemDataBean (org.akaza.openclinica.bean.submit.ItemDataBean)64 ItemDataDAO (org.akaza.openclinica.dao.submit.ItemDataDAO)63 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)62 HashMap (java.util.HashMap)54 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)52 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)52 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)48 Date (java.util.Date)47 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)47 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)44 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)43 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)42 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)41 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)41 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)41