---
title: "EI Setup"
output: html_notebook
---

These commands copy the configuration files into the right places.

### Pick a configuration directory.  

Under *nix (including MacOS) the default directory is '/usr/local/share/Proc4'.  (Windows users will need to pick something that makes sense, e.g., "C:/Proc4".) Make sure that this directory exists and that you have write permission.

The EIHome directory is the place where EI is installed.

```{r setDirectories}
P4local <- "/usr/local/share/Proc4"
EIHome <- library(help="EIEvent")$path
list.files(file.path(EIHome,"conf"))
```
Next copy the key scripts from the conf directory to the P4local directory.
```{r copy}
file.copy(file.path(EIHome, "conf", "EIini.R"),
           file.path(P4local, "EIini.R"))
file.copy(file.path(EIHome, "conf", "EILoader.R"),
          file.path(P4local, "EILoader.R"))
file.copy(file.path(EIHome, "conf", "EIEvent.R"),
          file.path(P4local, "EIEvent.R"))
## Optional : Unix users only
if (.Platform$OS.type=="unix") {
  file.copy(file.path(EIHome, "conf", "EIEvent"),
            file.path(P4local, "EIEvent"))
}
```

### Setup the collections in the mongo database.

This assumes that the scripts from P4 have already been run to setup the EIRecords database where the EIEvent process will get its stuff:

```{r mongoSetup}
system2("mongo",file.path(EIHome,"conf","setupMongo.js"))

```

## Next step, run the loader script.
  