src/main/java/nl/bioinf/minorapplicationdesign/ontpillen/model/web_scraping/DrugFetcher.java
/**
     * Method that checks if the given drug element is a drugGroup of drugSubstance and will add it to the
     * dao.
     * @param drugGroups List with html elements containing the remaining drug groups
     * @param currentDrugElement html element with the current drug
     * @param currentDrugGroup current drugGroup
     */
Method that checks if the given drug element is a drugGroup of drugSubstance and will add it to the
dao.
@param drugGroups List with html elements containing the remaining drug groups
@param currentDrugElement html element with the current drug
@param currentDrugGroup current drugGroup
Method that checks if the given drug element is a drugGroup of drugSubstance and will add it to the dao . @param drugGroups List with html elements containing the remaining drug groups @param currentDrugElement html element with the current drug @param currentDrugGroup current drugGroup
private void addDrugs(List<Element> drugGroups, Element currentDrugElement, DrugGroup currentDrugGroup) {
        if (currentDrugElement.nextElementSibling().is("ul")) {
            List<String> childrenNames = currentDrugElement.nextElementSibling().select("li").eachText();
            LOGGER.debug("Adding: " + currentDrugGroup.getName() + " to drugSubstances");
            addDrugSubstances(currentDrugGroup, childrenNames);
        } else {
            String query = currentDrugElement.nextElementSibling().tagName();
            Elements nextGroupSiblings = currentDrugElement.nextElementSiblings().select(query);
            List<String> childrenNames = nextGroupSiblings.eachText();
            childrenNames = childrenNames.stream().map(str -> str.toLowerCase()).collect(Collectors.toList());
            LOGGER.debug("Adding: " + currentDrugGroup.getName() + " to DrugGroups");
            addDrugGroup(currentDrugGroup, childrenNames);
            drugGroups.addAll(nextGroupSiblings);
        }
    }
private void addDrugs ( List < Element > drugGroups , Element currentDrugElement , DrugGroup currentDrugGroup ) { if ( currentDrugElement . nextElementSibling ( ) . is ( "ul" ) ) { List < String > childrenNames = currentDrugElement . nextElementSibling ( ) . select ( "li" ) . eachText ( ) ; LOGGER . debug ( "Adding: " + currentDrugGroup . getName ( ) + " to drugSubstances" ) ; addDrugSubstances ( currentDrugGroup , childrenNames ) ; } else { String query = currentDrugElement . nextElementSibling ( ) . tagName ( ) ; Elements nextGroupSiblings = currentDrugElement . nextElementSiblings ( ) . select ( query ) ; List < String > childrenNames = nextGroupSiblings . eachText ( ) ; childrenNames = childrenNames . stream ( ) . map ( str -> str . toLowerCase ( ) ) . collect ( Collectors . toList ( ) ) ; LOGGER . debug ( "Adding: " + currentDrugGroup . getName ( ) + " to DrugGroups" ) ; addDrugGroup ( currentDrugGroup , childrenNames ) ; drugGroups . addAll ( nextGroupSiblings ) ; } }
Method that checks if the given drug element is a drugGroup of drugSubstance and will add it to the
 dao.
Method that checks if the given drug element is a drugGroup of drugSubstance and will add it to the dao .