README.md 3.06 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# Opale to Mongo (`opale_to_mongo`)

## License
License GPL3.0
http://www.gnu.org/licenses/gpl-3.0.txt

## Credits
Alexandre Thouvenin
Kapilraj Thangeswaran

## Presentation
This module is able to extract data from a file in Opale format and insert them into MongoDB.

## Dependencies
15
In order to work properly this module needs :
16 17
- [`opale_to_hdoc`](https://gitlab.utc.fr/crozatst/hdoc/tree/master/opale_to_hdoc) (Opale to Hdoc conversion)
- [`hdoc_to_mongo`](https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_mongo) (Hdoc to Mongo conversion)
18
- to download and install Node.js
19
    - For windows :
20
        - from the [Node.js download page](https://nodejs.org/en/)
21
    - For linux (instruction for debian 8, may vary depending on your distrbution) execute the followings commands :
22 23 24 25
        - `su`
        - `apt install nodejs`
        - `apt install node`
        - `apt install npm`
26
		- `npm link mongodb` from hdoc_to_mongo folder
27 28

- to download and install MongoDB 
29
    - For Windows :
30
        - from the [MongoDB download page](https://www.mongodb.com/download-center#community)
31
    - For linux : 
32
        - `su & apt install mongodb`
33

34 35 36 37 38
## Instructions
1. Install dependencies
2. Add all your hdoc documents in an "input" folder
3. Add or edit "config.xml" file in "input" folder (for more details, please check "Input configuration")
4. Edit "config.json" file from "mongo" folder in "hdoc_to_mongo" module (for more details, please check "Mongo configuration")
39
5. Make sure that MongoDB is running (`mongod.exe --rest --jsonp` command from "MongoDB/Server/3.2/bin" folder)
40
6. Execute run.bat or chmod +x run.sh & ./run.sh
41 42

## Input configuration
43
You can add or edit "config.xml" in "input" folder to provide more information about your documents.
44 45 46 47 48 49

Supported information
- link
```
<?xml version="1.0" encoding="UTF-8"?>
<config>
50
	<file name='sample.scar'>
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
		<link>https://stph.scenari-community.org/nf17/co/nf17.html</link>
	</file>
</config>
```

## MongoDB configuration
### In "mongo" folder from "hdoc_to_mongo" module
Use "config.json" in the "mongo" folder to specify
- url : mongodb's url
- database : the database you are using
- collection : the collection you are using
- request : the request you want to perform (for allowed requests, please check "Supported requests")
```
{
	"url" : "mongodb://localhost:27017/",
	"database" : "database",
	"collection" : "collection",
	"request" : "insert"
}
```

## Supported requests
- insert
- update (using the title as filter)
- remove (using the title as filter)

## User stories
- En tant qu’utilisateur rédigeant des documents sous opale, je veux récupérer les exercices corrigés d’un sujet donné dans le but de les réutiliser.
- En tant qu’utilisateur rédigeant des documents sous opale, je veux récupérer les cours d’un auteur précis dans le but d’utiliser ses cours comme références.
- En tant qu’utilisateur universitaire, je souhaite mettre à disposition mes exercices sur internet de manière structuré dans le but de permettre à d’autre utilisateurs universitaires de les trouver, par thème, auteur ou contenu et de les réutiliser.