public static List<ObsGroupComponent> findQuestionsAndAnswersForGroup(String parentGroupingConceptId, Node node) { List<ObsGroupComponent> ret = new ArrayList<ObsGroupComponent>(); findQuestionsAndAnswersForGroupHelper(parentGroupingConceptId,node, ret); return ret; }
public Obs getNextUnmatchedObsGroup(String path) { Obs ret = null; int unmatchedContenterCount = 0; for (Map.Entry<Obs, Set<Obs>> e : existingObsInGroups.entrySet() ) { if (path.equals(ObsGroupComponent.getObsGroupPath(e.getKey()))) { if (ret == null) ret = e.getKey(); unmatchedContenterCount++; } } if (ret != null){ if (unmatchedContenterCount > 1) { guessingInd = true; } existingObsInGroups.remove(ret); existingObs.remove(ret); return ret; } return null; }
boolean questionMatches = obsGroupComponent.getQuestion().getConceptId().equals(obs.getConcept().getConceptId()); boolean answerMatches = obsGroupComponent.getAnswer() == null ||(obs.getValueCoded() != null && obsGroupComponent.getAnswer().getConceptId().equals(obs.getValueCoded().getConceptId())); if (!obsGroupComponentMatchLog.contains(obsGroupComponent.getQuestion().getConceptId())) { if (obs.getValueCoded() == null || obs.getValueCoded().getConceptId() == null) { return 0; } else { if (obsGroupComponent.isPartOfSet()) { if (obsGroupComponent.getRemainingInSet() == 1) { return -1000; if (obsGroupComponent.getAnswer() != null) { obsGroupComponentMatchLog.add(obsGroupComponent.getQuestion().getConceptId()); rank++;
private Obs findObsGroup(FormEntrySession session, Node node, String parentGroupingConceptId) { String path = ObsGroupComponent.getObsGroupPath(node); if (session.getContext().isUnmatchedMode()) { return session.getContext().getNextUnmatchedObsGroup(path); } else { List<ObsGroupComponent> questionsAndAnswers = ObsGroupComponent.findQuestionsAndAnswersForGroup(parentGroupingConceptId, node); return session.getContext().findBestMatchingObsGroup(questionsAndAnswers, parentGroupingConceptId, path); } }
log.debug("Comparing obsVal " + ObsGroupComponent.getObsGroupPath(e.getKey()) + " to xmlval " + path); if (path.equals(ObsGroupComponent.getObsGroupPath(e.getKey())) ) { contenders.add(e.getKey()); int rank = ObsGroupComponent.supportingRank(questionsAndAnswers, parentObs, existingObsInGroups.get(parentObs));
@Deprecated public static boolean supports(List<ObsGroupComponent> questionsAndAnswers, Obs parentObs, Set<Obs> group) { for (Obs obs : group) { boolean match = false; for (ObsGroupComponent test : questionsAndAnswers) { boolean questionMatches = test.getQuestion().getConceptId().equals(obs.getConcept().getConceptId()); boolean answerMatches = test.getAnswer() == null ||(obs.getValueCoded() != null && test.getAnswer().getConceptId().equals(obs.getValueCoded().getConceptId())); if (questionMatches && !answerMatches) { match = false; break; } if (questionMatches && answerMatches) { match = true; } } if (!match){ return false; } } return true; }
int setCounter = 0; for (Concept c : answersList) { obsGroupComponents.add(new ObsGroupComponent(question, c, answersList.size() - (setCounter++))); obsGroupComponents.add(new ObsGroupComponent(c, answer, questions.size() - (setCounter++))); obsGroupComponents.add(new ObsGroupComponent(question, answer)); NamedNodeMap attrs = node.getAttributes(); attrs.getNamedItem("groupingConceptId").getNodeValue(); obsGroupComponents.add(new ObsGroupComponent(HtmlFormEntryUtil.getConcept(attrs.getNamedItem("groupingConceptId").getNodeValue()), null)); } catch (Exception ex){ throw new RuntimeException("Unable to get groupingConcept out of obsgroup tag."); findQuestionsAndAnswersForGroupHelper(parentGroupingConceptId, nl.item(i), obsGroupComponents);
obsGroupEntity.setPath(ObsGroupComponent.getObsGroupPath(node)); obsGroupEntity.setQuestionsAndAnswers(ObsGroupComponent.findQuestionsAndAnswersForGroup(attributes.get("groupingConceptId"), node)); obsGroupEntity.setXmlObsGroupConcept(attributes.get("groupingConceptId")); obsGroupEntity.setGroupingConcept(groupingConcept);