Commit cb86d25d authored by delanoe's avatar delanoe

Merge remote-tracking branch 'origin/c24b-unstable' into unstable-merge

parents cbd9e24b 579b9927
...@@ -28,6 +28,5 @@ see [install procedure](install.md) ...@@ -28,6 +28,5 @@ see [install procedure](install.md)
2. Create a new branch <username>-refactoring 2. Create a new branch <username>-refactoring
3. Run the gargantext-box 3. Run the gargantext-box
4. Code 4. Code
5.Test 5. Test
6. Commit 6. Commit
...@@ -26,7 +26,7 @@ git clone ssh://gitolite@delanoe.org:1979/gargantext /srv/gargantext \ ...@@ -26,7 +26,7 @@ git clone ssh://gitolite@delanoe.org:1979/gargantext /srv/gargantext \
## Install ## Install
``` bash ```bash
# go into the directory # go into the directory
user@computer: cd /srv/gargantext/ user@computer: cd /srv/gargantext/
#git inside installation folder #git inside installation folder
...@@ -34,20 +34,31 @@ git clone ssh://gitolite@delanoe.org:1979/gargantext /srv/gargantext \ ...@@ -34,20 +34,31 @@ git clone ssh://gitolite@delanoe.org:1979/gargantext /srv/gargantext \
#execute the installation #execute the installation
user@computer: ./install user@computer: ./install
``` ```
During installation an admin account for gargantext will be created by asking you a username and a password The installation requires to create a user for gargantext, it will be asked:
Remember it to accès to the Gargantext plateform
```bash
Username (leave blank to use 'gargantua'):
#email is not mandatory
Email address:
Password:
Password (again):
```
If successfully done this step you should see:
```bash
Superuser created successfully.
[ ok ] Stopping PostgreSQL 9.5 database server: main.
```
## Run ## Run
Once you proceed to installation Gargantext plateforme will be available at localhost:8000 Once you proceed to installation Gargantext plateforme will be available at localhost:8000
by running the run executable file to start gargantext plateform:
``` bash ``` bash
# go into the directory # go into the directory
user@computer: cd /srv/gargantext/ user@computer: cd /srv/gargantext/
#git inside installation folder #git inside installation folder
user@computer: cd /install user@computer: ./start
#execute the installation #type ctrl+d to exit or simply type exit in terminal;
user@computer: ./run
#type ctrl+d to exit or exit; command
``` ```
Then open up a chromium browser and go to localhost:8000 Then open up a chromium browser and go to localhost:8000
...@@ -55,7 +66,3 @@ Click on "Enter Gargantext" ...@@ -55,7 +66,3 @@ Click on "Enter Gargantext"
Login in with you created username and pasword Login in with you created username and pasword
Enjoy! ;) Enjoy! ;)
#resources
Adding a new source into Gargantext requires a previous declaration
of the source inside constants.py
```python
RESOURCETYPES= [
{ "type":9, #give a unique type int
"name": 'SCOAP [XML]', #resource name as proposed into the add corpus FORM [generic format]
"parser": "CernParser", #name of the new parser class inside a CERN.py file (set to None if not implemented)
"format": 'MARC21', #specific format
'file_formats':["zip","xml"],# accepted file format
"crawler": "CernCrawler", #name of the new crawler class inside a CERN.py file (set to None if no Crawler implemented)
'default_languages': ['en', 'fr'], #supported defaut languages of the source
},
...
]
```
## adding a new parser
Once you declared your new parser inside constants.py
add your new crawler file into /srv/gargantext/utils/parsers/
following this naming convention:
* Filename must be in uppercase without the Crawler mention.
eg. MailParser => MAIL.py
* Inside this file the Parser must be called following the exact typo declared as parser in constants.py
* Your new crawler shall inherit from baseclasse Parser and provide a parse(filebuffer) method
```python
#!/usr/bin/python3 env
#filename:/srv/gargantext/util/parser/MAIL.py:
from ._Parser import Parser
class MailParser(Parser):
def parse(self, file):
...
```
## adding a new crawler
Once you declared your new parser inside constants.py
add your new crawler file into /srv/gargantext/utils/parsers/
following this naming convention:
* Filename must be in uppercase without the Crawler mention.
eg. MailCrawler => MAIL.py
* Inside this file the Crawler must be called following the exact typo declared as crawler in constants.py
* Your new crawler shall inherit from baseclasse Crawler and provide three method:
* scan_results => ids
* sample = > yes/no
* fetch
```python
#!/usr/bin/python3 env
#filename:/srv/gargantext/util/crawler/MAIL.py:
from ._Crawler import Crawler
class MailCrawler(Crawler):
def scan_results(self, query):
...
self.ids = set()
def sample(self, results_nb):
...
def fetch(self, ids):
```
...@@ -189,7 +189,7 @@ RESOURCETYPES = [ ...@@ -189,7 +189,7 @@ RESOURCETYPES = [
'name': 'Zotero [RIS]', 'name': 'Zotero [RIS]',
'format': 'RIS', 'format': 'RIS',
'parser': 'RISParser', 'parser': 'RISParser',
'file_formats':["zip"], 'file_formats':["zip", "ris", "txt"],
'crawler': None, 'crawler': None,
'default_languages': ['en'], 'default_languages': ['en'],
}, },
...@@ -218,6 +218,14 @@ RESOURCETYPES = [ ...@@ -218,6 +218,14 @@ RESOURCETYPES = [
"crawler": "CernCrawler", "crawler": "CernCrawler",
'default_languages': ['en'], 'default_languages': ['en'],
}, },
{ "type":10,
"name": 'REPEC [RIS]',
"parser": "RisParser",
"format": 'RIS',
'file_formats':["zip","ris", "txt"],
"crawler": None,
'default_languages': ['en'],
},
] ]
#shortcut for resources declaration in template #shortcut for resources declaration in template
PARSERS = [(n["type"],n["name"]) for n in RESOURCETYPES if n["parser"] is not None] PARSERS = [(n["type"],n["name"]) for n in RESOURCETYPES if n["parser"] is not None]
......
...@@ -66,5 +66,6 @@ sudo docker run \ ...@@ -66,5 +66,6 @@ sudo docker run \
/bin/bash -c "./psql_configure.sh; ./django_configure.sh ; exit" /bin/bash -c "./psql_configure.sh; ./django_configure.sh ; exit"
sudo docker rm -f `docker ps -a | grep -v CONTAINER | awk '{print $1 }'` sudo docker rm -f `docker ps -a | grep -v CONTAINER | awk '{print $1 }'`
sudo cp ./run /srv/gargantext/start
...@@ -212,12 +212,19 @@ ...@@ -212,12 +212,19 @@
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Add a Corpus</h3>
<h3>Add a Corpus <a href="https://gogs.iscpif.fr/humanities/faq_gargantext/wiki/FAQ#import--export-a-dataset" class="btn btn-default">
<span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span>
</a>
</h3>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<!-- FAQ -->
<form id="id_form" enctype="multipart/form-data" action="/projects/{{project.id}}/" method="post"> <form id="id_form" enctype="multipart/form-data" action="/projects/{{project.id}}/" method="post">
{% csrf_token %} {% csrf_token %}
<table cellpadding="5"> <table cellpadding="5">
{% for field in form %} {% for field in form %}
<tr> <tr>
<th>{{field.label_tag}}</th> <th>{{field.label_tag}}</th>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment