Skip to content
This repository was archived by the owner on Aug 3, 2018. It is now read-only.

Commit 0968370

Browse files
committed
Copied all the files from the wiki into here.
1 parent 4558773 commit 0968370

20 files changed

+2984
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

Creating-a-new-restful-web-service.md

Lines changed: 979 additions & 0 deletions
Large diffs are not rendered by default.

Database-design.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Database design documentation
2+
3+
The database design documentation was created using http://dbmstools.sourceforge.net/. See the [README.md](https://github.com/smallAreaHealthStatisticsUnit/rapidInquiryFacility/tree/master/rifDatabase/ERD#rif-erd) file in the rifDatabase/ERD directory for how to re-create it. This is the current SAHSULAND database. The core schema and the SAHSUland example data are documented.
4+
5+
* [SAHSUland core rif40 schema](https://rawgit.com/smallAreaHealthStatisticsUnit/rapidInquiryFacility/master/rifDatabase/ERD/rif40/index-sahsuland-postgres8.html)
6+
7+
* [SAHSUland example data - the rif_data schema](https://rawgit.com/smallAreaHealthStatisticsUnit/rapidInquiryFacility/master/rifDatabase/ERD/sahsuland/index-sahsuland-postgres8.html)
8+
9+
* [Example test case data; also show structure of the output tables - the rif_studies schema](https://rawgit.com/smallAreaHealthStatisticsUnit/rapidInquiryFacility/master/rifDatabase/ERD/rif_studies/index-sahsuland-postgres8.html)
10+
11+
The following are not documented:
12+
13+
* Partitioning (rif40_partitions schema). This will be a separate series of WIKIs.
14+
* PL/pgsql code in rif40_<code area/type, e.g. R, sql, sm - for statemachine, geo>_pkgs. Again this will be documented separately.
15+
16+
There is also a [Powerpoint] (https://github.com/smallAreaHealthStatisticsUnit/rapidInquiryFacility/blob/master/rifDatabase/RIF%20database.pptx?raw=true) presentation of the new RIF database design.
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
by Kevin Garwood
2+
3+
This page covers some installation notes for setting up parts of the RIF that are not already covered by the database installation notes.
4+
5+
# Building and Installing the Main RIF Web Application
6+
7+
8+
# Step 1: Set the properties for the RIF Service
9+
Now that you have checked out the code repository, you may need to make some changes to the parameter values that
10+
rifServices uses to support a web application. Most of these will relate to the database connection properties
11+
that rifServices will use to interact with the RIF production database that contains all the tables that are used
12+
by the scientists who are creating studies.
13+
14+
15+
16+
# Step 2: Use Maven to Build the RIF Web Application
17+
When Maven is trying to find things, it downloads and moves what it needs to a directory called .m2. You can usually
18+
find it somewhere like: C:\Users\kgarwood\.m2. In this repository, we have some dependencies between projects:
19+
rifServices depends on rifGenericLibrary and rapidInquiryFacility sub-projects. In order for Maven to find these
20+
dependencies, they must first be installed. Create a command-line window. We are going to execute the following
21+
command in multiple directories:
22+
23+
"mvn -Dmaven.test.skip=true install".
24+
25+
The 'skip' part tells Maven to not bother running any JUnit test cases. The install part means that whether the
26+
product of the build is a pom.xml file, a jar file or a war file, it should be installed in the .m2 directory.
27+
28+
1. Go to rapidInquiryFacility/rapidInquiryFacility and type the command.
29+
2. Go to rapidInquiryFacility/rifGenericLibrary and type the command.
30+
3. Go to rapidInquiryFacility/taxonomyServices and type the command.
31+
4. Go to rapidInquiryFacility/rifServices and type the command.
32+
33+
To see what this sequence of commands has done, go to the .m2\repository\rapidInquiryFacility subdirectory. You
34+
should see a number of folders, each of which will correspond to an artefactID shown in one of the project POM
35+
files. This build process is trying to treat the build products of each sub-project as if they were any other
36+
kind of dependency to consider.
37+
38+
Now grab the product that matters most. Go to the target directory for rifServices
39+
(ie: rapidInquiryFacility/rifServices/target). Copy the war file into Tomcat's web application directory
40+
(eg: C:/Program Files/Apache Software Foundation/Tomcat 8.0/webapps). If Tomcat is already running, you should see
41+
that suddenly a folder called "rifServices" appears, which matches the name of the *.war file you just added to
42+
the webapps directory).
43+
44+
45+
# Building and Installing the Data Loader Tool
46+
47+
**Step 1**: Ensure the scratch database for the Data Loader Tool has been created.
48+
Make sure you have installed PostgreSQL correctly and that you are able to make a new blank database. Currently,
49+
that is called 'tmp_sahsu_db'. This is going to be the temporary database that the Data Loader Tool uses for
50+
scratch space as it transforms data files that it imports. We need to do more to set this up but we need a code
51+
file in the repository to do it.
52+
53+
**Step 2**: Ensure you have checked out the repository
54+
Go to the main code repository page and choose how you want to acquire the RIF code base. You can either use the
55+
Github Desktop tool to clone it, or you can download it all as a zip file.
56+
https://github.com/smallAreaHealthStatisticsUnit/rapidInquiryFacility
57+
58+
Now go and run the script that is located at: rapidInquiryFacility/rifDataLoaderTool/PGCreateRIFDataLoaderToolDatabase.sql
59+
You can either try to run the script from a command line, or you can use pgAdminIII, open a query window for the
60+
'tmp_sahsu_db' database and copy-and-paste all the text. Then execute the query.
61+
62+
However you do it, the result is that a few critical tables and a bunch of functions will be created. The Data Loader
63+
Tool assumes that these exist. Take note of the host and port that you would access the database. Typically, it
64+
would be host=localhost and port=5232 for PostgreSQL. In SQL Server, port would typically be 1433. You'll need these
65+
pieces of information for the next step.
66+
67+
**Step 3**: Set database connection parameters for your database.
68+
Edit the properties file located at:
69+
rapidInquiryFacility\rifDataLoaderTool\src\main\resources\RIFDataLoaderToolStartupProperties.properties file.
70+
71+
You may need to alter a few of the properties before the build can produce an executable that will work. These
72+
are:
73+
1. databaseType: by default it's 'pg' for PostgreSQL but in future it will also need 'ms' for SQL Server. This
74+
property tells the Data Loader Tool whether it should use the pg.* property values or the ms.* property values.
75+
2. databaseName: We use tmp_sahsu_db but in future it may be renamed.
76+
2. host: typically localhost but it refer to a network host as well.
77+
3. port: typically 5432 for PostgreSQL and 1433 for SQL Server.
78+
4. databasePasswordFile: The full path of a text file that contains the userID and password of the user that the
79+
Data Loader Tool will act as when it tries to create and process tables in tmp_sahsu_db. An example path might
80+
be C://rif_scripts//db//RIFDatabaseProperties.txt and that file will contain two lines that might look like
81+
this:
82+
83+
userID=postgres
84+
password=wilbur1
85+
86+
The Data Loader Tool will now know enough to determine how to connect with the tmp_sahsu_db that you have set up
87+
already. This property file will automatically be included in the build we do to create an executable jar file,
88+
but to do that, we'll need Maven.
89+
90+
**Step 4**: Ensure you have installed Maven
91+
We've set up the database, and now we want to create an executable image for the application that uses the database.
92+
For that, we'll rely on maven to produce a single executable jar file that you should be able to double click on to
93+
start the Data Loader Tool Application.
94+
95+
Download Maven 3.3.9 and ensure that you have added the path to the mvn executable to your path variable. For example, you might add something like C:\apache-maven-3.3.9\bin. Ensure that you can type 'mvn' from the command line, no matter
96+
what directory you're in.
97+
98+
**Step 5**: Use Maven to build an Executable Jar File
99+
Open a command-line window and navigate to the rifDataLoaderTool directory in the Github repository. It might look like:
100+
C:\Users\kgarwood\Desktop\GitHub\rapidInquiryFacility\rifDataLoaderTool. You should see a pom.xml file there that will
101+
contain all the details Maven needs to produce the jar file.
102+
103+
Type: "mvn compile assembly:single" and press Enter. The script will probably take awhile to run as it gathers all
104+
the dependencies it needs to work. When the script has successfully completed, you should be able to see a new
105+
JAR file called rifDataLoaderTool.jar. It will be located in the target directory Maven uses to generate its build
106+
products. For example, it could be something like "C:\Users\kgarwood\Desktop\GitHub\rapidInquiryFacility\rifDataLoaderTool\target\rifDataLoaderTool-jar-with-dependencies.jar"
107+
108+
Now double click on rifDataLoaderTool-jar-with-dependencies.jar. It should work now, but remember if you take it away to another machine you will need to make sure you have the same file available in the same location that is expected in the
109+
databasePasswordFile property that appears in the RIFDataLoaderToolStartupProperties.properties file we described
110+
in Step 3.
111+
112+
113+
114+
115+
116+
117+
118+
119+
120+
121+
122+
123+
124+
125+
126+

0 commit comments

Comments
 (0)