public List<Candidate> getCandidatesForResponse(MedicFormResponse response) {
    Log.info("Attempting to map response");
    // get the CHW that submitted the form
    CommunityHealthWorker chw = (CommunityHealthWorker) response.getSubmitter();
    // get the list of patients that the CHW cares for
    ArrayList<Patient> patients = (ArrayList<Patient>) patientDao.getPatientsForCHW(chw);
    ArrayList<Candidate> candidates = new ArrayList<Candidate>();
    // iterate through all fields on the form, seeing if they are mapped to patient identifying
    // fields
    // e.g. Birthdate, Name, and Patient ID
    for (Patient patient : patients) {
      candidates.add(new Candidate(patient));
    }
    List<MedicFormFieldResponse> responses = response.getResponses();
    try {
      responses.get(0).getDateSubmitted();
    } catch (Exception e) {
      responses = formFieldResponseDao.getResponsesForFormResponse(response);
    }

    for (MedicFormFieldResponse fieldResponse : responses) {
      // if it is mapped to a namefield, score it as a name
      if (fieldResponse.getField().getMapping() == PatientFieldMapping.NAMEFIELD) {
        for (Candidate c : candidates) {
          c.setNameScore(
              getNameDistance(c.getName().toLowerCase(), fieldResponse.getValue().toLowerCase()));
        }
        // if it is mapped to an id field, score it as an ID
      } else if (fieldResponse.getField().getMapping() == PatientFieldMapping.IDFIELD) {
        for (Candidate c : candidates) {
          c.setIdScore(getEditDistance(c.getStringID(), fieldResponse.getValue()));
        }
        // if it is mapped as a bday field, score it as a bday
      } else if (fieldResponse.getField().getMapping() == PatientFieldMapping.BIRTHDATEFIELD) {
        for (Candidate c : candidates) {
          if (fieldResponse.getValue().length() <= 8) {
            c.setBirthdateScore(
                getEditDistance(
                    shortFormatter.format(c.getPatient().getBirthdate()),
                    fieldResponse.getValue()));
          } else {
            c.setBirthdateScore(
                getEditDistance(
                    longFormatter.format(c.getPatient().getBirthdate()), fieldResponse.getValue()));
          }
        }
      }
    }
    Collections.sort(candidates);
    return candidates.subList(0, 5);
  }
  @Override
  public List<CsvValidationException> validate(CSVReader reader) {
    int lineNumber = 0;
    String[] currLine;
    List<CsvValidationException> exceptions = new ArrayList<CsvValidationException>();
    try {
      while ((currLine = reader.readNext()) != null) {
        if (currLine.length != fields.size() + 1) {
          exceptions.add(
              new CsvValidationException(
                  lineNumber, getI18NString("medic.importer.column.mismatch.error")));
        }
        // determine the submitter of the form
        List<CommunityHealthWorker> chws = chwDao.getCommunityHealthWorkerByName(currLine[0], -1);
        if (chws.size() != 1) {
          List<User> users = userDao.getUsersByName(currLine[0], -1);
          if (users.size() != 1) {
            List<User> usernames = userDao.findUsersByUsername(currLine[0]);
            if (usernames.size() != 1) {
              try {
                long id = Long.parseLong(currLine[0]);
                CommunityHealthWorker chwById = chwDao.getCommunityHealthWorkerById(id);
                if (chwById == null) {
                  User userById = userDao.getUsersById(id);
                  if (userById == null) {
                    exceptions.add(
                        new CsvValidationException(
                            lineNumber,
                            getI18NString("medic.importer.unknown.submitter.error")
                                + " \""
                                + currLine[0]
                                + "\""));
                  }
                }
              } catch (Exception e) {
                exceptions.add(
                    new CsvValidationException(
                        lineNumber,
                        getI18NString("medic.importer.unknown.submitter.error")
                            + " \""
                            + currLine[0]
                            + "\""));
              }
            }
          }
        }

        String name = null;
        String id = null;
        String birthdate = null;
        for (int i = 1; i < fields.size(); i++) {
          MedicFormField field = fields.get(i - 1);
          // check for mappings
          if (field.getMapping() == PatientFieldMapping.NAMEFIELD) {
            name = currLine[i];
          } else if (field.getMapping() == PatientFieldMapping.BIRTHDATEFIELD) {
            birthdate = currLine[i];
          } else if (field.getMapping() == PatientFieldMapping.IDFIELD) {
            id = currLine[i];
          }

          if (field.getDatatype() == DataType.DATE_FIELD) {
            validateDate(currLine[i], lineNumber, exceptions);
          } else if (field.getDatatype() == DataType.POSITIVENEGATIVE
              || field.getDatatype() == DataType.TRUEFALSE
              || field.getDatatype() == DataType.YESNO
              || field.getDatatype() == DataType.CHECK_BOX) {
            validateBoolean(currLine[i], lineNumber, exceptions);
          } else {
            validateString(currLine[i], lineNumber, exceptions);
          }
        }
        Patient p = patientDao.getPatient(name, birthdate, id);
        if (p == null) {
          exceptions.add(
              new CsvValidationException(
                  lineNumber, getI18NString("medic.importer.unknown.subject.error")));
        }
      }
    } catch (IOException e) {
      e.printStackTrace();
    }
    return exceptions;
  }