public CodeableConceptDt addTRCodingOrDisplay(Concept concept) {
   CodeableConceptDt codeableConceptDt = addTRCoding(concept);
   if (CollectionUtils.isEmpty(codeableConceptDt.getCoding())) {
     CodingDt coding = codeableConceptDt.addCoding();
     coding.setDisplay(concept.getName().getName());
   }
   return codeableConceptDt;
 }
 public CodeableConceptDt getTRValueSetCodeableConcept(
     Concept concept, String valueSetURL, CodeableConceptDt codeableConcept) {
   CodingDt coding = codeableConcept.addCoding();
   if (null != idMappingsRepository.findByInternalId(concept.getUuid())) {
     coding.setCode(getTRValueSetCode(concept));
     coding.setSystem(valueSetURL);
   }
   coding.setDisplay(concept.getName().getName());
   return codeableConcept;
 }
 public String getTRValueSetCode(Concept concept) {
   for (ConceptMap mapping : concept.getConceptMappings()) {
     if (mapping.getConceptMapType().getUuid().equals(ConceptMapType.SAME_AS_MAP_TYPE_UUID)) {
       return mapping.getConceptReferenceTerm().getCode();
     }
   }
   for (ConceptName conceptName : concept.getShortNames()) {
     return conceptName.getName();
   }
   return concept.getName().getName();
 }
Exemplo n.º 4
0
  private Concept mockConcept() {
    QNameUtil qnames = QNameUtil.instance();
    Concept mocked = mock(Concept.class);
    try {
      when(mocked.getName())
          .thenReturn(qnames.createQNameInPreconstructedNamespace(CONCEPT_LOCALNAME));
    } catch (Exception ex) {
      throw new Error(ex);
    }

    return mocked;
  }
 private void addTRCodingForConcept(
     Concept concept,
     IdMappingsRepository idMappingsRepository,
     CodeableConceptDt codeableConcept) {
   IdMapping idMapping = idMappingsRepository.findByInternalId(concept.getUuid());
   if (idMapping != null) {
     addFHIRCoding(
         codeableConcept,
         idMapping.getExternalId(),
         idMapping.getUri(),
         concept.getName().getName());
   }
 }
 private void addTRCodingsForReferenceTerms(
     Concept concept,
     IdMappingsRepository idMappingsRepository,
     CodeableConceptDt codeableConcept,
     ConceptMap mapping) {
   ConceptReferenceTerm conceptReferenceTerm = mapping.getConceptReferenceTerm();
   IdMapping idMapping = idMappingsRepository.findByInternalId(conceptReferenceTerm.getUuid());
   if (idMapping != null) {
     addFHIRCoding(
         codeableConcept,
         conceptReferenceTerm.getCode(),
         idMapping.getUri(),
         concept.getName().getName());
   }
 }
Exemplo n.º 7
0
  private void processMatchedConcepts(
      List<Concept> matchedConcepts,
      String matchedText,
      int tokenPosn,
      Map<Concept, Score> tokTable,
      PrintWriter pw) {
    // Increment match score of the matched concept and record information
    // about where in the article it was found
    for (Concept c : matchedConcepts) {
      Score cnt = tokTable.get(c);
      if (cnt == null) {
        tokTable.put(c, new Score(tokenPosn));
      } else {
        cnt.addMatch(tokenPosn);
      }

      // Output the concept to the token file for debugging purposes
      if (pw != null) {
        pw.println(c.getName() + "<" + c.getKey() + ">:" + tokenPosn + ":TEXT=" + matchedText);
      }
      System.out.println(
          c.getName() + "<" + c.getKey() + ">:" + tokenPosn + ":TEXT=" + matchedText);
    }
  }