I recently pusblished my first official powershell module to the powershell Gallery Called RegardsCitoyensPS . RegardsCitoyenPS is a PowerShell Module that allow people to retrieve information from the French democratic process. For more details, click here. (This module is publicly available on github under MIT licence). As with all the open source (public) projects I work on, I keep learning new things. It never end’s. And for this project this modo was still true. I learned the process on how to upload a Module using CI with Appveyor, or how to work with classes in a module project in a structuered and a logical way (Blog post is in prepration ;)). But no, this time, there was something more then technical knowledge. Something really surprising that I actually wouldn’t have never thought that PowerShell could teach me…
Let me explain:
When you google things about how our democracy works, you will find nice pictures and flows that explains how we elect our president (In france it is a direct vote) and then that he creates a government.
We see a lot of arrows, that explains that we vote for the Deputes through regional votes and that these same deputes will control the actions that are done by the government and discuss national and international issues, propose/vote laws etc..
The API goes pretty deep in the real documents that are produced by our government, and it shows all the details of how the different deputes actually work together. They actually create groups called a “Groupe Parlementaire” or “Groupe Extra parlementaire” to work on different cases Called ‘Dossier’ in French. (Get-RCDossier). Base on this ‘dossier’ they go and discuss it during a ‘seance’,Which is actually just another word for a normal working day. (This resulted in the cmdlet Get-RCSeance). Each depute has a specific amount of time to be able to discuss the subject of the seance about the ‘dossier’. Each of these talks, is called a “Intervention” (Get-RCIntervention).
The parlement groups and extra parlement groups can also produce documents (Get-RCDocument) which can be of several nature: ‘Proposition for a new law’, ‘A report’, “A writable question” etc… and these documents will then be discussed in the parlement during a ‘sceance’.
While working on the module, and looking into all the different objects I got back from the differnt API routes, I had to do understand the structure of thesed objects, how they were linked together in order to be able to write the appropraite functions and cmdlets for the module. Digging into the objects made me realize where the connection were, and which entity produced which document.
After a few days of working on this project, I realized that my knowledge in the inner processes of our government was pretty basic, just the basic high level knowledge that you can easily find on wikipedia. But how our parlement really works, was a mystery for me (or to be honnest, I actually never really thought about it).
I realized that thanks to the efforts I made in trying to build this powershell module, I suddently understood how our parlement really works. The inner process. And THAT(!), is what surprised me and what is so priceless to my eyes.
This time I would like to present you a small project on which I have been working on for the last couple of weeks, and that I recently published.
When I published the first version of RegardsCitoyensPS, I had a very special feeling growing inside me. I had the impression I provided something more then just a powershell module for other scripters like me. I had the feeling, that I did something something bigger. Something that would be use full (in a way) for our country, and the democracy we are living in (on my very low and humble level, of course..)
But why is this important?
I agree, this has nothing to do with datacenter or Cloud management, but this module can be the base of so many projects that could be used to make our democracy cleaner and more transparent that I am really really excited to see how this is going to forward.
The main Github Project and the introductory article are both written in French, since it made sense to me to address this module first to the people that would probably use it the most: The french citizens, and as everybody might know, English can be a bit difficult for some of the French people of the older generation. (There has been some drastic investements, and the global english level and comprehension really stung).
The help files in the module itself are all written in French. There is currently no plan yet to translate them to English. If there if there is a demand asking for it, It could be a possibility that we then do the translation into English.
What can we concretley do with RegardsCitoyenPS?
First, be sure that you have installed the module. If not, you can install it using the following command:
1
|
install-module RegardsCitoyenPS -Force
|
It should not take more then a few seconds to download and install the module.
For the moment we have 10 different cmdlets to work with (and a few in the pipe for the next release)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
get-command -Module RegardsCitoyenps
CommandType Name Version Source
—————– —— ———– ———
Function Get-RCDepute 0.6.2.0 RegardsCitoyenPS
Function Get-RCDocument 0.6.2.0 RegardsCitoyenPS
Function Get-RCDossier 0.6.2.0 RegardsCitoyenPS
Function Get-RCGroupePolitique 0.6.2.0 RegardsCitoyenPS
Function Get-RCIntervention 0.6.2.0 RegardsCitoyenPS
Function Get-RCOrganismeExtraParlementaire 0.6.2.0 RegardsCitoyenPS
Function Get-RCOrganismeParlementaire 0.6.2.0 RegardsCitoyenPS
Function Get-RCSeance 0.6.2.0 RegardsCitoyenPS
Function Get-RCSynthese 0.6.2.0 RegardsCitoyenPS
Function Invoke-RCRecherche 0.6.2.0 RegardsCitoyenPS
|
We have the possibility to query the list of our deputies using the following command:
1
|
Get-RCDepute
|
The list of all our political groups:
1
|
Get-RCGroupePolitique
|
“Since France has a system of ‘multipartisme’ we have quite a few political parties in our country. Not all of them are in the parliament though, so, only the ones that have an elected deputy in the parliament are returned.”
List all the deputies members of a specefic political group
1
|
Get-RCGroupePolitique -Acronyme “LR” -ListMembres
|
We can then go and dig a bit deeper in some of the work that the deputies have been working on.
1
2
3
4
5
6
7
8
9
10
11
12
|
C:Program FilesWindowsPowerShellModules > Get-RCDossier -id 346
id : 346
Titre : Sécurité intérieure et lutte contre le terrorisme
MinDate : 9/25/2017 12:00:00 AM
MaxDate : 10/11/2017 12:00:00 AM
NbInterventions : 1836
Intervenants :
Seances :
Documents :
SousSection :
|
This ‘Dossier’ (which means folder in french) is about the inner security and the discussions about the measures against terrorism that should be adopted or not.
If you have a closer look at the object, we see that ‘some’ of the properties seem to be empty. Since some of the discussions could become so big, and so many different people could be involved in it, that the objects could get really big, and that would have a negative performance impact on the cmdlet.
Therefor, this cmdlet only returns some basic information first, and if more information is needed. I decided to implement this using a Class Method so that the information would be available with the rest of the object after the additional calls
Lets save the results in a variable and look a the same example again, but this time, we will use the class method to gather the rest of the properties.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
[A][52] C:Program FilesWindowsPowerShellModules > $terrorism = Get-RCDossier -id 346
[A][53] C:Program FilesWindowsPowerShellModules > $terrorism
id : 346
Titre : Sécurité intérieure et lutte contre le terrorisme
MinDate : 9/25/2017 12:00:00 AM
MaxDate : 10/11/2017 12:00:00 AM
NbInterventions : 1836
Intervenants :
Seances :
Documents :
SousSection :
[A][54] C:Program FilesWindowsPowerShellModules > $terrorism | gm
TypeName: Dossier
Name MemberType Definition
—— ————— —————
Equals Method bool Equals(System.Object obj)
<strong>Full Method Dossier Full()</strong>
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Documents Property string[] Documents {get;set;}
id Property int id {get;set;}
Intervenants Property System.Object[] Intervenants {get;set;}
MaxDate Property datetime MaxDate {get;set;}
MinDate Property datetime MinDate {get;set;}
NbInterventions Property int NbInterventions {get;set;}
Seances Property Intervention[] Seances {get;set;}
SousSection Property string[] SousSection {get;set;}
Titre Property string Titre {get;set;}
|
Now that we know that there is a method called full() on this object of type Dossier we go ahead and call it.
1
2
3
4
5
6
7
8
9
10
11
|
C:Program FilesWindowsPowerShellModules > $terrorism.Full()
id : 346
Titre : Sécurité intérieure et lutte contre le terrorisme
MinDate : 9/25/2017 12:00:00 AM
MaxDate : 10/11/2017 12:00:00 AM
NbInterventions : 1836
Intervenants : {185, 260, 363, 101...}
Seances : {104, 104, 104, 104...}
Documents : {Document, Document, Document, Document...}
SousSection :
|
This will take a short while to finish, since there is a lot to go and fetch. But after a few seconds, the object is sent back to us, with properties “intervenants”,”seances” and “Documents” filled.
It is now possible to dig deeper in these values. For example, to have the list of all the deputies that actually took part in this debate, you would use the following line ( I have select the Name, political group the deputy is member of, and the circonscription it has been elected in (more or less from which region in France).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
[A][60] C:Program FilesWindowsPowerShellModules > $terrorism.Intervenants | Select Nom,Groupe,nomCirconscription
Nom Groupe NomCirconscription
—– ——— —————————
Gauvain LREM Saône-et-Loire
Bernalicis LFI Nord
Larrivé LR Yonne
Ciotti LR Alpes-Maritimes
Obono LFI Paris
Lecoq GDR Seine-Maritime
Ménard NI Hérault
Guévenoux LREM Essonne
Chenu NI Nord
Corbière LFI Seine-Saint-Denis
Gouffier-Cha LREM Val-de-Marne
Habib UAI Français établis hors de France
Boyer LR Bouches-du-Rhône
Dussopt NG Ardèche
Valls LREM Essonne
Ruffin LFI Somme
Marleix LR Eure-et-Loir
Brenier LR Alpes-Maritimes
Balanant MODEM Finistère
Pradié LR Lot
Coquerel LFI Seine-Saint-Denis
(...)
|
(I truncate the results for brievety).
The interesting part is yet to come. The debate about a specific topic is held during a regular working day. Each of a regular work day, is called a ‘seance’. So to get the details about what has been exactly said, and by who, can be achieved using the following lines of code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
$terrorism.Seances
(...)
id : 153
Titre : séance en hémicycle du 25 septembre 2017 à 16h00
Lieu : Hémicycle
Date : 9/25/2017 4:00:00 PM
Type : loi
Section : Sécurité intérieure et lutte contre le terrorisme
SousSection : Discussion générale
NomIntervenant : Naïma Moutchou
Contenu : <p>L‘utilité de ce texte est justifiée avec clarté par ce seul argument.</p>
tags :
Amendements :
Loi : {0, 0, 0}
id : 153
Titre : séance en hémicycle du 25 septembre 2017 à 16h00
Lieu : Hémicycle
Date : 9/25/2017 4:00:00 PM
Type : loi
Section : Sécurité intérieure et lutte contre le terrorisme
SousSection : Discussion générale
NomIntervenant :
Contenu : <p>Applaudissements sur les bancs du groupe REM et sur plusieurs bancs du groupe MODEM. </p>
tags :
Amendements :
Loi : {0, 0, 0}
id : 153
Titre : séance en hémicycle du 25 septembre 2017 à 16h00
Lieu : Hémicycle
Date : 9/25/2017 4:00:00 PM
Type : loi
Section : Sécurité intérieure et lutte contre le terrorisme
SousSection : Discussion générale
NomIntervenant : Carole Bureau-Bonnard
Contenu : <p>Mes chers collègues, je vous propose que nous finissions d’entendre les orateurs inscrits dans la discussion générale, en terminant vers vingt heures vingt. Le
Gouvernement répondra au début de la séance de ce soir.</p><p>La parole est à Mme Marie-France Lorho.</p>
tags :
Amendements :
Loi : {0, 0, 0}
id : 153
Titre : séance en hémicycle du 25 septembre 2017 à 16h00
Lieu : Hémicycle
Date : 9/25/2017 4:00:00 PM
Type : loi
Section : Sécurité intérieure et lutte contre le terrorisme
SousSection : Discussion générale
NomIntervenant : Marie-France Lorho
Contenu : <p>Madame la présidente, monsieur le ministre, madame la présidente de la commission des lois, chers collègues, la France est confrontée à un danger violent : l‘islamisme.
Un ennemi, autrefois extérieur et circonscrit par des frontières, s’est insinué au coeur de nos métropoles et de nos villages. Cet ennemi s‘enracine au coeur de notre
patrie, choyé comme clientèle électorale, instrumentalisé par les propagateurs de la haine de soi, laissé libre d’ouvrir mosquées salafistes et madrasas dans le pays de
saint Louis.</p><p>Actuellement, les groupes terroristes qui sévissent en Irak, en Syrie, au Mali ou ailleurs utilisent bien entendu cette faille nationale pour atteindre
notre corps social et nos symboles. Leurs actions insupportables ont pu se propager à cause des erreurs géopolitiques commises pendant les quinquennats précédents. Nous
n‘aurions pas dû détruire la Libye ; nous n’aurions pas dû alimenter les factions islamistes de la rébellion syrienne ; nous n‘aurions pas dû enfermer nos échanges
orientaux dans le piège tendu par les pays du Golfe. À propos de tout cela, les chrétiens d’Orient, comme d‘autres minorités, nous alertent depuis
longtemps.</p><p>Toutefois, cette situation géopolitique ne peut résumer la cause de la multiplication des attentats sur notre sol. La première cause de cette
recrudescence d’attentats, c‘est l’affrontement au coeur de notre société de modèles de civilisation qui ne peuvent pas coexister. L‘appétit financier des grands groupes,
qui ont cherché à mondialiser le facteur travail en imposant une immigration massive à notre peuple, s’est soldé par un remplacement progressif de civilisation dans
certaines parties du territoire et par la diffusion de l‘islamisme politique en métropole et en outre-mer.</p>
tags :
Amendements :
Loi : {0, 0, 0}
id : 153
Titre : séance en hémicycle du 25 septembre 2017 à 16h00
Lieu : Hémicycle
Date : 9/25/2017 4:00:00 PM
Type : loi
Section : Sécurité intérieure et lutte contre le terrorisme
SousSection : Discussion générale
NomIntervenant :
Contenu : <p>Exclamations sur les bancs du groupe FI. </p>
tags :
Amendements :
Loi : {0, 0, 0}
(...)
|
If we look in the Property called Contenu, we see everything that has been discussed in for that particular Law. We can learn, who was for it, who was against it, and what each party said about it. I have only display an extreme small portion of what is possible to have. The contents are extremly detailed, and we can follow / parse a complete debate, from start to the vote of law, just through reading the different powershell objects.
In this particular case, there has been 7715 exchanges (AS the following command proves).
1
2
3
4
5
6
7
8
9
|
$terrorism.Seances | measure
Count : 7715
Average :
Sum :
Maximum :
Minimum :
Property :
|
Interesting isn’t it? And that is just the tip of the iceberg! I do have a lot of ideas to expand this module, and I hope people will participate in this project.
1 |
Write-Host "See you in the next article :)" |
#Stéphane
Leave A Comment