예제 #1
0
  /** @param args */
  public static void main(String[] args) {
    // Initialize the Log4j environment.
    String logXML = "log4j.xml";
    if (args.length > 0) {
      logXML = args[0];
    }
    //    logger.initLogger(logXML);
    // initialize connection
    String connXML = "";
    if (args.length > 1) connXML = args[1];
    varCon = new TestConnections(connXML, logger);
    VMForm vmdata = new VMForm();
    try {
      vmdata.setDBConnection(varCon.openConnection());
      CurationServlet cdeserv = new CurationServlet();
      cdeserv.setConn(varCon.openConnection());
      vmdata.setCurationServlet(cdeserv);
    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    TestVM testvm = new TestVM();
    //    logger.start();
    //    logger.info("started vm test");

    //    if (args.length >2)
    //      VMpropFile = args[2];
    VMpropFile = "/Users/ag/demo/cdecurate/src/gov/nih/nci/cadsr/cdecurate/test/TestVMCase.xml";

    // load properties with prop file name from input parameter
    //  if (args.length >2)
    //    testvm.loadProp(args[2]);

    // call the search method
    //  testvm.doSearchVMValues(vmdata);

    // call the validate method
    testvm.doValidateValues(vmdata);
    //  testvm.getConceptDerivation();

    //  testvm.switchCaseEx(2);
    // end the logger
    //    logger.end();
  }
예제 #2
0
  private void readVMdata(NamedNodeMap attr, VMForm vmdata, boolean readMore) {
    VM_Bean vm = vmdata.getVMBean();
    VM_Bean selvm = vmdata.getSelectVM();
    // validate the old vm first before reading the next vm data
    if (vm != null && !vm.getVM_LONG_NAME().equals("")) {
      // do the search;
      VMAction vmact = new VMAction();
      vmact.validateVMData(vmdata); // doChangeVM(vmdata);
    }
    if (readMore) {
      // reset the vm
      vm = new VM_Bean();
      selvm = new VM_Bean();
      // get teh next vm data
      for (int i = 0; i < attr.getLength(); i++) {
        String attName = attr.item(i).getNodeName();
        String attValue = attr.item(i).getNodeValue();

        if (attName != null && !attName.equals("")) {
          if (attName.equals("editvmname"))
            // vm.setVM_SHORT_MEANING(attValue);
            vm.setVM_LONG_NAME(attValue);
          else if (attName.equals("editvmlongname")) vm.setVM_LONG_NAME(attValue);
          else if (attName.equals("editvmdesc")) vm.setVM_PREFERRED_DEFINITION(attValue);
          else if (attName.equals("selvmname"))
            // selvm.setVM_SHORT_MEANING(attValue);
            selvm.setVM_LONG_NAME(attValue);
          else if (attName.equals("selvmlongname")) selvm.setVM_LONG_NAME(attValue);
          else if (attName.equals("selvmdesc")) selvm.setVM_PREFERRED_DEFINITION(attValue);
          else if (attName.equals("selvmidseq")) selvm.setVM_IDSEQ(attValue);
          else if (attName.equals("selvmcondr")) selvm.setVM_CONDR_IDSEQ(attValue);
        }
        // add the beans to data object
        vmdata.setVMBean(vm);
        vmdata.setSelectVM(selvm);
        //  logger.info(i + " Validating VM for " + vm.getVM_SHORT_MEANING() + " : desc : " +
        // vm.getVM_DESCRIPTION() + " conlist " + vm.getVM_CONCEPT_LIST().size());
      }
    }
  }
예제 #3
0
 private void doValidateValues(VMForm vmdata) {
   try {
     // check if test data is avialable
     if (VMpropFile != null && !VMpropFile.equals("")) {
       // open teh cadsr connection
       Connection conn = varCon.openConnection();
       vmdata.setDBConnection(conn);
       // get the root data
       Element node = parseXMLData(VMpropFile);
       StringBuffer sVM = new StringBuffer();
       this.exploreNode(node, sVM, vmdata);
     }
     varCon.closeConnection(); // close the connection
   } catch (Exception e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
예제 #4
0
  private void readConData(NamedNodeMap attr, VMForm data) {
    VM_Bean vm = data.getVMBean();
    EVS_Bean vmCon = new EVS_Bean();
    Vector<EVS_Bean> conList = vm.getVM_CONCEPT_LIST();
    for (int i = 0; i < attr.getLength(); i++) {
      // System.out.println(i + " ConAttr : " + attr.item(i).getNodeName() + " value " +
      // attr.item(i).getNodeValue());

      String attName = attr.item(i).getNodeName();
      String attValue = attr.item(i).getNodeValue();

      if (attName != null && !attName.equals("")) {
        if (attName.equals("conname")) vmCon.setLONG_NAME(attValue);
        else if (attName.equals("conid")) vmCon.setCONCEPT_IDENTIFIER(attValue);
        else if (attName.equals("condefn")) vmCon.setPREFERRED_DEFINITION(attValue);
        else if (attName.equals("condefnsrc")) vmCon.setEVS_DEF_SOURCE(attValue);
        else if (attName.equals("conorigin")) vmCon.setEVS_ORIGIN(attValue);
        else if (attName.equals("consrc")) vmCon.setEVS_CONCEPT_SOURCE(attValue);
        else if (attName.equals("conidseq")) vmCon.setIDSEQ(attValue);
      }
    }
    conList.addElement(vmCon);
    vm.setVM_CONCEPT_LIST(conList);
  }
예제 #5
0
  private void doValidateValuesOld(VMForm vmdata) {
    try {
      // setting up the data
      VM_Bean vm = new VM_Bean();
      // vm.setVM_SHORT_MEANING("Nanomaterials");
      //  vm.setVM_SHORT_MEANING("Metastatic");
      //  vm.setVM_SHORT_MEANING("Dose");
      //  vm.setVM_SHORT_MEANING("Fludeoxyglucose F 18");
      //  vm.setVM_SHORT_MEANING("Adverse Event");
      // vm.setVM_SHORT_MEANING("Adverse Event Domain");
      //  vm.setVM_SHORT_MEANING("Adverse Event Capture");
      //   vm.setVM_SHORT_MEANING("Low");
      vm.setVM_LONG_NAME("Hypersensitivity");

      // vm.setVM_DESCRIPTION("need definiton");
      //  vm.setVM_DESCRIPTION("Any unfavorable and unintended sign (including an abnormal
      // laboratory finding), symptom, syndrome, or disease, temporally associated with the use of a
      // medical product or procedure, regardless of whether or not it is considered related to the
      // product or procedure (attribution of unrelated, unlikely, possible, probable, or definite).
      // The concept refers to events that could be medical product related, dose related, route
      // related, patient related, caused by an interaction with another therapy or procedure, or
      // caused by opioid initiation or dose escalation. The term also is referred to as an adverse
      // experience. The old term Side Effect is retired and should not be used.");
      // vm.setVM_DESCRIPTION("No Value Exists.");
      // vm.setVM_DESCRIPTION("The Adverse Events dataset includes. Adverse events may be captured
      // either as free text or a pre-specified list of terms.");
      // vm.setVM_DESCRIPTION("Adverse events may be captured either as free text or a pre-specified
      // list of terms.");
      //  vm.setVM_DESCRIPTION("A procedure that uses ultrasonic waves directed over the chest wall
      // to obtain a graphic record of the heart's position, motion of the walls, or internal parts
      // such as the valves.");
      // vm.setVM_DESCRIPTION("The amount of medicine taken, or radiation given, at one time.");
      //  vm.setVM_DESCRIPTION("(MET-uh-STAT-ik) Having to do with metastasis, which is the spread
      // of cancer from one part of the body to another.");
      //  vm.setVM_DESCRIPTION("Metastatic");
      //  vm.setVM_DESCRIPTION("Research aimed at discovery of novel nanoscale and nanostructured
      // materials and at a comprehensive understanding of the properties of nanomaterials (ranging
      // across length scales, and including interface interactions). Also, R&D leading to the
      // ability to design and synthesize, in a controlled manner, nanostructured materials with
      // targeted properties.");
      //   vm.setVM_DESCRIPTION("Lower than reference range");
      vm.setVM_PREFERRED_DEFINITION("Hypersensitivity");

      // get concepts for vm
      Vector<EVS_Bean> conList = new Vector<EVS_Bean>();
      EVS_Bean vmCon = new EVS_Bean();
      vmCon.setLONG_NAME("Hypersensitivity"); // ("Low");   //("Metastatic");  //("Nanomaterials");
      vmCon.setCONCEPT_IDENTIFIER("C3114"); // ("C54722");    //("C14174");  //  ("C53671");
      vmCon.setPREFERRED_DEFINITION(
          "Hypersensitivity; a local or general reaction of an organism following contact with a specific allergen to which it has been previously exposed and to which it has become sensitized.");
      // ("A minimum level or position or degree; less than normal in degree or intensity or
      // amount.");
      // ("(MET-uh-STAT-ik) Having to do with metastasis, which is the spread of cancer from one
      // part of the body to another.");
      // ("Research aimed at discovery of novel nanoscale and nanostructured materials and at a
      // comprehensive understanding of the properties of nanomaterials (ranging across length
      // scales, and including interface interactions). Also, R&D leading to the ability to design
      // and synthesize, in a controlled manner, nanostructured materials with targeted
      // properties.");
      vmCon.setEVS_ORIGIN("NCI Thesaurus");
      vmCon.setEVS_DEF_SOURCE("NCI"); // ("NCI-GLOSS");
      vmCon.setIDSEQ(
          "F37D0428-B65C-6787-E034-0003BA3F9857"); // ("");
                                                   // //("F37D0428-DE70-6787-E034-0003BA3F9857");
      conList.addElement(vmCon);
      //  vmdata.setConceptVMList(conceptVMList)
      vm.setVM_CONCEPT_LIST(conList);

      vmdata.setVMBean(vm);

      VM_Bean selvm = new VM_Bean();
      selvm.setVM_LONG_NAME("Hypersensitivity"); // ("Adverse Event Domain");
      selvm.setVM_PREFERRED_DEFINITION("Hypersensitivity"); // ("need definiton");
      vmdata.setSelectVM(selvm);
      logger.info(
          "Validating VM for "
              + vm.getVM_LONG_NAME()
              + " : desc : "
              + vm.getVM_PREFERRED_DEFINITION());
      // open teh cadsr connection
      Connection conn = varCon.openConnection();
      vmdata.setDBConnection(conn);
      // do the search;
      VMAction vmact = new VMAction();
      vmact.validateVMData(vmdata); // doChangeVM(vmdata);
      varCon.closeConnection(); // close the connection

    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
예제 #6
0
  private void doValidateValuesProp(VMForm vmdata) {
    try {
      // check if test data is avialable
      if (VMprop != null) {
        String sProp = VMprop.getProperty("vm0");
        System.out.println("got the key " + sProp);
        // open teh cadsr connection
        Connection conn = varCon.openConnection();
        vmdata.setDBConnection(conn);
        // loop through the data to test one by one
        for (int i = 1; true; ++i) {
          // setting up the data
          VM_Bean vm = new VM_Bean();
          VM_Bean selvm = new VM_Bean();

          // edited value meaning from the page
          String curvmname = VMprop.getProperty("current.vmname." + i);
          if (curvmname == null || curvmname.equals("")) break;

          if (curvmname != null) vm.setVM_LONG_NAME(curvmname);
          String curvmdesc = VMprop.getProperty("current.vmdesc." + i);
          if (curvmdesc != null) vm.setVM_PREFERRED_DEFINITION(curvmdesc);
          String curvmln = VMprop.getProperty("current.vmlongname." + i);
          if (curvmln != null) vm.setVM_LONG_NAME(curvmln);

          // concept associated with the edited value meaning
          String connm = VMprop.getProperty("current.conname." + i);
          if (connm != null) {
            Vector<EVS_Bean> conList = new Vector<EVS_Bean>();
            EVS_Bean vmCon = new EVS_Bean();
            vmCon.setLONG_NAME(connm);
            String conid = VMprop.getProperty("current.conid." + i);
            if (conid != null) vmCon.setCONCEPT_IDENTIFIER(conid);
            String condefn = VMprop.getProperty("current.condefn." + i);
            if (condefn != null) vmCon.setPREFERRED_DEFINITION(condefn);
            String conorgn = VMprop.getProperty("current.conorigin." + i);
            if (conorgn != null) vmCon.setEVS_ORIGIN(conorgn);
            String consrc = VMprop.getProperty("current.consrc." + i);
            if (consrc != null) vmCon.setEVS_DEF_SOURCE(consrc);
            String conidseq = VMprop.getProperty("current.conidseq." + i);
            if (conidseq != null) vmCon.setIDSEQ(conidseq);
            // add the concept bean to conlist vector and to the vm bean
            conList.addElement(vmCon);
            vm.setVM_CONCEPT_LIST(conList);
          }
          // selected value meaning before the change
          String selvmname = VMprop.getProperty("selected.vmname." + i);
          if (selvmname != null) {
            selvm.setVM_LONG_NAME(selvmname);
            String selvmdesc = VMprop.getProperty("selected.vmdesc." + i);
            if (selvmdesc != null) selvm.setVM_PREFERRED_DEFINITION(selvmdesc);
            String selvmln = VMprop.getProperty("selected.vmlongname." + i);
            if (selvmln != null) selvm.setVM_LONG_NAME(selvmln);
            String selvmid = VMprop.getProperty("selected.vmidseq." + i);
            if (selvmid != null) selvm.setVM_IDSEQ(selvmid);
            String selvmcondr = VMprop.getProperty("selected.vmcondr." + i);
            if (selvmcondr != null) selvm.setVM_CONDR_IDSEQ(selvmcondr);

            // add teh selected vm to the vm data
            vmdata.setSelectVM(selvm);
          }

          // add the beans to data object
          vmdata.setVMBean(vm);
          logger.info(
              i
                  + " Validating VM for "
                  + vm.getVM_LONG_NAME()
                  + " : desc : "
                  + vm.getVM_PREFERRED_DEFINITION()
                  + " conlist "
                  + vm.getVM_CONCEPT_LIST().size());

          // do the search;
          VMAction vmact = new VMAction();
          vmact.validateVMData(vmdata); // doChangeVM(vmdata);
        }
      }
      varCon.closeConnection(); // close the connection

    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }