Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
153
Issues
153
List
Board
Labels
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
36b1f7eb
Commit
36b1f7eb
authored
Oct 05, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[upload] implement simple endpoint for zip file upload
parent
35c457c6
Pipeline
#1934
passed with stage
in 49 minutes and 52 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
5 deletions
+10
-5
New.hs
src/Gargantext/API/Node/Corpus/New.hs
+2
-0
File.hs
src/Gargantext/API/Node/Corpus/New/File.hs
+4
-5
Parsers.hs
src/Gargantext/Core/Text/Corpus/Parsers.hs
+4
-0
No files found.
src/Gargantext/API/Node/Corpus/New.hs
View file @
36b1f7eb
...
...
@@ -257,6 +257,7 @@ addToCorpusWithForm user cid (NewWithForm ft d l _n) logStatus jobLog = do
CSV
->
Parser
.
parseFormat
Parser
.
CsvGargV3
WOS
->
Parser
.
parseFormat
Parser
.
WOS
PresseRIS
->
Parser
.
parseFormat
Parser
.
RisPresse
ZIP
->
Parser
.
parseFormat
Parser
.
ZIP
-- TODO granularity of the logStatus
eDocs
<-
liftBase
$
parse
$
cs
d
...
...
@@ -370,3 +371,4 @@ addToCorpusWithFile user cid nwf@(NewWithFile _d _l fName) logStatus = do
,
_scst_remaining
=
Just
0
,
_scst_events
=
Just
[]
}
src/Gargantext/API/Node/Corpus/New/File.hs
View file @
36b1f7eb
...
...
@@ -45,25 +45,24 @@ data FileType = CSV
|
CSV_HAL
|
PresseRIS
|
WOS
|
ZIP
deriving
(
Eq
,
Show
,
Generic
)
instance
ToSchema
FileType
instance
Arbitrary
FileType
where
arbitrary
=
elements
[
CSV
,
PresseRIS
]
instance
Arbitrary
FileType
where
arbitrary
=
elements
[
CSV
,
PresseRIS
]
instance
ToParamSchema
FileType
instance
FromJSON
FileType
instance
ToJSON
FileType
instance
ToParamSchema
(
MultipartData
Mem
)
where
toParamSchema
_
=
toParamSchema
(
Proxy
::
Proxy
TODO
)
instance
ToParamSchema
(
MultipartData
Mem
)
where
toParamSchema
_
=
toParamSchema
(
Proxy
::
Proxy
TODO
)
instance
FromHttpApiData
FileType
where
parseUrlPiece
"CSV"
=
pure
CSV
parseUrlPiece
"CSV_HAL"
=
pure
CSV_HAL
parseUrlPiece
"PresseRis"
=
pure
PresseRIS
parseUrlPiece
"ZIP"
=
pure
ZIP
parseUrlPiece
_
=
pure
CSV
-- TODO error here
...
...
src/Gargantext/Core/Text/Corpus/Parsers.hs
View file @
36b1f7eb
...
...
@@ -68,6 +68,7 @@ type ParseError = String
-- different parser are available.
data
FileFormat
=
WOS
|
RIS
|
RisPresse
|
CsvGargV3
|
CsvHal
|
ZIP
deriving
(
Show
)
-- Implemented (ISI Format)
...
...
@@ -94,6 +95,9 @@ parseFormat WOS bs = do
$
partitionEithers
$
[
runParser'
WOS
bs
]
pure
$
Right
docs
parseFormat
ZIP
_bs
=
do
printDebug
"[parseFormat]"
ZIP
pure
$
Left
"Not implemented for ZIP"
parseFormat
_
_
=
undefined
-- | Parse file into documents
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment