コード例 #1
0
  @Override
  public boolean isPushedToPSC(String protocolMetaData) {
    boolean isPushedToPSC = false;
    try {
      Document assertXml = xmlProcessor.loadXmlStringToDOM(protocolMetaData);

      XPath xpathInstance = xmlProcessor.getXPathInstance();

      isPushedToPSC =
          (Boolean)
              (xpathInstance.evaluate(
                  "boolean(count(/protocol/pushed-to-psc[text()='y'])>0)",
                  assertXml,
                  XPathConstants.BOOLEAN));

    } catch (Exception e) {
      // don't care
    }

    return isPushedToPSC;
  }
コード例 #2
0
  @Override
  public Map<String, Boolean> checkStudyCharacteristic(String protocolMetaData) {
    Map<String, Boolean> studyCharacteristicMap = Maps.newHashMap();

    String isAchStudyXpath =
        "boolean(count(/protocol/site-responsible[text()='ach-achri'])>0 or count(/protocol/study-sites/site[@site-id=\"2\" or @site-id=\"1\"])>0)";

    String isAchStudyWithDrugXpath =
        "boolean((count(/protocol/site-responsible[text()='ach-achri'])>0 or count(/protocol/study-sites/site[@site-id=\"2\" or @site-id=\"1\"])>0) and count(/protocol/drugs/drug)>0)";

    String isInvestigatorStudyPath =
        "boolean(count(/protocol/study-type[text()='investigator-initiated'])>0)";

    String isIndustryOrCoorpStudyPath =
        "boolean(count(/protocol/study-type[text()='cooperative-group'])>0 or count(/protocol/study-type[text()='industry-sponsored'])>0)";

    String isUamsStudyPath = "boolean(count(/protocol/site-responsible[text()='uams'])>0)";

    try {
      boolean isAchStudy = false;
      boolean isAchStudyWithDrug = false;

      boolean isInvestigatorStudy = false;
      boolean isIndustryOrCoorpStudy = false;

      boolean isUAMSStudy = false;

      Document assertXml = xmlProcessor.loadXmlStringToDOM(protocolMetaData);

      XPath xpathInstance = xmlProcessor.getXPathInstance();

      isAchStudy =
          (Boolean) (xpathInstance.evaluate(isAchStudyXpath, assertXml, XPathConstants.BOOLEAN));

      studyCharacteristicMap.put("isAchStudy", isAchStudy);

      xpathInstance.reset();

      isAchStudyWithDrug =
          (Boolean)
              (xpathInstance.evaluate(isAchStudyWithDrugXpath, assertXml, XPathConstants.BOOLEAN));

      studyCharacteristicMap.put("isAchStudyWithDrug", isAchStudyWithDrug);

      xpathInstance.reset();

      isInvestigatorStudy =
          (Boolean)
              (xpathInstance.evaluate(isInvestigatorStudyPath, assertXml, XPathConstants.BOOLEAN));

      studyCharacteristicMap.put("isInvestigatorStudy", isInvestigatorStudy);

      xpathInstance.reset();

      isIndustryOrCoorpStudy =
          (Boolean)
              (xpathInstance.evaluate(
                  isIndustryOrCoorpStudyPath, assertXml, XPathConstants.BOOLEAN));

      studyCharacteristicMap.put("isIndustryOrCoorpStudy", isIndustryOrCoorpStudy);

      xpathInstance.reset();

      isUAMSStudy =
          (Boolean) (xpathInstance.evaluate(isUamsStudyPath, assertXml, XPathConstants.BOOLEAN));

      studyCharacteristicMap.put("isUAMSStudy", isUAMSStudy);

    } catch (Exception e) {
      // don't care
    }

    return studyCharacteristicMap;
  }