Changeset 1341


Ignore:
Timestamp:
Apr 11, 2011, 2:57:42 PM (11 years ago)
Author:
Nicklas Nordborg
Message:

References #307: Consent form registration

Added "Consent" annotation to the installation servlet. The "Personal information wizard" and the "Referral form wizard" are now aware of this annotation and should refuse to work with cases that are annotated with anything else than "Yes".

Location:
extensions/net.sf.basedb.reggie/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/index.jsp

    r1335 r1341  
    132132        <%
    133133      }
     134      if (isPatientCurator || isAdmin)
     135      {
     136        %>
     137        <dt>
     138          <table border="0" cellspacing="0" cellpadding="0">
     139          <tr>
     140            <td><base:icon image="file.gif" style="padding-right: 4px;"/></td>
     141            <td><a href="consentform.jsp?ID=<%=ID%>">Consent form registration wizard</a></td>
     142          </tr>
     143          </table>
     144        </dt>
     145        <dd>
     146          <ul>
     147          <li>Register consent forms.
     148          </ul>
     149        </dd>
     150        <%
     151      }
    134152      %>
    135153      </dl>
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/Reggie.java

    r1340 r1341  
    104104  public static final String ANNOTATION_RNALATER_DATETIME = "RNALaterDateTime";
    105105
     106 
     107  /**
     108    The name of the "Consent" annotation type, used
     109    for samples (Case). It is an enumerated string annotation
     110    type with three options: Yes, No and Not asked
     111  */
     112  public static final String ANNOTATION_CONSENT = "Consent";
     113 
    106114  /**
    107115    The name of the "PatientCurator" group. Members of this group
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Case.java

    r1335 r1341  
    1212import net.sf.basedb.core.Item;
    1313import net.sf.basedb.core.ItemQuery;
     14import net.sf.basedb.core.PermissionDeniedException;
    1415import net.sf.basedb.core.Sample;
    1516import net.sf.basedb.core.Type;
     
    195196  }
    196197 
     198  /**
     199    Verify that the patient has given their permission to participate in the
     200    study. Due to the order that things get registered, a non-existing "Consent"
     201    annotation is accepted. If the annotation exists the answer must be "Yes",
     202    or an exception is thrown.
     203  */
     204  public void verifyConsent(DbControl dc, AnnotationType consentType)
     205  {
     206    if (consentType == null)
     207    {
     208      consentType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_CONSENT, true);
     209    }
     210    String consent = (String)Reggie.getAnnotationValue(getItem(), consentType);
     211    if (consent != null && !consent.equals("Yes"))
     212    {
     213      throw new PermissionDeniedException("The case (" + getOriginalName() +
     214        ") has not agreed to participate in the study.");
     215    }
     216
     217  }
    197218 
    198219}
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java

    r1325 r1341  
    100100        jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_ALL_FIRST_NAMES, Item.BIOSOURCE, Type.STRING, 1,
    101101            null, sharedToPatientCurator, createIfMissing));
     102        jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_CONSENT, Item.SAMPLE, Type.STRING, 1,
     103            new EnumerationOptions("Yes", "No", "Not asked"), sharedToPatientCurator, createIfMissing));
    102104       
    103105        // -- the second batch need only be shared to the active project or to the PatientCurator group
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/PersonalRegistrationServlet.java

    r1333 r1341  
    8787        if (theCase != null)
    8888        {
     89          theCase.verifyConsent(dc, null);
     90         
    8991          // Load the patient associated with the case
    9092          Patient patient = Patient.findByCase(dc, theCase);
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/ReferralFormServlet.java

    r1336 r1341  
    1212import org.json.simple.JSONObject;
    1313
     14import net.sf.basedb.core.AnnotationType;
    1415import net.sf.basedb.core.AnyToAny;
    1516import net.sf.basedb.core.Application;
     
    2829import net.sf.basedb.core.query.Restriction;
    2930import net.sf.basedb.core.query.Restrictions;
     31import net.sf.basedb.reggie.Reggie;
    3032import net.sf.basedb.reggie.dao.Case;
    3133import net.sf.basedb.util.Values;
     
    7173        int directoryId = Values.getInt(req.getParameter("directoryId"));
    7274        String pattern = Values.getString(req.getParameter("pattern"));
     75       
     76        AnnotationType consentType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_CONSENT, true);
    7377       
    7478        Directory dir = Directory.getById(dc, directoryId);
     
    132136                jsonFile.put("message", "No case found");
    133137              }
     138              else
     139              {
     140                // Found a case -- verify that consent is given
     141                theCase.verifyConsent(dc, consentType);
     142              }
    134143            }
    135144          }
     
    137146          {
    138147            jsonFile.put("message", ex.getMessage());
     148            theCase = null;
    139149          }
    140150
Note: See TracChangeset for help on using the changeset viewer.