Commit 7e618718 authored by Administrator's avatar Administrator

[FEAT] Resource type rewritten.

parent 3a5d6b08
...@@ -104,34 +104,15 @@ except Exception as error: ...@@ -104,34 +104,15 @@ except Exception as error:
# In[33]: # In[33]:
try: from parsing.parsers_config import parsers
typePubmed = ResourceType.objects.get(name='pubmed')
typeIsi = ResourceType.objects.get(name='isi')
typeRis = ResourceType.objects.get(name='ris')
typeJstor = ResourceType.objects.get(name='RIS (Jstor)')
typePresseFrench = ResourceType.objects.get(name='europress_french')
typePresseEnglish = ResourceType.objects.get(name='europress_english')
except Exception as error: ResourceType.objects.all().delete()
print(error)
for key in parsers.keys():
typePubmed = ResourceType(name='pubmed') try:
typePubmed.save() ResourceType.objects.get_or_create(name=key)
except Exception as error:
typeIsi = ResourceType(name='isi') print("Ressource Error: ", error)
typeIsi.save()
typeRis = ResourceType(name='ris')
typeRis.save()
typeJstor = ResourceType(name='RIS (Jstor)')
typeJstor.save()
typePresseFrench = ResourceType(name='europress_french')
typePresseFrench.save()
typePresseEnglish = ResourceType(name='europress_english')
typePresseEnglish.save()
# In[34]: # In[34]:
......
...@@ -7,7 +7,6 @@ from math import log ...@@ -7,7 +7,6 @@ from math import log
from gargantext_web.db import * from gargantext_web.db import *
from .FileParsers import *
...@@ -30,17 +29,7 @@ class DebugTime: ...@@ -30,17 +29,7 @@ class DebugTime:
# keep all the parsers in a cache # keep all the parsers in a cache
class Parsers(defaultdict): class Parsers(defaultdict):
from .parsers_config import parsers as _parsers
_parsers = {
'pubmed' : PubmedFileParser,
'isi' : IsiFileParser,
'ris' : RisFileParser,
'RIS (Jstor)' : JstorFileParser,
'europress' : EuropressFileParser,
'europress_french' : EuropressFileParser,
'europress_english' : EuropressFileParser,
}
def __missing__(self, key): def __missing__(self, key):
if key not in self._parsers: if key not in self._parsers:
......
from .FileParsers import *
parsers = {
'Pubmed (xml format)' : PubmedFileParser,
'Web of Science (ISI format)' : IsiFileParser,
'Scopus (RIS format)' : RisFileParser,
'Jstor (RIS format)' : JstorFileParser,
#'Europress' : EuropressFileParser,
'Europress (French)' : EuropressFileParser,
'Europress (English)' : EuropressFileParser,
}
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