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
158
Issues
158
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
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
2645c82e
Commit
2645c82e
authored
Jan 25, 2021
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DEMO] read any file to get annuaire
parent
17109415
Pipeline
#1387
failed with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
6 deletions
+19
-6
IMTUser.hs
src/Gargantext/Core/Ext/IMTUser.hs
+17
-4
Flow.hs
src/Gargantext/Database/Action/Flow.hs
+2
-2
No files found.
src/Gargantext/Core/Ext/IMTUser.hs
View file @
2645c82e
...
...
@@ -23,15 +23,22 @@ import Data.Maybe (catMaybes)
import
Data.Text
(
Text
)
import
Data.Vector
(
Vector
)
import
GHC.Generics
(
Generic
)
import
Gargantext.Core.Text.Corpus.Parsers.CSV
import
Gargantext.Database.Admin.Types.Hyperdata.Contact
import
Gargantext.Prelude
import
System.FilePath.Posix
(
takeExtension
)
import
System.IO
(
FilePath
)
import
qualified
Data.ByteString.Lazy
as
BL
import
Gargantext.Core.Text.Corpus.Parsers.CSV
import
qualified
Data.Vector
as
Vector
------------------------------------------------------------------------
------------------------------------------------------------------------
readFile_Annuaire
::
FilePath
->
IO
[
HyperdataContact
]
readFile_Annuaire
fp
=
case
takeExtension
fp
of
".csv"
->
readCSVFile_Annuaire
fp
".data"
->
deserialiseImtUsersFromFile
fp
_
->
panic
"[G.C.E.I.readFile_Annuaire] extension unknown"
------------------------------------------------------------------------
data
IMTUser
=
IMTUser
{
id
::
Maybe
Text
,
entite
::
Maybe
Text
...
...
@@ -104,8 +111,14 @@ headerCSVannuaire :: Header
headerCSVannuaire
=
header
[
"id"
,
"entite"
,
"mail"
,
"nom"
,
"prenom"
,
"fonction"
,
"fonction2"
,
"tel"
,
"fax"
,
"service"
,
"groupe"
,
"entite2"
,
"service2"
,
"groupe2"
,
"bureau"
,
"url"
,
"pservice"
,
"pfonction"
,
"afonction"
,
"afonction2"
,
"grprech"
,
"appellation"
,
"lieu"
,
"aprecision"
,
"atel"
,
"sexe"
,
"statut"
,
"idutilentite"
,
"actif"
,
"idutilsiecoles"
,
"date_modification"
]
readFile_Annuaire
::
FilePath
->
IO
(
Header
,
Vector
IMTUser
)
readFile_Annuaire
=
fmap
readCsvHalLazyBS'
.
BL
.
readFile
readCSVFile_Annuaire
::
FilePath
->
IO
[
HyperdataContact
]
readCSVFile_Annuaire
fp
=
do
users
<-
snd
<$>
readCSVFile_Annuaire'
fp
pure
$
map
imtUser2gargContact
$
Vector
.
toList
users
readCSVFile_Annuaire'
::
FilePath
->
IO
(
Header
,
Vector
IMTUser
)
readCSVFile_Annuaire'
=
fmap
readCsvHalLazyBS'
.
BL
.
readFile
where
readCsvHalLazyBS'
::
BL
.
ByteString
->
(
Header
,
Vector
IMTUser
)
readCsvHalLazyBS'
bs
=
case
decodeByNameWith
csvDecodeOptions
bs
of
...
...
src/Gargantext/Database/Action/Flow.hs
View file @
2645c82e
...
...
@@ -66,7 +66,7 @@ import qualified Data.Map as Map
import
Gargantext.Core
(
Lang
(
..
),
PosTagAlgo
(
..
))
import
Gargantext.Core.Ext.IMT
(
toSchoolName
)
import
Gargantext.Core.Ext.IMTUser
(
deserialiseImtUsersFromFil
e
)
import
Gargantext.Core.Ext.IMTUser
(
readFile_Annuair
e
)
import
Gargantext.Core.Flow.Types
import
Gargantext.Core.Text
import
Gargantext.Core.Text.List.Group.WithStem
(
{-StopSize(..),-}
GroupParams
(
..
))
...
...
@@ -166,7 +166,7 @@ flowAnnuaire :: (FlowCmdM env err m)
->
FilePath
->
m
AnnuaireId
flowAnnuaire
u
n
l
filePath
=
do
docs
<-
liftBase
$
((
splitEvery
500
<$>
deserialiseImtUsersFromFil
e
filePath
)
::
IO
[[
HyperdataContact
]])
docs
<-
liftBase
$
((
splitEvery
500
<$>
readFile_Annuair
e
filePath
)
::
IO
[[
HyperdataContact
]])
flow
(
Nothing
::
Maybe
HyperdataAnnuaire
)
u
n
l
docs
------------------------------------------------------------------------
...
...
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