From db4f9505da7e4a289439cf6963cf85ed27fb0145 Mon Sep 17 00:00:00 2001 From: Djalim Simaila Date: Mon, 25 Mar 2024 12:02:27 +0100 Subject: [PATCH] initial commit --- .gitignore | 3 + README.md | 12 + mcd_mocodo.py | 128 ++++ mocodo_notebook.ipynb | 1409 +++++++++++++++++++++++++++++++++++++++++ mocodo_script.py | 46 ++ requierements.txt | 43 ++ 6 files changed, 1641 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 mcd_mocodo.py create mode 100644 mocodo_notebook.ipynb create mode 100644 mocodo_script.py create mode 100644 requierements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d5cf5c7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +mocodo_notebook +**__pycache__** +output \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..5649f62 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +## TLDR + +Le module python mocodo est un wrapper pour le programe mocodo, il peut etre utilusé pour faciliter des scipts +on utilise donc le module +```python +from mocodo.api import mocodo +``` +ou etre utilisé dans un notebook, dans ce cas on utilse +``` python +from mocodo.magic import mocodo +``` +L'avantage de ce dernier est qu'il affiche les resultats dans le notebook (en plus de gerener les fichiers). \ No newline at end of file diff --git a/mcd_mocodo.py b/mcd_mocodo.py new file mode 100644 index 0000000..f2e5582 --- /dev/null +++ b/mcd_mocodo.py @@ -0,0 +1,128 @@ +""" +Domaines de l'application exprimés en MCD mocodo +""" + +apprenant = "apprenant:id_apprenant,nom,prenom,date_de_naissance,classe,reponses_questionnaire\n" +compte = "compte:login,email,password,état,date_de_derniere_co,nom,prenom,mobile,date_de_création,moyen_paiement,est_connecté\n" + +auth = f""" +{compte} +{apprenant} +licence:clé,date_utilisation +promotion:code, date_de_création,durée_reduction,reduction,conditions +abonnement:nom_abonnement,prix,date_de_début,date_de_fin +droit:id_droit,niveau_d_access,nb_profil_crée,nb_user_invite,peut_modifier_profil,peut_supprimer_profil, peut_faire_activité, peut_faire_test, peut_consulter_hist_activité, peut_consulter_hist_test +questionnaire: id_questionnaire,forme_rappel, disponibilité,reponses_questionnaire +probleme_signalé:id_prob,version de l'application,support,date du signalement,commentaire +question_posée:id_quest,question +anonyme:id,email + +inviter,0N compte,0N compte,0N apprenant,0N droit,0N licence: date invitation, +utiliser,01 compte,0N licence +repondre, 01 compte, 0N questionnaire +créer, 0N compte,0N apprenant +acheter, 0N compte, 0N promotion, 0N licence, 0N abonnement : date d'achat +assigner, 11 abonnement, 0N droit +poser, 11 question_posée, 0N anonyme +poser1, 11 question_posée, 0N compte +signaler, 11 probleme_signalé, 0N anonyme +signaler1, 11 probleme_signalé, 0N compte +""" + +fiche_activite = "fiche_activité:id_fiche,comp_travaillé,pourquoi_travailler_comp,variantes\n" +activite = "activité: id_activité, caracteristiques ia\n" + +activites = f""" +{apprenant} +{compte} +{activite} +{fiche_activite} +activité_ajoutee: titre, caracteristiques ia +historique_activité: id, durée, date de réalisation, note difficulté,note plaisir,note concentration, note durée, activité proposée par algo + +réaliser, 0N compte, 0N activité, 11 historique_activite, 0N apprenant : points accordés +ajouter, 0N compte,0N activité_ajoutee, 11 historique_activité , 0N apprenant +posséser, 11 historique_activité, 0N apprenant +decrire, 0N fiche_activite, 11 activité +""" + +recompenses = f""" +{apprenant} +{compte} +palier:id_palier,nombre de points +defi:id_defi,nom,objectif,date limite +badge: id_badge,nom,description,image +{activite} + +atteindre, 0N apprenant, 0N palier +réaliser, 0N compte, 0N activité, 0N apprenant : points accordés +réaliser3, 0N apprenant, 0N defi +debloquer, 0N defi, 11 badge +debloquer1, 0N palier, 11 badge +""" + +#la relation réaliser est dupliquée entre des deux domaines, je garde un version sans pour la concatenation finale +recompenses_nr = f""" +{apprenant} +{compte} +palier:id_palier,nombre de points +defi:id_defi,nom,objectif,date limite +badge: id_badge,nom,description,image +{activite} + +atteindre, 0N apprenant, 0N palier +réaliser3, 0N apprenant, 0N defi +debloquer, 0N defi, 11 badge +debloquer1, 0N palier, 11 badge +""" + +ressources = f""" +mot_clé: mot +Ressource:id_ress,titre,description,date_de_publication,type,niveau_d_access +vidéo:id_video,lien_vers_site_externe +article:id_article,lien_vers_site_externe +{fiche_activite} + +contenir,0N mot_clé,0N Ressource +etre1, 0N Ressource, 11 vidéo +etre2, 0N Ressource, 11 article +etre3, 0N Ressource, 11 fiche_activité +""" + +test =f""" +test_de_positionnement: id_testpos, consigne, caracteristiques ia +test_de_progression: id_testpro, consigne +historique_test: id_entree, durée, score, temps de réaction moyen, date de réalisation +{apprenant} +{compte} + +réaliser1, 0N compte,0N test_de_progression, 11 historique_test, 0N apprenant +réaliser2, 0N compte,0N test_de_positionnement, 11 historique test, 0N apprenant +posséser1, 11 historique_test, 0N apprenant +""" + +entités = [ + apprenant, + compte, + fiche_activite, + activite, +] + +domaines = [ + auth, + activites, + recompenses_nr, + ressources, + test, +] + +texte_complet = "" +for domaine in domaines: + for entite in entités: + if entite in domaine: + domaine = domaine.replace(entite, "") + texte_complet += domaine + +for entite in entités: + texte_complet += entite + diff --git a/mocodo_notebook.ipynb b/mocodo_notebook.ipynb new file mode 100644 index 0000000..a2e271f --- /dev/null +++ b/mocodo_notebook.ipynb @@ -0,0 +1,1409 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Mocodo 4.2.4 loaded.\n" + ] + } + ], + "source": [ + "%reload_ext mocodo\n", + "from mocodo.magic import mocodo\n", + "import mcd_mocodo as mcd" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "def generer_mcd(domaine:str, ga:bool=False,seed:float=1):\n", + " \"\"\"\n", + " Genère un graphe MCD à partir d'un domaine exprimé en MCD mocodo\n", + "\n", + " :param domaine: Le domaine exprimé en MCD mocodo\n", + " :type domaine: str\n", + " :param ga: Utiliser l'algorithme génétique pour arranger les entités, par défaut False\n", + " :type ga: bool, optional\n", + " :param seed: La graine pour le réarangement des entités, par défaut 1\n", + " :type seed: float, optional\n", + "\n", + " \"\"\"\n", + " return mocodo(f\"\"\"\n", + " %mocodo --colors ocean -t arrange{\":algo=ga\" if ga else \"\"} --seed {seed} --detect_overlaps --select mcd\n", + " {domaine}\n", + " \"\"\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tassigner\n", + "\t\n", + "\t1,1\n", + "\t0,N\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tposer\n", + "\t\n", + "\t1,1\n", + "\t0,N\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tacheter\n", + "\t\tdate d’achat\n", + "\t\n", + "\t0,N\n", + "\t0,N\n", + "\t0,N\n", + "\t0,N\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tposer\n", + "\t\n", + "\t1,1\n", + "\t0,N\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\trepondre\n", + "\t\n", + "\t0,1\n", + "\t0,N\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tutiliser\n", + "\t\n", + "\t0,1\n", + "\t0,N\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tsignaler\n", + "\t\n", + "\t1,1\n", + "\t0,N\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tcréer\n", + "\t\n", + "\t0,N\n", + "\t0,N\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tinviter\n", + "\t\tdate invitation\n", + "\t\n", + "\t0,N\n", + "\t0,N\n", + "\t0,N\n", + "\t0,N\n", + "\t0,N\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tsignaler\n", + "\t\n", + "\t1,1\n", + "\t0,N\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tpromotion\n", + "\tcode\n", + "\t\n", + "\tdate_de_création\n", + "\tdurée_reduction\n", + "\treduction\n", + "\tconditions\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tabonnement\n", + "\tnom_abonnement\n", + "\t\n", + "\tprix\n", + "\tdate_de_début\n", + "\tdate_de_fin\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tquestion_posée\n", + "\tid_quest\n", + "\t\n", + "\tquestion\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tlicence\n", + "\tclé\n", + "\t\n", + "\tdate_utilisation\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tcompte\n", + "\tlogin\n", + "\t\n", + "\temail\n", + "\tpassword\n", + "\tétat\n", + "\tdate_de_derniere_co\n", + "\tnom\n", + "\tprenom\n", + "\tmobile\n", + "\tdate_de_création\n", + "\tmoyen_paiement\n", + "\test_connecté\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tdroit\n", + "\tid_droit\n", + "\t\n", + "\tniveau_d_access\n", + "\tnb_profil_crée\n", + "\tnb_user_invite\n", + "\tpeut_modifier_profil\n", + "\tpeut_supprimer_profil\n", + "\tpeut_faire_activité\n", + "\tpeut_faire_test\n", + "\tpeut_consulter_hist_activité\n", + "\tpeut_consulter_hist_test\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tanonyme\n", + "\tid\n", + "\t\n", + "\temail\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tquestionnaire\n", + "\tid_questionnaire\n", + "\t\n", + "\tforme_rappel\n", + "\tdisponibilité\n", + "\treponses_questionnaire\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tprobleme_signalé\n", + "\tid_prob\n", + "\t\n", + "\tversion de l’application\n", + "\tsupport\n", + "\tdate du signalement\n", + "\tcommentaire\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tapprenant\n", + "\tid_apprenant\n", + "\t\n", + "\tnom\n", + "\tprenom\n", + "\tdate_de_naissance\n", + "\tclasse\n", + "\treponses_questionnaire\n", + "\n", + "" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "generer_mcd(mcd.auth,seed=4)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tdecrire\n", + "\t\n", + "\t0,N\n", + "\t1,1\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tposséser\n", + "\t\n", + "\t1,1\n", + "\t0,N\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tréaliser\n", + "\t\tpoints accordés\n", + "\t\n", + "\t0,N\n", + "\t0,N\n", + "\t1,1\n", + "\t0,N\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tajouter\n", + "\t\n", + "\t0,N\n", + "\t0,N\n", + "\t1,1\n", + "\t0,N\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tfiche_activité\n", + "\tid_fiche\n", + "\t\n", + "\tcomp_travaillé\n", + "\tpourquoi_travailler_comp\n", + "\tvariantes\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tapprenant\n", + "\tid_apprenant\n", + "\t\n", + "\tnom\n", + "\tprenom\n", + "\tdate_de_naissance\n", + "\tclasse\n", + "\treponses_questionnaire\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tactivité\n", + "\tid_activité\n", + "\t\n", + "\tcaracteristiques ia\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\thistorique_activité\n", + "\tid\n", + "\t\n", + "\tdurée\n", + "\tdate de réalisation\n", + "\tnote difficulté\n", + "\tnote plaisir\n", + "\tnote concentration\n", + "\tnote durée\n", + "\tactivité proposée par algo\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tcompte\n", + "\tlogin\n", + "\t\n", + "\temail\n", + "\tpassword\n", + "\tétat\n", + "\tdate_de_derniere_co\n", + "\tnom\n", + "\tprenom\n", + "\tmobile\n", + "\tdate_de_création\n", + "\tmoyen_paiement\n", + "\test_connecté\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tactivité_ajoutee\n", + "\ttitre\n", + "\t\n", + "\tcaracteristiques ia\n", + "\n", + "" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "generer_mcd(mcd.activites,seed=2)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tetre\n", + "\t\n", + "\t0,N\n", + "\t1,1\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tetre\n", + "\t\n", + "\t0,N\n", + "\t1,1\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tcontenir\n", + "\t\n", + "\t0,N\n", + "\t0,N\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tetre\n", + "\t\n", + "\t0,N\n", + "\t1,1\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tfiche_activité\n", + "\tid_fiche\n", + "\t\n", + "\tcomp_travaillé\n", + "\tpourquoi_travailler_comp\n", + "\tvariantes\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tRessource\n", + "\tid_ress\n", + "\t\n", + "\ttitre\n", + "\tdescription\n", + "\tdate_de_publication\n", + "\ttype\n", + "\tniveau_d_access\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tmot_clé\n", + "\tmot\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tarticle\n", + "\tid_article\n", + "\t\n", + "\tlien_vers_site_externe\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tvidéo\n", + "\tid_video\n", + "\t\n", + "\tlien_vers_site_externe\n", + "\n", + "" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "generer_mcd(mcd.ressources,seed=2)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tréaliser\n", + "\t\n", + "\t0,N\n", + "\t0,N\n", + "\t1,1\n", + "\t0,N\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tposséser\n", + "\t\n", + "\t1,1\n", + "\t0,N\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tréaliser\n", + "\t\n", + "\t0,N\n", + "\t0,N\n", + "\t1,1\n", + "\t0,N\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\ttest_de_positionnement\n", + "\tid_testpos\n", + "\t\n", + "\tconsigne\n", + "\tcaracteristiques ia\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tcompte\n", + "\tlogin\n", + "\t\n", + "\temail\n", + "\tpassword\n", + "\tétat\n", + "\tdate_de_derniere_co\n", + "\tnom\n", + "\tprenom\n", + "\tmobile\n", + "\tdate_de_création\n", + "\tmoyen_paiement\n", + "\test_connecté\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\thistorique_test\n", + "\tid_entree\n", + "\t\n", + "\tdurée\n", + "\tscore\n", + "\ttemps de réaction moyen\n", + "\tdate de réalisation\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tapprenant\n", + "\tid_apprenant\n", + "\t\n", + "\tnom\n", + "\tprenom\n", + "\tdate_de_naissance\n", + "\tclasse\n", + "\treponses_questionnaire\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\ttest_de_progression\n", + "\tid_testpro\n", + "\t\n", + "\tconsigne\n", + "\n", + "" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "generer_mcd(mcd.test,seed=3)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tréaliser\n", + "\t\tpoints accordés\n", + "\t\n", + "\t0,N\n", + "\t0,N\n", + "\t0,N\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tréaliser\n", + "\t\n", + "\t0,N\n", + "\t0,N\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tatteindre\n", + "\t\n", + "\t0,N\n", + "\t0,N\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tdebloquer\n", + "\t\n", + "\t0,N\n", + "\t1,1\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\tdebloquer\n", + "\t\n", + "\t0,N\n", + "\t1,1\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tactivité\n", + "\tid_activité\n", + "\t\n", + "\tcaracteristiques ia\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tcompte\n", + "\tlogin\n", + "\t\n", + "\temail\n", + "\tpassword\n", + "\tétat\n", + "\tdate_de_derniere_co\n", + "\tnom\n", + "\tprenom\n", + "\tmobile\n", + "\tdate_de_création\n", + "\tmoyen_paiement\n", + "\test_connecté\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tapprenant\n", + "\tid_apprenant\n", + "\t\n", + "\tnom\n", + "\tprenom\n", + "\tdate_de_naissance\n", + "\tclasse\n", + "\treponses_questionnaire\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tdefi\n", + "\tid_defi\n", + "\t\n", + "\tnom\n", + "\tobjectif\n", + "\tdate limite\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tpalier\n", + "\tid_palier\n", + "\t\n", + "\tnombre de points\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\tbadge\n", + "\tid_badge\n", + "\t\n", + "\tnom\n", + "\tdescription\n", + "\timage\n", + "\n", + "" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "generer_mcd(mcd.recompenses,seed=3)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [], + "source": [ + "def generer_mmd(domaine:str):\n", + " \"\"\"\n", + " Genère un graphe Mermaid Crowfoot notation à partir d'un domaine exprimé en MCD mocodo.\n", + " \n", + " :param domaine: Le domaine exprimé en MCD mocodo\n", + " :type domaine: str\n", + " \"\"\"\n", + "\n", + " return mocodo(f\"\"\"\n", + " %mocodo --colors ocean -t crow:mmd\n", + " {domaine}\n", + " \"\"\")\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "\n", + "
\n", + "
\n", + "\n", + "\n", + "mocodo_notebook/sandbox_erd_crow.mmd\n", + "\n", + "\n", + "
\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/markdown": [ + "```mmd\n", + "erDiagram\n", + " licence {\n", + " TYPE cle PK\n", + " TYPE date_utilisation\n", + " }\n", + " promotion {\n", + " TYPE code PK\n", + " TYPE date_de_creation\n", + " TYPE duree_reduction\n", + " TYPE reduction\n", + " TYPE conditions\n", + " }\n", + " abonnement {\n", + " TYPE nom_abonnement PK\n", + " TYPE prix\n", + " TYPE date_de_debut\n", + " TYPE date_de_fin\n", + " }\n", + " droit {\n", + " TYPE id_droit PK\n", + " TYPE niveau_d_access\n", + " TYPE nb_profil_cree\n", + " TYPE nb_user_invite\n", + " TYPE peut_modifier_profil\n", + " TYPE peut_supprimer_profil\n", + " TYPE peut_faire_activite\n", + " TYPE peut_faire_test\n", + " TYPE peut_consulter_hist_activite\n", + " TYPE peut_consulter_hist_test\n", + " }\n", + " questionnaire {\n", + " TYPE id_questionnaire PK\n", + " TYPE forme_rappel\n", + " TYPE disponibilite\n", + " TYPE reponses_questionnaire\n", + " }\n", + " probleme_signale {\n", + " TYPE id_prob PK\n", + " TYPE version_de_l_application\n", + " TYPE support\n", + " TYPE date_du_signalement\n", + " TYPE commentaire\n", + " }\n", + " question_posee {\n", + " TYPE id_quest PK\n", + " TYPE question\n", + " }\n", + " anonyme {\n", + " TYPE id PK\n", + " TYPE email\n", + " }\n", + " inviter {\n", + " TYPE date_invitation PK\n", + " TYPE \n", + " }\n", + " acheter {\n", + " TYPE date_d_achat PK\n", + " }\n", + " activite_ajoutee {\n", + " TYPE titre PK\n", + " TYPE caracteristiques_ia\n", + " }\n", + " historique_activite {\n", + " TYPE id PK\n", + " TYPE duree\n", + " TYPE date_de_realisation\n", + " TYPE note_difficulte\n", + " TYPE note_plaisir\n", + " TYPE note_concentration\n", + " TYPE note_duree\n", + " TYPE activite_proposee_par_algo\n", + " TYPE points_accordes\n", + " }\n", + " palier {\n", + " TYPE id_palier PK\n", + " TYPE nombre_de_points\n", + " }\n", + " defi {\n", + " TYPE id_defi PK\n", + " TYPE nom\n", + " TYPE objectif\n", + " TYPE date_limite\n", + " }\n", + " badge {\n", + " TYPE id_badge PK\n", + " TYPE nom\n", + " TYPE description\n", + " TYPE image\n", + " }\n", + " mot_cle {\n", + " TYPE mot PK\n", + " }\n", + " Ressource {\n", + " TYPE id_ress PK\n", + " TYPE titre\n", + " TYPE description\n", + " TYPE date_de_publication\n", + " TYPE type\n", + " TYPE niveau_d_access\n", + " }\n", + " video {\n", + " TYPE id_video PK\n", + " TYPE lien_vers_site_externe\n", + " }\n", + " article {\n", + " TYPE id_article PK\n", + " TYPE lien_vers_site_externe\n", + " }\n", + " test_de_positionnement {\n", + " TYPE id_testpos PK\n", + " TYPE consigne\n", + " TYPE caracteristiques_ia\n", + " }\n", + " test_de_progression {\n", + " TYPE id_testpro PK\n", + " TYPE consigne\n", + " }\n", + " historique_test {\n", + " TYPE id_entree PK\n", + " TYPE duree\n", + " TYPE score\n", + " TYPE temps_de_reaction_moyen\n", + " TYPE date_de_realisation\n", + " }\n", + " apprenant {\n", + " TYPE id_apprenant PK\n", + " TYPE nom\n", + " TYPE prenom\n", + " TYPE date_de_naissance\n", + " TYPE classe\n", + " TYPE reponses_questionnaire\n", + " }\n", + " compte {\n", + " TYPE login PK\n", + " TYPE email\n", + " TYPE password\n", + " TYPE etat\n", + " TYPE date_de_derniere_co\n", + " TYPE nom\n", + " TYPE prenom\n", + " TYPE mobile\n", + " TYPE date_de_creation\n", + " TYPE moyen_paiement\n", + " TYPE est_connecte\n", + " }\n", + " fiche_activite {\n", + " TYPE id_fiche PK\n", + " TYPE comp_travaille\n", + " TYPE pourquoi_travailler_comp\n", + " TYPE variantes\n", + " }\n", + " activite {\n", + " TYPE id_activite PK\n", + " TYPE caracteristiques_ia\n", + " }\n", + " inviter }o..|| compte: DF\n", + " inviter }o..|| compte: DF\n", + " inviter }o..|| apprenant: DF\n", + " inviter }o..|| droit: DF\n", + " inviter }o..|| licence: DF\n", + " compte }o--o| licence: utiliser\n", + " compte }o--o| questionnaire: repondre\n", + " compte }o--o{ apprenant: creer\n", + " acheter }o..|| compte: DF\n", + " acheter }o..|| promotion: DF\n", + " acheter }o..|| licence: DF\n", + " acheter }o..|| abonnement: DF\n", + " abonnement }o--|| droit: assigner\n", + " question_posee }o--|| anonyme: poser\n", + " question_posee }o--|| compte: poser\n", + " probleme_signale }o--|| anonyme: signaler\n", + " probleme_signale }o--|| compte: signaler\n", + " historique_activite }o--|| compte: realiser\n", + " historique_activite }o--|| activite: realiser\n", + " historique_activite }o--|| apprenant: realiser\n", + " historique_activite }o--|| compte: ajouter\n", + " historique_activite }o--|| activite_ajoutee: ajouter\n", + " historique_activite }o--|| apprenant: ajouter\n", + " historique_activite }o--|| apprenant: posseser\n", + " fiche_activite ||--o{ activite: decrire\n", + " apprenant }o--o{ palier: atteindre\n", + " apprenant }o--o{ defi: realiser\n", + " defi ||--o{ badge: debloquer\n", + " palier ||--o{ badge: debloquer\n", + " mot_cle }o--o{ Ressource: contenir\n", + " Ressource ||--o{ video: etre\n", + " Ressource ||--o{ article: etre\n", + " Ressource ||--o{ fiche_activite: etre\n", + " historique_test }o--|| compte: realiser1\n", + " historique_test }o--|| test_de_progression: realiser1\n", + " historique_test }o--|| apprenant: realiser1\n", + " historique_test }o--|| compte: realiser2\n", + " historique_test }o--|| test_de_positionnement: realiser2\n", + " historique_test }o--|| apprenant: realiser2\n", + " historique_test }o--|| apprenant: posseser\n", + "\n", + "```" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "generer_mmd(mcd.texte_complet)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "venv", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.8" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/mocodo_script.py b/mocodo_script.py new file mode 100644 index 0000000..5b14413 --- /dev/null +++ b/mocodo_script.py @@ -0,0 +1,46 @@ +import mcd_mocodo as mcd +from mocodo.api import mocodo +import pathlib +import os + +DOSSIER_DE_SORTIE = "output" +SUPPRIMER_FICHERTEXTE = True +SUPPRIMER_GEOJSON = True + +domaines = [ + # (mcd.nom_du_domaine, "nom_du_fichier", seed), + (mcd.auth, "auth",4), + (mcd.activites, "activites",2), + (mcd.ressources, "ressources",2), + (mcd.test, "test",3), + (mcd.recompenses, "recompenses",3), +] + +def generer_mcd(domaine:str,nom:str,ga:bool=False,seed:float=1): + """ + Generer un graphe MCD à partir d'un domaine exprimé en MCD mocodo + + :param domaine: Le domaine exprimé en MCD mocodo + :type domaine: str + :param nom: Le nom du fichier de sortie + :type nom: str + :param ga: Utiliser l'algorithme génétique pour arranger les entités + :type ga: bool + :param seed: La graine pour le réarangement des entités, par défaut 1 + :param seed: int + + :return: None + """ + with open(f"{nom}.mcd", "w") as f: + f.write(domaine) + result = mocodo(f'-i {nom} --colors ocean -t arrange{":algo=ga" if ga else ""} --seed {seed} --detect_overlaps') + print(result) + if SUPPRIMER_FICHERTEXTE : pathlib.Path(f"{nom}.mcd").unlink(missing_ok=True) + if SUPPRIMER_GEOJSON : pathlib.Path(f"{nom}_geo.json").unlink(missing_ok=True) + +if __name__ == "__main__": + pathlib.Path(DOSSIER_DE_SORTIE).mkdir(parents=True, exist_ok=True) + os.chdir(DOSSIER_DE_SORTIE) + + for mcd_mocodo, nom, seed in domaines: + generer_mcd(mcd_mocodo, nom, seed=seed) diff --git a/requierements.txt b/requierements.txt new file mode 100644 index 0000000..2f52589 --- /dev/null +++ b/requierements.txt @@ -0,0 +1,43 @@ +asttokens==2.4.1 +cairocffi==1.6.1 +CairoSVG==2.7.1 +certifi==2024.2.2 +cffi==1.16.0 +charset-normalizer==3.3.2 +comm==0.2.2 +cssselect2==0.7.0 +debugpy==1.8.1 +decorator==5.1.1 +defusedxml==0.7.1 +executing==2.0.1 +idna==3.6 +ipykernel==6.29.3 +ipython==8.22.2 +jedi==0.19.1 +jupyter_client==8.6.1 +jupyter_core==5.7.2 +matplotlib-inline==0.1.6 +mocodo==4.2.4 +nest-asyncio==1.6.0 +packaging==24.0 +parso==0.8.3 +pexpect==4.9.0 +pillow==10.2.0 +platformdirs==4.2.0 +prompt-toolkit==3.0.43 +psutil==5.9.8 +ptyprocess==0.7.0 +pure-eval==0.2.2 +pycparser==2.21 +Pygments==2.17.2 +python-dateutil==2.9.0.post0 +pyzmq==25.1.2 +requests==2.31.0 +six==1.16.0 +stack-data==0.6.3 +tinycss2==1.2.1 +tornado==6.4 +traitlets==5.14.2 +urllib3==2.2.1 +wcwidth==0.2.13 +webencodings==0.5.1