Re: cTAKES as REST service [EXTERNAL]
Hi Gandhi, Sean, Tim, Alex, James, I'm still getting back into the swing of things after my trip (I'm on business traveling at the moment, here in the states). I will be jumping right back into cTAKES REST development next week personally and with a new team mate from the open source team. I'm so sorry for my silence/lack of updates!!! Very excited to see what Gandhi's updates are looking like and enriching the JSON response payload. Thanks, Matthew Vita www.matthewvita.com On Tue, Dec 5, 2017 at 10:24 AM, Gandhi Rajan Natarajan < gandhi.natara...@arisglobal.com> wrote: > Could someone help me out on the resources cleanup atleast if not review? > > Regards, > Gandhi > > > -Original Message- > From: Gandhi Rajan Natarajan [mailto:gandhi.natara...@arisglobal.com] > Sent: Monday, December 04, 2017 10:05 PM > To: dev@ctakes.apache.org > Subject: RE: cTAKES as REST service [EXTERNAL] > > Hi Sean, Tim, Alex, Matthew, James and All, > > I have placed the first cut version of cTAKES REST module in the following > path - https://github.com/GoTeamEpsilon/ctakes-rest-service/tree/ > master/ctakes-web-rest/ > > Things pending in the module: > 1) Index Page to test the rest module using AJAX call > 2) Revamping the final output XML > > Request you all to have a look at this module and provide your feedback. I > would also require expert advice to clean up the resources folder - > https://github.com/GoTeamEpsilon/ctakes-rest-service/tree/ > master/ctakes-web-rest/src/main/resources/org > > This module can be deployed as a web-app in Tomcat using the generated WAR > file . It can be tested using any REST client (like Chrome's Postman app) > by accessing the following URL - > http://:/ctakes-web-rest/service/analyze > and providing the analysis text as request body. > > Sample input : "Patient has cancer and nausea. Earlier he has been > deducted for red eye." > Sample output: > { > "DrugChangeStatusAnnotation": [], > "StrengthAnnotation": [], > "FractionStrengthAnnotation": [], > "FrequencyUnitAnnotation": [], > "CompanyAnnotation": [], > "DiseaseDisorderMention": [ > "CANCER" > ], > "SignSymptomMention": [ > "RED EYE", > "NAUSEA" > ], > "RouteAnnotation": [], > "DateAnnotation": [], > "MeasurementAnnotation": [], > "ProcedureMention": [], > "TimeMention": [], > "StrengthUnitAnnotation": [] > } > > Regards, > Gandhi > > -Original Message- > From: Gandhi Rajan Natarajan [mailto:gandhi.natara...@arisglobal.com] > Sent: Sunday, November 19, 2017 1:45 PM > To: dev@ctakes.apache.org > Subject: RE: cTAKES as REST service [EXTERNAL] > > Hi All, > > Have completed cTAKES Spring upgrade changes and checked in the same to > SVN. Please revert in case of any issues. > > @Alex, Thanks a lot for taking time out and providing your review comments > on Spring upgrade. Really appreciate it. > > Now it will ease our effort in creating ctakes rest module. > > Regards, > Gandhi > > > -Original Message- > From: Gandhi Rajan Natarajan [mailto:gandhi.natara...@arisglobal.com] > Sent: Sunday, November 19, 2017 4:20 AM > To: dev@ctakes.apache.org > Subject: RE: cTAKES as REST service [EXTERNAL] > > Hi, > > I have attached the patch file for cTAKES Spring upgrade in > https://issues.apache.org/jira/browse/CTAKES-472 Unfortunately I'm not > able to assign this issue to me as I don’t have access. Could someone help > me out with the access? > > For time being I have commented out the DataAnnotatorTest failure in the > patch. > > Could someone test the patch and let us know so that I can commit the > changes in SVN? > > This change will lay the foundation for REST module implementation in > cTAKES. > > Regards, > Gandhi > > > -Original Message- > From: Matthew Vita [mailto:matthewvit...@gmail.com] > Sent: Wednesday, November 01, 2017 8:24 AM > To: dev@ctakes.apache.org > Subject: Re: cTAKES as REST service [EXTERNAL] > > Alex, > > Gandhi covered everything we are working on. Please do mail me if you'd > like to join in and I can give you some open tasks. > > Thanks, > > Matthew Vita > www.matthewvita.com > > On Mon, Oct 30, 2017 at 8:46 PM, Gandhi Rajan Natarajan < > gandhi.natara...@arisglobal.com> wrote: > > > Hi Alex and Sean, > > > > Thanks for the acknowledgement. > > > > As mentioned earlier in the thread, I have sent the github link - > > https://github.com/gandhirajan/cTAKES/tree/master/SpringUpgrade/ctakes > > - SVN-src that contains changes to be made to upgrade cTAKES to > > Spring4x. > > I have done it on my local sandbox and it works. But as I mentioned > > earlier, I was not able to test ytex module changes as I'm not aware > > of those modules. Matthew is already testing the spring upgrade > > changes and hopefully we will able be close it. If you could test the > > ytex modules, it will be of great help I guess. > > > > Regarding docker works on cTAKES, hats off to Matthew. We can assist > > him if he
RE: cTAKES as REST service [EXTERNAL]
Could someone help me out on the resources cleanup atleast if not review? Regards, Gandhi -Original Message- From: Gandhi Rajan Natarajan [mailto:gandhi.natara...@arisglobal.com] Sent: Monday, December 04, 2017 10:05 PM To: dev@ctakes.apache.org Subject: RE: cTAKES as REST service [EXTERNAL] Hi Sean, Tim, Alex, Matthew, James and All, I have placed the first cut version of cTAKES REST module in the following path - https://github.com/GoTeamEpsilon/ctakes-rest-service/tree/master/ctakes-web-rest/ Things pending in the module: 1) Index Page to test the rest module using AJAX call 2) Revamping the final output XML Request you all to have a look at this module and provide your feedback. I would also require expert advice to clean up the resources folder - https://github.com/GoTeamEpsilon/ctakes-rest-service/tree/master/ctakes-web-rest/src/main/resources/org This module can be deployed as a web-app in Tomcat using the generated WAR file . It can be tested using any REST client (like Chrome's Postman app) by accessing the following URL - http://:/ctakes-web-rest/service/analyze and providing the analysis text as request body. Sample input : "Patient has cancer and nausea. Earlier he has been deducted for red eye." Sample output: { "DrugChangeStatusAnnotation": [], "StrengthAnnotation": [], "FractionStrengthAnnotation": [], "FrequencyUnitAnnotation": [], "CompanyAnnotation": [], "DiseaseDisorderMention": [ "CANCER" ], "SignSymptomMention": [ "RED EYE", "NAUSEA" ], "RouteAnnotation": [], "DateAnnotation": [], "MeasurementAnnotation": [], "ProcedureMention": [], "TimeMention": [], "StrengthUnitAnnotation": [] } Regards, Gandhi -Original Message- From: Gandhi Rajan Natarajan [mailto:gandhi.natara...@arisglobal.com] Sent: Sunday, November 19, 2017 1:45 PM To: dev@ctakes.apache.org Subject: RE: cTAKES as REST service [EXTERNAL] Hi All, Have completed cTAKES Spring upgrade changes and checked in the same to SVN. Please revert in case of any issues. @Alex, Thanks a lot for taking time out and providing your review comments on Spring upgrade. Really appreciate it. Now it will ease our effort in creating ctakes rest module. Regards, Gandhi -Original Message- From: Gandhi Rajan Natarajan [mailto:gandhi.natara...@arisglobal.com] Sent: Sunday, November 19, 2017 4:20 AM To: dev@ctakes.apache.org Subject: RE: cTAKES as REST service [EXTERNAL] Hi, I have attached the patch file for cTAKES Spring upgrade in https://issues.apache.org/jira/browse/CTAKES-472 Unfortunately I'm not able to assign this issue to me as I don’t have access. Could someone help me out with the access? For time being I have commented out the DataAnnotatorTest failure in the patch. Could someone test the patch and let us know so that I can commit the changes in SVN? This change will lay the foundation for REST module implementation in cTAKES. Regards, Gandhi -Original Message- From: Matthew Vita [mailto:matthewvit...@gmail.com] Sent: Wednesday, November 01, 2017 8:24 AM To: dev@ctakes.apache.org Subject: Re: cTAKES as REST service [EXTERNAL] Alex, Gandhi covered everything we are working on. Please do mail me if you'd like to join in and I can give you some open tasks. Thanks, Matthew Vita www.matthewvita.com On Mon, Oct 30, 2017 at 8:46 PM, Gandhi Rajan Natarajan < gandhi.natara...@arisglobal.com> wrote: > Hi Alex and Sean, > > Thanks for the acknowledgement. > > As mentioned earlier in the thread, I have sent the github link - > https://github.com/gandhirajan/cTAKES/tree/master/SpringUpgrade/ctakes > - SVN-src that contains changes to be made to upgrade cTAKES to > Spring4x. > I have done it on my local sandbox and it works. But as I mentioned > earlier, I was not able to test ytex module changes as I'm not aware > of those modules. Matthew is already testing the spring upgrade > changes and hopefully we will able be close it. If you could test the > ytex modules, it will be of great help I guess. > > Regarding docker works on cTAKES, hats off to Matthew. We can assist > him if he needs any help out there. > > Regarding REST API, we are planning to use Spring REST service as > introducing Jersey container may be an overhead I feel. Also regarding > your idea on new module, I too agree with you. But in the new module, > we can improvise Chei Pen's work in this link - > https://github.com/healthnlp/ > examples/tree/master/ctakes-temporal-demo and name it as 'ctakes-web' > or 'ctakes-web-rest' so that the module can be used to build cTAKES as > both traditional web app as well as expose it as an REST service. It's just a > thought from my side which we can discuss upon. > > Once the web-rest module is ready, I feel it will take cTAKES to a > whole new level as you can even plug it with mobile applications that > can send the clinical text for analysis and get JSON response that can > be
Re: svn commit: r1817150 - /ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/util/JdbcOperationsHelper.java [EXTERNAL]
Hi Alex, you might want to replace LOGGER.warn("couldn't drop table test_concepts. Maybe it doesn't even exists", e); with something that includes the table name variable, such as: LOGGER.warn(String.format("Couldn't drop table %s. Maybe it doesn't even exist.", sqlTableName), e); On Tue, Dec 5, 2017 at 8:32 AM, Finan, Sean < sean.fi...@childrens.harvard.edu> wrote: > Hi Alex, > > I like the approach. > > Sean > > -Original Message- > From: al...@apache.org [mailto:al...@apache.org] > Sent: Monday, December 04, 2017 10:58 PM > To: comm...@ctakes.apache.org > Subject: svn commit: r1817150 - /ctakes/trunk/ctakes-ytex/src/ > main/java/org/apache/ctakes/util/JdbcOperationsHelper.java [EXTERNAL] > > Author: alexz > Date: Tue Dec 5 03:58:07 2017 > New Revision: 1817150 > > URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__svn. > apache.org_viewvc-3Frev-3D1817150-26view-3Drev= > DwICaQ=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU= > fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao= > 4Lb1jjC4XsbSAZ2rf0gsNtrV8JdfUnPe_xnfHUycT-U= > PmAB90gzu1GG6yrwY6BMbc01q0hLKYE88gq79vRlpj4= > Log: > CTAKES-415 > > Added: > ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ > util/JdbcOperationsHelper.java > > Added: ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ > util/JdbcOperationsHelper.java > URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__svn. > apache.org_viewvc_ctakes_trunk_ctakes-2Dytex_src_main_ > java_org_apache_ctakes_util_JdbcOperationsHelper.java- > 3Frev-3D1817150-26view-3Dauto=DwICaQ=qS4goWBT7poplM69zy_ > 3xhKwEW14JZMSdioCoppxeFU=fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao= > 4Lb1jjC4XsbSAZ2rf0gsNtrV8JdfUnPe_xnfHUycT-U=DjWdjDem-SHqJcprSWE0yRIzg_ > BHiR8JXqw55nGrIz0= > > == > --- > ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/util/JdbcOperationsHelper.java > (added) > +++ ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/util/JdbcOp > +++ erationsHelper.java Tue Dec 5 03:58:07 2017 > @@ -0,0 +1,49 @@ > +package org.apache.ctakes.util; > + > +import org.apache.log4j.Logger; > +import org.springframework.dao.DataAccessException; > +import org.springframework.jdbc.core.JdbcOperations; > + > +/** > + * Refactors helper functions like dropTableIfExists or other DB > +operations > + * > + * // TODO: consider renaming it with something more suitable */ > +public abstract class JdbcOperationsHelper { > + > + static private final Logger LOGGER = > +Logger.getLogger(JdbcOperationsHelper.class); > + > + /** > +* Helper function to drop a 'table' from a DB, using SQL syntax > +* > +* @param jdbc > +* @param dbEngineType > +* @param sqlTableName > +*/ > + protected final void dropTableIfExist(JdbcOperations jdbc, final > String dbEngineType, final String sqlTableName) { > + // TODO: consider refactor using JOOQ > + String sqlStatement = ""; > + switch (dbEngineType.toLowerCase()) { > + case "hsql": > + case "mysql": > + sqlStatement = String.format("DROP TABLE > IF EXISTS %s", sqlTableName); > + break; > + case "mssql": > + sqlStatement = String.format("IF > EXISTS(SELECT * FROM sys.objects WHERE object_id = object_id('%s')) DROP > TABLE %s", sqlTableName); > + break; > + case "orcl": > + sqlStatement = String.format("DROP TABLE > %s", sqlTableName); > + break; > + default: > + LOGGER.warn(String.format("unsupported DB > engine type: %s", dbEngineType)); > + break; > + } > + if (!sqlStatement.isEmpty()) { > + try { > + jdbc.execute(sqlStatement); > + } catch (DataAccessException e) { > + LOGGER.warn("couldn't drop table > test_concepts. Maybe it doesn't even exists", e); > + } > + } > + } > +} > > >
RE: svn commit: r1817150 - /ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/util/JdbcOperationsHelper.java [EXTERNAL]
Thank you Sean. I still try to fix the latest integration test DateAnnotatorTest. It is interesting that I cannot reproduce the issue. Let me know if any advice. Alex On Dec 5, 2017 08:32, "Finan, Sean"wrote: Hi Alex, I like the approach. Sean -Original Message- From: al...@apache.org [mailto:al...@apache.org] Sent: Monday, December 04, 2017 10:58 PM To: comm...@ctakes.apache.org Subject: svn commit: r1817150 - /ctakes/trunk/ctakes-ytex/src/ main/java/org/apache/ctakes/util/JdbcOperationsHelper.java [EXTERNAL] Author: alexz Date: Tue Dec 5 03:58:07 2017 New Revision: 1817150 URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__svn. apache.org_viewvc-3Frev-3D1817150-26view-3Drev= DwICaQ=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU= fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao=4Lb1jjC4XsbSAZ2rf0gsNtrV8JdfUn Pe_xnfHUycT-U=PmAB90gzu1GG6yrwY6BMbc01q0hLKYE88gq79vRlpj4= Log: CTAKES-415 Added: ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ util/JdbcOperationsHelper.java Added: ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ util/JdbcOperationsHelper.java URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__svn. apache.org_viewvc_ctakes_trunk_ctakes-2Dytex_src_main_ java_org_apache_ctakes_util_JdbcOperationsHelper.java- 3Frev-3D1817150-26view-3Dauto=DwICaQ=qS4goWBT7poplM69zy_ 3xhKwEW14JZMSdioCoppxeFU=fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao= 4Lb1jjC4XsbSAZ2rf0gsNtrV8JdfUnPe_xnfHUycT-U=DjWdjDem-SHqJcprSWE0yRIzg_ BHiR8JXqw55nGrIz0= == --- ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/util/JdbcOperationsHelper.java (added) +++ ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/util/JdbcOp +++ erationsHelper.java Tue Dec 5 03:58:07 2017 @@ -0,0 +1,49 @@ +package org.apache.ctakes.util; + +import org.apache.log4j.Logger; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.JdbcOperations; + +/** + * Refactors helper functions like dropTableIfExists or other DB +operations + * + * // TODO: consider renaming it with something more suitable */ +public abstract class JdbcOperationsHelper { + + static private final Logger LOGGER = +Logger.getLogger(JdbcOperationsHelper.class); + + /** +* Helper function to drop a 'table' from a DB, using SQL syntax +* +* @param jdbc +* @param dbEngineType +* @param sqlTableName +*/ + protected final void dropTableIfExist(JdbcOperations jdbc, final String dbEngineType, final String sqlTableName) { + // TODO: consider refactor using JOOQ + String sqlStatement = ""; + switch (dbEngineType.toLowerCase()) { + case "hsql": + case "mysql": + sqlStatement = String.format("DROP TABLE IF EXISTS %s", sqlTableName); + break; + case "mssql": + sqlStatement = String.format("IF EXISTS(SELECT * FROM sys.objects WHERE object_id = object_id('%s')) DROP TABLE %s", sqlTableName); + break; + case "orcl": + sqlStatement = String.format("DROP TABLE %s", sqlTableName); + break; + default: + LOGGER.warn(String.format("unsupported DB engine type: %s", dbEngineType)); + break; + } + if (!sqlStatement.isEmpty()) { + try { + jdbc.execute(sqlStatement); + } catch (DataAccessException e) { + LOGGER.warn("couldn't drop table test_concepts. Maybe it doesn't even exists", e); + } + } + } +}
RE: svn commit: r1817150 - /ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/util/JdbcOperationsHelper.java [EXTERNAL]
Hi Alex, I like the approach. Sean -Original Message- From: al...@apache.org [mailto:al...@apache.org] Sent: Monday, December 04, 2017 10:58 PM To: comm...@ctakes.apache.org Subject: svn commit: r1817150 - /ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/util/JdbcOperationsHelper.java [EXTERNAL] Author: alexz Date: Tue Dec 5 03:58:07 2017 New Revision: 1817150 URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__svn.apache.org_viewvc-3Frev-3D1817150-26view-3Drev=DwICaQ=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU=fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao=4Lb1jjC4XsbSAZ2rf0gsNtrV8JdfUnPe_xnfHUycT-U=PmAB90gzu1GG6yrwY6BMbc01q0hLKYE88gq79vRlpj4= Log: CTAKES-415 Added: ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/util/JdbcOperationsHelper.java Added: ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/util/JdbcOperationsHelper.java URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__svn.apache.org_viewvc_ctakes_trunk_ctakes-2Dytex_src_main_java_org_apache_ctakes_util_JdbcOperationsHelper.java-3Frev-3D1817150-26view-3Dauto=DwICaQ=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU=fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao=4Lb1jjC4XsbSAZ2rf0gsNtrV8JdfUnPe_xnfHUycT-U=DjWdjDem-SHqJcprSWE0yRIzg_BHiR8JXqw55nGrIz0= == --- ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/util/JdbcOperationsHelper.java (added) +++ ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/util/JdbcOp +++ erationsHelper.java Tue Dec 5 03:58:07 2017 @@ -0,0 +1,49 @@ +package org.apache.ctakes.util; + +import org.apache.log4j.Logger; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.JdbcOperations; + +/** + * Refactors helper functions like dropTableIfExists or other DB +operations + * + * // TODO: consider renaming it with something more suitable */ +public abstract class JdbcOperationsHelper { + + static private final Logger LOGGER = +Logger.getLogger(JdbcOperationsHelper.class); + + /** +* Helper function to drop a 'table' from a DB, using SQL syntax +* +* @param jdbc +* @param dbEngineType +* @param sqlTableName +*/ + protected final void dropTableIfExist(JdbcOperations jdbc, final String dbEngineType, final String sqlTableName) { + // TODO: consider refactor using JOOQ + String sqlStatement = ""; + switch (dbEngineType.toLowerCase()) { + case "hsql": + case "mysql": + sqlStatement = String.format("DROP TABLE IF EXISTS %s", sqlTableName); + break; + case "mssql": + sqlStatement = String.format("IF EXISTS(SELECT * FROM sys.objects WHERE object_id = object_id('%s')) DROP TABLE %s", sqlTableName); + break; + case "orcl": + sqlStatement = String.format("DROP TABLE %s", sqlTableName); + break; + default: + LOGGER.warn(String.format("unsupported DB engine type: %s", dbEngineType)); + break; + } + if (!sqlStatement.isEmpty()) { + try { + jdbc.execute(sqlStatement); + } catch (DataAccessException e) { + LOGGER.warn("couldn't drop table test_concepts. Maybe it doesn't even exists", e); + } + } + } +}