Data Cspro
Data Cspro
Data Cspro
Version 7.3.0
International Programs
Population Division
U.S. Census Bureau
4600 Silver Hill Road
Washington, DC 20233
cspro@lists.census.gov
Table of Contents
Table of Contents 1
CSWeb User's Guide 2
Introduction to CSWeb 2
Server Setup 4
Minimum Server Requirements 4
Apache 5
Apache Server Setup 5
Apache CSWeb Setup 5
IIS 7
IIS Server Setup 7
IIS CSWeb Setup 8
Upgrading 10
Upgrading from Previous Versions 10
Production 11
Running CSWeb in Production 11
How to ... 12
Accessing Data 12
Adding Users 12
Troubleshooting 13
Get Help 14
Pa ge 1 of 14 Ta ble of Contents
CSWeb User's Guide
Introduction to CSWeb
CSWeb is a web application that allows users to securely transfer cases (questionnaires) or files between client devices
running CSEntry and a web server. CSWeb requires a web server running PHP and MySQL.
Direct synchronization between interviewers and central server over the Internet
CSWeb eliminates the need to transfer data files by allowing users to instead transfer cases between client devices and a
web server. CSEntry data entry applications that are configured to use CSWeb synchronization take advantage of Smart
Synchronization, a feature that transfers only cases that are added or modified since the last successful synchronization.
Smart Synchronization reduces data transfer costs and Internet bandwidth usage.
CSWeb uses a MySQL database on the server to store the cases for the census or survey data entry instrument. Unlike a file
based synchronization that requires application designers to manage the concatenation of data files, CSWeb allows users to
download a single file containing all the cases for the data entry instrument (once the cases are transferred from the client
devices to the server).
The code to run CSWeb can be downloaded from the CSPro download webpage. More information about how to use CSPro's
synchronization features can be found in the CSPro User's Guide Synchronization Overview.
CSWeb is intended for large surveys and censuses. For small and medium surveys, Dropbox or FTP syncrhonization is sufficient
and far simpler to setup than CSWeb. For Dropbox synchroniation, no server is required at all, making it very easy to get
started. In addition, setting up CSWeb requires knowledge and experience with server administration and website
technologies. If you do not have experience setting up and maintaining web servers, you will find setting up CSWeb to be
very difficult.
Server Setup
Minimum Server Requirements
Apache Server Setup
Apache CSWeb Setup
Pa ge 2 of 14 CSWeb Us er's Guide
IIS Server Setup
IIS CSWeb Setup
Running CSWeb in Production
How to ...
Accessing Data
Troubleshooting
Get Help
Manually verify:
Apache 2.0 or above or IIS 7.0 or above
URL Rewrite Module enabled
The above requirements are sufficient to set up a CSWeb server for testing. To use CSWeb for a production data collection
operation see Running CSWeb in Production.
Pa ge 4 of 14 Server Setup
Apache
Apache Server Setup
The setup of an Apache server is beyond the scope of this document. Fortunately, there already exists an extensive amount
of documentation on the topic. Below we have provided links for getting started.
Apache Server
If you are looking to setup a server to host CSWeb you will need to install and configure Apache, MySQL, and PHP.
Add Database
Add a new database to use for CSWeb using the MySQL command line, MySQL workbench, or phpMyAdmin. Create a user
with access to the new database. For security reasons the database user should have a corresponding password.
Pa ge 6 of 14 Apa che
IIS
IIS Server Setup
Below are the prerequisites for setting up an IIS server.
Edit php.ini
Locate the php.ini file for the new installation of PHP. You may have multiple copies on your computer. The default install
path will be under Program Files (x86) or Program Files depending one whether you installed the 32 or 64 bit version. The
root of the install directory will be PHP. You will find the php.ini file in the subdirectory that was named for the version you
installed. Open php.ini with Notepad and search for [ExtensionList]. Copy and paste extension=php_fileinfo.dll on the
next line. Save and close the file.
> mysqld
Pa ge 7 of 14 IIS
IIS CSWeb Setup
Below are the prerequisites for running CSWeb on an IIS server.
Let us use the files directory as an example. Right-click on files and select Properties. Then click the Security tab. Press the
Add... button and type IUSR under Enter the names to select. Press the Check Names button and confirm your changes.
Select the user name you just added, IUSR, then update the permissions under Permissions for IUSR so that Read and
Write are allowed. Now repeat this process for logs, var, src\api\app, and src\ui\src setting the correct permissions.
Add Database
Do not forget to start the server. If you installed MySQL Server as a service you can start it by doing the following:
1. Win + R
2. Run services.msc
3. Right-click on MySQLXX
4. Start
Alternatively, if you did not install MySQL server as a service or have a web development environment like WampServer
installed, you can start MySQL Server from the command line. You will need to open a command prompt and change
directory to the directory that contains mysqld.exe.
> mysqld
Next, you can use MySQL Monitor to add a database. Connect to MySQL Server. You will need to open a command prompt
and change directory to the directory that contains mysql.exe.
Pa ge 8 of 14 IIS
If you would prefer not to use the command line we recommend MySQL Workbench.
Start IIS
If IIS is installed you will find the Internet Information Services (IIS) Manager shortcut under Administrative Tools in the
Control Panel. Double click the shortcut to launch the IIS Manager. In the Connections tree on the left-hand side expand
Sites and select Default Web Site. You will see your document root below this. On the right-hand side there is an Actions
panel. Under Manage Website click Start.
Pa ge 9 of 14 IIS
Upgrading
Upgrading from Previous Versions
If you already have an older version CSWeb installed on your server and you want to upgrade to a newer version of CSWeb
follow the steps below:
If everything is correct you will receive the "Upgrade Complete!" message. From here log in to CSWeb as usual.
Pa ge 10 of 14 Upgra ding
Production
Running CSWeb in Production
Using CSWeb for a production data collection operation requires additional steps in order to make the server accessible to
devices in the field and to ensure proper data security.
Domain name
In order to connect to the server from devices outside your local network, such as tablets in the field, you will need to
register a domain name for your server. The instructions in this document describe using http://localhost to access your
CSWeb server. This will only work when accessing CSWeb from the server itself. In order to access the server from a tablet or
another computer you will need domain name such as http://census.gov. There are many companies online that can register
domain names. If you already have a website then you may be able to use that domain, or a subdomain, for your CSWeb
server.
Network security
If your server is connected to the internet, it is important to ensure that you have network security systems in place to
prevent unwanted intrusion and access to your data. Such systems will generally include a firewall. Your firewall must be
configured to allow HTTP and/or HTTPS traffic in order for devices to connect to CSWeb over the internet. If you plan to
store confidential survey data on your CSWeb server you should seek assistance from an expert in server security.
SSL certificate
TLS/SSL encrypts the communication between your server and devices in the field. TLS/SSL is also known as https. If you use
CSWeb without https, passwords and data are transferred as plain text and may be intercepted during transmission. For
confidential data it is important to use TLS/SSL to encrypt all data being transferred between devices in field and the server.
This can be done easily by configuring the web server (Apache or IIS) to use https instead of http. This requires an SSL
certificate for your domain. There are various companies and organizations that can provide SSL certificates.
Pa ge 11 of 14 Produc on
How to ...
Accessing Data
Download CSPro DB File
1. Navigate to the Data tab of CSWeb.
2. Under the Download column click the file download icon for the dictionary you want to download.
3. This will download a PFF file. Double click the PFF file to launch the Data Viewer tool.
4. You will be asked to enter your CSWeb username and password.
5. The data will be downloaded as a single CSPro DB file.
Adding Users
Each user is composed of a username, first name, last name, role, email (optional), phone number (optional), and password.
The role can be either a standard user or an administator. The standard user can only synchronize from CSEntry. The
administrator can synchronize from CSEntry and log into the CSWeb website.
Adding a User
1. Navigate to the Users tab of CSWeb.
2. On the right-hand side click the Add User button.
3. Enter the username, first name, last name, role, email (optional), phone number (optional), and password.
Import Users
To import multiple users a CSV file is needed. Each row specifies a single user which has the following format: username, first
name, last name, user role, password, email (optional), phone number (optional). The CSV file can include a header row. If
your CSV file has a header row tick "CSV File has a header row." If an error is detected with any row, no users will be added.
Duplicate users are ignored.
Pa ge 12 of 14 How to ...
user008, Bill, Timothy, Standard User, PasSwOrD8, b8@gmail.com, 123-4567
Troubleshooting
Troubleshooting Problems
CSWeb logs errors to a logs/api.log file located in the CSWeb sources folder in your web server's root directory. This log file
has more detailed information to help you troubleshoot problems.
If you need assistance setting up CSWeb or troubleshooting problems, please email cspro@lists.census.gov. Attach to the
email any server logs to help the CSPro development team diagnose the problem.
Reconfigure CSWeb
To reconfigure or reset your CSWeb installation:
1. Locate the CSWeb sources folder in your web server's root directory.
2. Delete the files src/api/app/config.php and src/ui/src/config.php.
3. To reconfigure CSWeb, open your web browser and launch the CSWeb setup page.
The database username and database password are not correct. They should be set to the username and password for a
MySQL user that has permissions to access the MySQL database.
Failed to connect to database. SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No such host is
known.
The hostname is incorrect. This should be the hostname for the MySQL database, not the server hostname. In most cases
the hostname should be "localhost" unless your database and web server are running on different computers. The hostname
should NOT include "http://". If MySQL is running on a different port than the default, you should add the port to the
hostname. For example "localhost:3307".
This is a general error that could be caused by a number of different problems with the CSWeb configuration. For more
information check the CSWeb log files and also check the Apache/IIS/PHP error log.
You are using a server URL that uses localhost. Localhost can only be used to access the server from a web browser running
on the server itself. To access the server from another computer or device you must use either a domain name or the IP
address of the server. If your server does not have a domain name or a static IP address you will need to obtain one. If you
are unsure how to do this you may want to consider using Dropbox synchronization instead of CSWeb.
Either the server URL is incorrect or your device is not connected to the network.
Pa ge 13 of 14 How to ...
The server URL is not correct. The host portion of the URL is probably correct but the part that follows is not. This often
happens when "ui" is used instead of "api" at the end of the URL. For example, http://example.org/csweb/ui instead of
http://example.org/csweb/api. Always use "api" when syncing with CSWeb from CSPro and use "ui" only when accessing
CSWeb from your web browser.
Get Help
To contact the CSPro development team with comments, questions, or to report problems, please contact:
International Programs
Population Division
U.S. Census Bureau
4600 Silver Hill Road
Washington, DC 20233
Phone: +1 301-763-1451
Support email: cspro@lists.census.gov
Official website: www.census.gov/data/software/cspro.html
CSPro Users forum: www.csprousers.org/forum
When you contact us, please mention that you are using CSPro 7.3.0.
Pa ge 14 of 14 How to ...