stata web services: toward stata-based healthcare ... · stata web services: toward healthcare...
TRANSCRIPT
![Page 1: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/1.jpg)
Stata web services: Toward healthcare informatics applications integrated in a service-oriented architecture (SOA)in a service-oriented architecture (SOA)
Alexander ZlotnikTechnical University of Madrid, ETSIT, DIERamon y Cajal University Hospital
Modesto EscobarUniversidad de Salamanca
Ascensión Gallardo-AntolínUC3M, Department of Signals and Systems, Madrid
Stata is a registered trademark of StataCorp LP, College Station, TX, USA.
UC3M, Department of Signals and Systems, Madrid
Juan Manuel Montero MartínezTechnical University of Madrid, ETSIT, DIE
web services: Toward Stata-based healthcare informatics applications integrated
oriented architecture (SOA)oriented architecture (SOA)
Technical University of Madrid, ETSIT, DIE
UC3M, Department of Signals and Systems, MadridUC3M, Department of Signals and Systems, Madrid
nezTechnical University of Madrid, ETSIT, DIE
![Page 2: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/2.jpg)
Why?
![Page 3: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/3.jpg)
User-contributed
ssc install <program>
findit <program>
(runs both search and
net from http://www.website.com/net from http://www.website.com/
manually copy program files to
C:\ado\plus\<subdir>\
contributed programs
and net search)
http://www.website.com/http://www.website.com/
manually copy program files to
\
![Page 4: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/4.jpg)
SometimesSometimesnot enoughSometimes this is Sometimes this is not enough
![Page 5: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/5.jpg)
Sometimes your
… requires complex interactions
external software packagesexternal software packages
(ex: WinBUGS, MATLAB, Maxima,
… uses proprietary data sources
(ex: real-time currency exchange rates)(ex: real-time currency exchange rates)
… uses proprietary source code
your program…
complex interactions with
external software packagesexternal software packages
, MATLAB, Maxima, AnyLogic)
proprietary data sources
time currency exchange rates)time currency exchange rates)
proprietary source code
![Page 6: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/6.jpg)
Sometimes your
… does not have the version of
program requires (ex: it may require v14 and program requires (ex: it may require v14 and
they may only have v12
… does not have Stata
common in some fieldscommon in some fields
… does not have a PC, but may have a
smartphone with a web browser
(ex: developing countries
your users…
version of Stata your
ex: it may require v14 and ex: it may require v14 and
they may only have v12)
Stata at all (Stata is not very
common in some fields)common in some fields)
have a PC, but may have a
with a web browser
developing countries)
![Page 7: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/7.jpg)
What if…?
Your programPrivate
data sources
Stata / Mata
Externalprograms
Stata / Mata
Your server
![Page 8: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/8.jpg)
What if…?
Your program
Stata / Mata
Private data sources
Externalprograms
Stata / Mata
Your server
Web interface
Access from any device
![Page 9: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/9.jpg)
What if…?
Your program
Stata / Mata
Private data sources
Externalprograms
Stata / Mata
Web interface
Access from any device
Security: client isolation
![Page 10: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/10.jpg)
Sometimes your
… requires complex interactions
external software packagesexternal software packages
(ex: WinBUGS, MATLAB, Maxima,
… uses proprietary data sources
(ex: real-time currency exchange rates)(ex: real-time currency exchange rates)
… uses proprietary source code
your program…
complex interactions with
external software packagesexternal software packages
, MATLAB, Maxima, AnyLogic)
proprietary data sources
time currency exchange rates)time currency exchange rates)
proprietary source code
![Page 11: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/11.jpg)
What if…?
Private data sources Your program
Stata / Mata
Externalprograms
Stata / Mata
Web service
XMLXML
![Page 12: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/12.jpg)
What if…?
Web service
XML
Desktop
applications
Web
applications
XML
Mobile
applications
WSDLSOAP
native iOS appsnative Android apps
![Page 13: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/13.jpg)
Service-oriented architecture
Web service
XML
Enterprise
Service Bus
XML
WSDLSOAP
oriented architecture
Other
web services
![Page 14: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/14.jpg)
How?
![Page 15: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/15.jpg)
How?
Option 1:
Translate Stata
Your program
Translate Stata
a general-purpose programming language
in web applications.
Ex: Java, C / C++, C#,
Ruby, etc
Stata / Mata program into Stata / Mata program into
purpose programming language used
in web applications.
Ex: Java, C / C++, C#, ASP.net + VB.net, Python,
![Page 16: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/16.jpg)
How?
Option 1:
Translate Stata
Your program
Translate Stata
a general-purpose programming language
in web applications.
Ex: Java, C / C++, C#,
Ruby, etc
- Few numerical libraries
- May not have the same functions- May not have the same functions
- Functions may
in the same way
-- subtle errors
-- numerical precision issues
-- performance issues
Stata / Mata program into Stata / Mata program into
purpose programming language used
in web applications.
Ex: Java, C / C++, C#, ASP.net + VB.net, Python,
numerical libraries
have the same functionshave the same functions
Functions may not be implemented
same way
subtle errors
numerical precision issues
performance issues
![Page 17: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/17.jpg)
How?
Option 2:
Translate Stata
Your program
Translate Stata
R & RShiny
Application
Stata / Mata program into Stata / Mata program into
or SAS Stored Process Web
![Page 18: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/18.jpg)
How?
Option 2:
Translate Stata
Your program
Translate Stata
R & RShiny
Application
- Still requires a
in most cases
- Again, functions may - Again, functions may
in the same way
- RShiny is a nice alternative but the free
version only supports
Stata / Mata program into Stata / Mata program into
or SAS Stored Process Web
Still requires a laborious translation
in most cases
Again, functions may not be implemented Again, functions may not be implemented
same way
is a nice alternative but the free
version only supports one concurrent session
![Page 19: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/19.jpg)
How?
Option 3:
Use a slightly modified version of your
Your program
Use a slightly modified version of your
existing Stata
Stata is a registered trademark of StataCorp LP, College Station, TX, USA,
and the Stata logo is used with the permission of StataCorp.
Use a slightly modified version of your Use a slightly modified version of your
Stata program in a web application.
![Page 20: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/20.jpg)
How?
Option 3:
Use a slightly modified version of your
Your program
Use a slightly modified version of your
existing Stata
-- In this presentation, we will see how to build a
web application/web service
program, with
Stata/IC, Stata
-- Very similar techniques can be used with
Numerics for
Stata is a registered trademark of StataCorp LP, College Station, TX, USA,
and the Stata logo is used with the permission of StataCorp.
Use a slightly modified version of your Use a slightly modified version of your
Stata program in a web application.
In this presentation, we will see how to build a
web application/web service using your Stata
, with minimal modifications based on
Stata/SE or Stata/MP.
Very similar techniques can be used with
for Stata.
![Page 21: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/21.jpg)
Technologies
Program core: Stata + Mata
Web application language:
Web server: Apache
Operating system: Windows
+ Mata
Web application language: PHP
Windows
![Page 22: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/22.jpg)
Technologies
Program core: Stata + Mata
Web application language:
Web server: Apache
Operating system: Windows
Well-known
Easy to use
+ Mata
Web application language: PHP
Windows
![Page 23: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/23.jpg)
Technologies
Program core: Stata + Mata
Web application language:
Web server: Apache
Operating system: Windows
Well-known
Easy to use
+ Mata
Web application language: PHP
Open source
Windows
![Page 24: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/24.jpg)
Web application language
PHP implementation example
Other languages may also be used:
- Java (servlets, JSPs)
- Python
- ASP / ASP.net + C# / VB.net- ASP / ASP.net + C# / VB.net
- C/C++, Perl (CGI interface)
-et cetera
Web application language
example
languages may also be used:
VB.netVB.net
C/C++, Perl (CGI interface)
![Page 25: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/25.jpg)
Web server
Apache implementation
Other web servers, application containers and
application servers may also be used:
- Tomcat
- JBoss- JBoss
- Oracle WebLogic
- IBM WebSphere
- Magic xpa
-et cetera
implementation example
web servers, application containers and
application servers may also be used:
![Page 26: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/26.jpg)
Operating system
It should be possible to do this on
operating system that supports operating system that supports
(i.e. Windows, Unix/Linux, Mac OS X).
Operating system
It should be possible to do this on any
that supports Statathat supports Stata
(i.e. Windows, Unix/Linux, Mac OS X).
![Page 27: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/27.jpg)
General idea
Web interface
(HTML / JS)
Web application
(PHP / Java /
ASP.net + C# / etc…)
Web server /
Application server
Operating system
Program written in
Stata / Mata
Stata IC / SE / MP
Operating system
![Page 28: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/28.jpg)
Calling Stata
Web interface
(HTML / JS)
Web application
(PHP / Java /
ASP.net + C# / etc…)
Web server /
Application server
Operating system
Stata command(s)
Program written in
Stata / Mata
Stata IC / SE / MP
Operating system
command(s)
![Page 29: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/29.jpg)
Getting a response from
Web interface
(HTML / JS)
Web application
(PHP / Java /
ASP.net + C# / etc…)text files
images
data files
log files
Web server /
Application server
Operating system
Getting a response from Stata
Program written in
Stata / Matatext files
images
data files
log files
Stata IC / SE / MP
Operating system
![Page 30: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/30.jpg)
Simplified exampleSimplified example
![Page 31: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/31.jpg)
Web interface
(HTML / JS)
Calling Stata
Web application
(PHP / Java /
ASP.net + C# / etc…)
Web server /
Application server
Operating system
Stata command(s)
Program written in
Stata / Mata
Stata IC / SE / MP
Operating system
command(s)
![Page 32: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/32.jpg)
Calling Stata
![Page 33: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/33.jpg)
Calling Stata
<html><head> Web interface </head><head> Web interface </head><body> <form action=“call_stata.phpStata command(s):<br><br><textarea name="stata_commands<input type="submit" value="Send command(s)
</form></body></html>
<head> Web interface </head><head> Web interface </head>
call_stata.php" method="post">Stata command(s):<br><br>
stata_commands" ><br><br>
(s) to Stata" >
![Page 34: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/34.jpg)
Calling Stata
Web interface
(HTML / JS)
Web application
(PHP / Java /
ASP.net + C# / etc…)
Web server /
Application server
Operating system
Stata command(s)
Program written in
Stata / Mata
Stata IC / SE / MP
Operating system
command(s)
![Page 35: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/35.jpg)
Calling Stata
call_stata.phpcall_stata.phpcall_stata.phpcall_stata.php
<?php<?php<?php<?php............
$stata_commands = $_POST[“
write_stata_do_file($stata_commands
execute_stata_do_file();
............>>>>
= $_POST[“stata_commands”];
$stata_commands);
![Page 36: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/36.jpg)
Calling Stata
Our web application will execute:
<<<<path_to_Statapath_to_Statapath_to_Statapath_to_Stata>/>/>/>/Stata.exeStata.exeStata.exeStata.exe
(Stata User’s Guide, section [(Stata User’s Guide, section [
Stata.exeStata.exeStata.exeStata.exe /q /e do “/q /e do “/q /e do “/q /e do “commands.docommands.docommands.docommands.do””””
User’s Guide, section [B.5])User’s Guide, section [B.5])
![Page 37: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/37.jpg)
Calling Stata
Our web application will execute:
<<<<path_to_Statapath_to_Statapath_to_Statapath_to_Stata>/>/>/>/Stata.exeStata.exeStata.exeStata.exe
We’ll previously write our commands
Stata.exeStata.exeStata.exeStata.exe /q /e do “/q /e do “/q /e do “/q /e do “commands.docommands.docommands.docommands.do””””
We’ll previously write our commands here
$stata_commands
![Page 38: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/38.jpg)
Calling Stata
Our web application will execute:
<<<<path_to_Statapath_to_Statapath_to_Statapath_to_Stata>/>/>/>/Stata.exeStata.exeStata.exeStata.exe
cdcdcdcd <<<<path_to_temp_folderpath_to_temp_folderpath_to_temp_folderpath_to_temp_folder>>>>
We’ll previously write our commands
Example:cdcdcdcd <<<<path_to_temp_folderpath_to_temp_folderpath_to_temp_folderpath_to_temp_folder>>>>sysusesysusesysusesysuse autoautoautoautohistogram pricehistogram pricehistogram pricehistogram price
Stata.exeStata.exeStata.exeStata.exe /q /e do “/q /e do “/q /e do “/q /e do “commands.docommands.docommands.docommands.do””””
We’ll previously write our commands here
$stata_commands
![Page 39: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/39.jpg)
Calling Stata
Web interface
(HTML / JS)
Web application
(PHP / Java /
ASP.net + C# / etc…)
Web server /
Application server
Operating system
Stata command(s)
Program written in
Stata / Mata
Stata IC / SE / MP
Operating system
command(s)
![Page 40: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/40.jpg)
Calling Stata
Problem: modern versions of
work if called directly from a web server work if called directly from a web server
(SYSTEM user).
stata.exe /e /q …
Web application
PHP: shell_exec()
modern versions of Stata will not
work if called directly from a web server work if called directly from a web server
Stata IC / SE / MP
![Page 41: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/41.jpg)
Calling Stata
Problem: modern versions of
work if called directly from a web server work if called directly from a web server
(SYSTEM user).
Solution: wrapper + user impersonation
Wrapper library
stata.exe /e /q …
Web application
PHP: shell_exec()
modern versions of Stata will not
work if called directly from a web server work if called directly from a web server
wrapper + user impersonation
Stata IC / SE / MP
![Page 42: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/42.jpg)
Getting a response from
Web interface
(HTML / JS)
Web application
(PHP / Java /
ASP.net + C# / etc…)text files
images
data files
log files
Web server /
Application server
Operating system
Getting a response from Stata
Program written in
Stata / Matatext files
images
data files
log files
Stata IC / SE / MP
Operating system
![Page 43: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/43.jpg)
Getting a response from
Our web application will execute:
cdcdcdcd <<<<path_to_path_to_path_to_path_to_webwebwebweb_folder_folder_folder_folder>/>/>/>/imgimgimgimg
<<<<path_to_Statapath_to_Statapath_to_Statapath_to_Stata>/>/>/>/Stata.exeStata.exeStata.exeStata.exe
We’ll previously write our commands
Example:cdcdcdcd <<<<path_to_path_to_path_to_path_to_webwebwebweb_folder_folder_folder_folder>/>/>/>/imgimgimgimgsysusesysusesysusesysuse autoautoautoautohistogram price, normal saving(graph01, replace)histogram price, normal saving(graph01, replace)histogram price, normal saving(graph01, replace)histogram price, normal saving(graph01, replace)graph export graph01.png, replacegraph export graph01.png, replacegraph export graph01.png, replacegraph export graph01.png, replace
Now our web application will be able to display<<<<path_to_path_to_path_to_path_to_webwebwebweb_folder_folder_folder_folder>/img/>/img/>/img/>/img/graph01.pnggraph01.pnggraph01.pnggraph01.png
Getting a response from Stata
imgimgimgimg////
Stata.exeStata.exeStata.exeStata.exe /q /e do “/q /e do “/q /e do “/q /e do “commands.docommands.docommands.docommands.do””””
We’ll previously write our commands here
imgimgimgimg////
histogram price, normal saving(graph01, replace)histogram price, normal saving(graph01, replace)histogram price, normal saving(graph01, replace)histogram price, normal saving(graph01, replace)graph export graph01.png, replacegraph export graph01.png, replacegraph export graph01.png, replacegraph export graph01.png, replace
Now our web application will be able to displaygraph01.pnggraph01.pnggraph01.pnggraph01.png
![Page 44: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/44.jpg)
Getting a response from
call_stata.phpcall_stata.phpcall_stata.phpcall_stata.php
<?php<?php<?php<?php............
$stata_commands = $_POST[“
write_stata_do_file($stata_commands);
execute_stata_do_file();
display_resultsdisplay_resultsdisplay_resultsdisplay_results(); //display graph01.(); //display graph01.(); //display graph01.(); //display graph01.
............?>?>?>?>
Getting a response from Stata
= $_POST[“stata_commands”];
($stata_commands);
(); //display graph01.(); //display graph01.(); //display graph01.(); //display graph01.pngpngpngpng
![Page 45: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/45.jpg)
Getting a response from
call_stata.phpcall_stata.phpcall_stata.phpcall_stata.php
<?<?<?<?phpphpphpphp............
function display_results() {echo “<html>”;echo “ <head>Result</headecho “ <body>”;echo “ <img src=img/graph01.pnggraph01.pnggraph01.pnggraph01.pngecho “ </body>”;echo “</html>”;}............?>
Getting a response from Stata
() {
head>”;
>”;graph01.pnggraph01.pnggraph01.pnggraph01.png>”;
![Page 46: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/46.jpg)
Getting a response from Getting a response from Stata
![Page 47: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/47.jpg)
Basic security
SQL injection attack:
'; DROP TABLE users;
![Page 48: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/48.jpg)
Basic security
Prevent “Stata injection”
--Limited, sanitized inputs,
Ideally, no free text fields on the web interface
--Avoid or restrict shell(), --Avoid or restrict shell(),
in your Stata program
injection” attacks:
Limited, sanitized inputs,
fields on the web interface
shell(), xshell(), winexec()shell(), xshell(), winexec()
![Page 49: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/49.jpg)
Basic security
Bad practice Better practice
![Page 50: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/50.jpg)
Basic security
Prevent “Stata injection”
--Limited, sanitized inputs,
Ideally, no free text fields on the web interface
--Avoid or restrict shell(), --Avoid or restrict shell(),
in your Stata program
injection” attacks:
Limited, sanitized inputs,
fields on the web interface
shell(), xshell(), winexec()shell(), xshell(), winexec()
![Page 51: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/51.jpg)
Basic security
Bad practice Better practice
![Page 52: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/52.jpg)
Basic security
Bad practice
It’s even better to avoid dynamic shell() commands
if Stata is executed
Better practice
if Stata is executed through a web interface
![Page 53: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/53.jpg)
Implementation Implementation examplesImplementation Implementation
![Page 54: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/54.jpg)
Web interface for
Studying coincidences with network analysis
and other multivariate toolsand other multivariate tools
Modesto Escobar. Stata Journal. 2015 (
Web interface for –coin–
Studying coincidences with network analysis
and other multivariate toolsand other multivariate tools
Journal. 2015 (in press)
![Page 55: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/55.jpg)
![Page 56: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/56.jpg)
![Page 57: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/57.jpg)
![Page 58: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/58.jpg)
![Page 59: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/59.jpg)
![Page 60: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/60.jpg)
![Page 61: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/61.jpg)
![Page 62: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/62.jpg)
![Page 63: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/63.jpg)
Web interface for
A general-purpose nomogram
predictive logistic regression modelspredictive logistic regression models
Zlotnik A, Abraira V. Stata Journal. 2015. Volume 15, Number 2
URL: http://www.zlotnik.net/stata/nomograms
Web interface for –nomolog–
nomogram generator for
predictive logistic regression modelspredictive logistic regression models
Journal. 2015. Volume 15, Number 2
http://www.zlotnik.net/stata/nomograms
![Page 64: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/64.jpg)
![Page 65: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/65.jpg)
![Page 66: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/66.jpg)
In the web implementation, we must add a tab for loading the
dataset and executing the logistic regression command.
In the web implementation, we must add a tab for loading the
dataset and executing the logistic regression command.
![Page 67: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/67.jpg)
![Page 68: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/68.jpg)
Questions?Questions?
![Page 69: Stata web services: Toward Stata-based healthcare ... · Stata web services: Toward healthcare informatics applications integrated in a service -oriented architecture (SOA) Alexander](https://reader033.vdocuments.site/reader033/viewer/2022052306/5f0e440f7e708231d43e6866/html5/thumbnails/69.jpg)
Credits
Special thanks to all the people who made and released
these design resources for free:these design resources for free:
◎Presentation template by
◎Photographs by Unsplash
(license)
Special thanks to all the people who made and released
for free:for free:
Presentation template by SlidesCarnival
& Death to the Stock Photo