Add cohorte in generation
This commit is contained in:
parent
acb315b373
commit
f047dba90f
5 changed files with 36 additions and 6 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/data/cohortescolor.json
Normal file
1
public/data/cohortescolor.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"fr": "green", "fr-07": "green", "fr-26": "green", "fr-34": "green", "be": "green", "fr-21": "green", "fr-58": "green", "fr-71": "green", "fr-89": "green", "fr-22": "green", "fr-29": "green", "fr-35": "green", "fr-56": "green", "fr-18": "green", "fr-28": "green", "fr-36": "green", "fr-37": "green", "fr-41": "green", "fr-45": "green", "fr-08": "green", "fr-10": "green", "fr-51": "green", "fr-52": "green", "fr-54": "green", "fr-55": "green", "fr-57": "green", "fr-67": "green", "fr-68": "green", "fr-88": "green", "fr-38": "green", "fr-02": "green", "fr-59": "green", "fr-60": "green", "fr-62": "green", "fr-80": "green", "fr-75": "green", "fr-77": "green", "fr-78": "green", "fr-91": "green", "fr-92": "green", "fr-93": "green", "fr-94": "green", "fr-95": "green", "re": "green", "fr-14": "green", "fr-27": "green", "fr-50": "green", "fr-61": "green", "fr-76": "green", "fr-04": "green", "fr-05": "green", "fr-06": "green", "fr-13": "green", "fr-83": "green", "fr-84": "green", "fr-74": "green", "fr-73": "green", "fr-09": "green", "fr-12": "green", "fr-24": "green", "fr-31": "green", "fr-32": "green", "fr-33": "green", "fr-40": "green", "fr-46": "green", "fr-47": "green", "fr-64": "green", "fr-65": "green", "fr-81": "green", "fr-82": "green", "ch": "green"}
|
1
public/data/cohorteslist.json
Normal file
1
public/data/cohorteslist.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"fr": {"updateMap": "france_fr"}, "fr-07": {"link": "cohorte-2607"}, "fr-26": {"link": "cohorte-2607"}, "fr-34": {"link": "cohorte-34"}, "be": {"link": "cohorte-belgique"}, "fr-21": {"link": "cohorte-bourgogne"}, "fr-58": {"link": "cohorte-bourgogne"}, "fr-71": {"link": "cohorte-bourgogne"}, "fr-89": {"link": "cohorte-bourgogne"}, "fr-22": {"link": "cohorte-bretagne"}, "fr-29": {"link": "cohorte-bretagne"}, "fr-35": {"link": "cohorte-bretagne"}, "fr-56": {"link": "cohorte-bretagne"}, "fr-18": {"link": "cohorte-centre"}, "fr-28": {"link": "cohorte-centre"}, "fr-36": {"link": "cohorte-centre"}, "fr-37": {"link": "cohorte-centre"}, "fr-41": {"link": "cohorte-centre"}, "fr-45": {"link": "cohorte-centre"}, "fr-08": {"link": "cohorte-grand-est"}, "fr-10": {"link": "cohorte-grand-est"}, "fr-51": {"link": "cohorte-grand-est"}, "fr-52": {"link": "cohorte-grand-est"}, "fr-54": {"link": "cohorte-grand-est"}, "fr-55": {"link": "cohorte-grand-est"}, "fr-57": {"link": "cohorte-grand-est"}, "fr-67": {"link": "cohorte-grand-est"}, "fr-68": {"link": "cohorte-grand-est"}, "fr-88": {"link": "cohorte-grand-est"}, "fr-38": {"link": "cohorte-grenoble"}, "fr-02": {"link": "cohorte-hdf"}, "fr-59": {"link": "cohorte-hdf"}, "fr-60": {"link": "cohorte-hdf"}, "fr-62": {"link": "cohorte-hdf"}, "fr-80": {"link": "cohorte-hdf"}, "fr-75": {"link": "cohorte-ile-de-france"}, "fr-77": {"link": "cohorte-ile-de-france"}, "fr-78": {"link": "cohorte-ile-de-france"}, "fr-91": {"link": "cohorte-ile-de-france"}, "fr-92": {"link": "cohorte-ile-de-france"}, "fr-93": {"link": "cohorte-ile-de-france"}, "fr-94": {"link": "cohorte-ile-de-france"}, "fr-95": {"link": "cohorte-ile-de-france"}, "re": {"link": "cohorte-la-reunion"}, "fr-14": {"link": "cohorte-normandie"}, "fr-27": {"link": "cohorte-normandie"}, "fr-50": {"link": "cohorte-normandie"}, "fr-61": {"link": "cohorte-normandie"}, "fr-76": {"link": "cohorte-normandie"}, "fr-04": {"link": "cohorte-paca"}, "fr-05": {"link": "cohorte-paca"}, "fr-06": {"link": "cohorte-paca"}, "fr-13": {"link": "cohorte-paca"}, "fr-83": {"link": "cohorte-paca"}, "fr-84": {"link": "cohorte-paca"}, "fr-74": {"link": "cohorte-paysdesavoie"}, "fr-73": {"link": "cohorte-paysdesavoie"}, "fr-09": {"link": "cohorte-sud-ouest"}, "fr-12": {"link": "cohorte-sud-ouest"}, "fr-24": {"link": "cohorte-sud-ouest"}, "fr-31": {"link": "cohorte-sud-ouest"}, "fr-32": {"link": "cohorte-sud-ouest"}, "fr-33": {"link": "cohorte-sud-ouest"}, "fr-40": {"link": "cohorte-sud-ouest"}, "fr-46": {"link": "cohorte-sud-ouest"}, "fr-47": {"link": "cohorte-sud-ouest"}, "fr-64": {"link": "cohorte-sud-ouest"}, "fr-65": {"link": "cohorte-sud-ouest"}, "fr-81": {"link": "cohorte-sud-ouest"}, "fr-82": {"link": "cohorte-sud-ouest"}, "ch": {"link": "cohorte-suisse"}}
|
|
@ -8,6 +8,7 @@ from rocketchat_API.rocketchat import RocketChat
|
||||||
import json
|
import json
|
||||||
import dev_config as cfg
|
import dev_config as cfg
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
def getNodesOrigin(channel):
|
def getNodesOrigin(channel):
|
||||||
nodes = []
|
nodes = []
|
||||||
|
@ -59,6 +60,8 @@ edge_index += 1
|
||||||
datas.append( { 'data':{'id': 'edge_' + str(edge_index), 'source': 'mare', 'target': 'project', 'color': colorInfo['project']}})
|
datas.append( { 'data':{'id': 'edge_' + str(edge_index), 'source': 'mare', 'target': 'project', 'color': colorInfo['project']}})
|
||||||
edge_index += 1
|
edge_index += 1
|
||||||
|
|
||||||
|
cohortes = { 'fr': { 'updateMap': 'france_fr'}}
|
||||||
|
cohortescolor = { 'fr': 'green' }
|
||||||
index = 0
|
index = 0
|
||||||
nbChannels = 0
|
nbChannels = 0
|
||||||
nbCohorte = 0
|
nbCohorte = 0
|
||||||
|
@ -69,6 +72,11 @@ while True:
|
||||||
|
|
||||||
for channel in channels['channels']:
|
for channel in channels['channels']:
|
||||||
if channel['name'].find('cohorte') != -1:
|
if channel['name'].find('cohorte') != -1:
|
||||||
|
if 'description' in channel:
|
||||||
|
m = re.findall('#([\w-]+)', channel['description'])
|
||||||
|
for region in m:
|
||||||
|
cohortescolor.update( { region: 'green' } )
|
||||||
|
cohortes.update( { region: { 'link': channel['name']}})
|
||||||
nbCohorte += 1
|
nbCohorte += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -113,6 +121,14 @@ channelsFilePath = os.path.abspath(os.path.join(dataFolder,'channelslist.json'))
|
||||||
with open(channelsFilePath, "w") as file_write:
|
with open(channelsFilePath, "w") as file_write:
|
||||||
json.dump(datas, file_write)
|
json.dump(datas, file_write)
|
||||||
|
|
||||||
|
cohortecolorFilePath = os.path.abspath(os.path.join(dataFolder,'cohortescolor.json'))
|
||||||
|
with open(cohortecolorFilePath, "w") as file_write:
|
||||||
|
json.dump(cohortescolor, file_write)
|
||||||
|
|
||||||
|
cohorteFilePath = os.path.abspath(os.path.join(dataFolder,'cohorteslist.json'))
|
||||||
|
with open(cohorteFilePath, "w") as file_write:
|
||||||
|
json.dump(cohortes, file_write)
|
||||||
|
|
||||||
pprint("Nb displayed channels : " + str(nbChannels))
|
pprint("Nb displayed channels : " + str(nbChannels))
|
||||||
pprint("Nb cohorte channels : " + str(nbCohorte))
|
pprint("Nb cohorte channels : " + str(nbCohorte))
|
||||||
pprint("Nb total channels : " + str(totalChannels))
|
pprint("Nb total channels : " + str(totalChannels))
|
||||||
|
|
Loading…
Reference in a new issue