Thursday, March 31, 2016

taskscheduleR: Scheduling R script via R and Rstudio

Scheduling R script via R / Rstudio

Scheduling R script via R.?

taskscheduleR - It allow users to automate R script on specific timepoints from R / Rstudio itself. No need of windows Task scheduling or Linux Cron to automate R script.

Installation of taskscheduleR

devtools::install_github("jwijffels/taskscheduleR")

If you want the RStudio add-in to work, also install miniUI and shiny

install.packages('miniUI') install.packages('shiny')
Open Rscheduler window

Click the Addins menu added in Rstudio

You can also open Rscheuler window in Browser by

hit below command in R terminal,
taskscheduleR:::taskschedulerAddin()

you will notify with "Listening on http://127.0.0.1:5499 " and the same can be viewed in browser


Friday, March 25, 2016

Analyze Data to Identify type of Readmissions using PostgreSQL

Analyze Data to Identify Causes of Readmissions using PostgreSQL

What is patient readmission

Normally Readmission is - if a patient returns within 30 days of previous discharge.

reason for readmission

Multiple factors contribute to avoidable hospital readmission: they may result from poor quality care or from poor transitions between different providers and care settings.

The problem of readmission to the hospital is receiving increased attention as a potential way to address problems in quality of care, cost of care, and care transition

readmission table structure

After cleansed and identified the required attribute to get the readmission details, my entity model look like this

patient_id disease adm_date dis_date
1069 Oncology 6/17/2013 6:51 6/21/2013 7:15
1078 Neuro 7/18/2013 12:10 7/20/2013 08:12
1082 Ortho 7/19/2013 12:10 7/22/2013 08:12
1085 Cardiothor 8/25/2013 12:10 8/27/2013 08:12
1085 Cardiothor 9/13/2013 12:10 9/16/2013 08:12

Now, we have to write a query to get the list of readmission details. Condition is, current admit date is between the last discharge date and 30 days from then.

readmission query in postgresql

Select count(*) "Readmission Count", disease
From readmission_view v
Where Exists
(
Select * From readmission_view
Where patient_id = v.patient_id and
v.adm_date between dis_date and dis_date + 30
)
group by disease
order by count(*)

readmission result

disease Readmission Count
Ortho 878
Neuro 567
Oncology 155
Using the result optioned from the query to find the percentage of patient readmission. based on the result need extra care on the disease.

Friday, March 18, 2016

ERROR invalid input syntax for type date SQL state: 22007

ERROR invalid input syntax for type date SQL state: 22007

SQL state: 22007

Type casting varchar to date in where clause

select * from patient_history where
where admissiondate::DATE > releasedate::DATE


Error

ERROR:invalid input syntax for type date:"" ********** Error **********

ERROR:invalid input syntax for type date:""
SQL state: 22007
Solution

In my case, type casting for admissiondate working fine but not for releasedate. Then i spent few time for the field releasedate then found few empty / null values in releasedate column.

select * from patient_history where
releasedate is null OR releasedate =''

I removed empty entry from the releasedate , then the same query for type casting working fine.

select * from patient_history where
v.admissiondate::DATE > releasedate::DATE

Friday, March 4, 2016

Installing TeamPostgreSQL on 64 bit Ubuntu 14.x OS

Installing TeamPostgreSQL on 64 bit Ubuntu 14.x OS

TeamPostgreSQL - PostgreSQL Web Admin GUI Tools

Installing TeamPostgreSQL on 64 bit Ubuntu 14.x OS
boss@solai:~$ ./teampostgresql_ubuntu.sh


Error

Unpacking JRE ...
Preparing JRE ...
./teampostgresql_ubuntu.sh: 256: ./teampostgresql_ubuntu.sh: bin/unpack200: not found Error unpacking jar files. Aborting. You might need administrative priviledges for this operation.
Solution

boss@solai:~$ sudo dpkg --add-architecture i386

boss@solai:~$ sudo apt-get update

boss@solai:~$ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386


now 32 bit lib installed in your system. try install..

Error

boss@solai:~$ ./teampostgresql_ubuntu.sh

Unpacking JRE ...
Preparing JRE ...
Starting Installer ...
Could not display the GUI. This application needs access to an X Server.
If you have access there is probably an X library missing.
******************************************************************* You can also run this application in console mode without access to an X server by passing the argument -c *******************************************************************
An error occurred:
java.lang.UnsatisfiedLinkError:
/opt/sw/teampostgresql_ubuntu.sh.16586.dir/jre/lib/i386/xawt/libmawt.so: libXext.so.6: cannot open shared object file: No such file or directory
Error log: /tmp/install4jError8210847315454692406.log
Solution

Install again by adding -c option

boss@solai:~$ ./teampostgresql_ubuntu.sh -c

Wednesday, March 2, 2016

Rserve - TCP/IP server which allows other programs to use facilities of R

Rserve - TCP/IP server which allows other programs to use facilities of R

Rserve - is a TCP/IP server which allows other programs to use facilities of R from various languages without the need to initialize R or link against R library. Every connection has a separate workspace and working directory. Client-side implementations are available for popular languages such as C/C++, PHP and Java. Rserve supports remote connection, authentication and file transfer.

Installing and initiate Rserve
> install.packages('Rserve')

> library(Rserve)

> Rserve()

Error

> Rserve()

Rserv started in daemon mode.
##> SOCK_ERROR: bind error #98(address already in use)
Solution

boss@passive:~$ ps faux | grep Rserve

will list the Rserv started daemon.


Tuesday, March 1, 2016

Big Data / Data Analytics Jobs

Big Data Hadoop Jobs in India and around the world
Big Data Analyst   5+ years   
May, 2016    Chennai, India
Big Data - Principal Software Engineer   5+ years   
May 05, 16    Humana, Irving, Texas / USA
Hadoop and Spark Developer   5-7 years   
May 05, 16    CSC india, Dubai/ UAE
Data Specialist: Advanced Analytics   4-10 years   
May 01, 16    IBM, Bangalore, India
Hadoop Developer (DWH)   5-9 years    April 12, 2016
Csi Software Pvt Ltd , Chennai, TamilNadu, India
Sr.Data Scientist      April 10, 16
Allstate., Northbrook, IL US.
Sr.HADOOP DEVELOPER   4-8 years    April 03, 16
Swathi Business Solutions, Chennai, India,(KL, Malaysia)
Java Hadoop Lead (Big Data)   7-10 years    April 03, 16
Innominds, Hyderabad, India
Big Data developer / Intern for Big Data     April 03, 2016
Frgma Data, Bengaluru, India
Analyst 1 - Apps Prog      April 01, 2016
Chennai, Tamil Nadu, India
Hadoop Data Engineer      Mar 31, 2016
Chennai, Tamil Nadu, India
Bigdata Developer      March 31, 2016
Chennai, India
In Association with Amazon.in