Skip to content

Commit

Permalink
feat: query projects with graphql
Browse files Browse the repository at this point in the history
::by sergio giraldo
@ 20240512T2227CEST, gpg signed
  • Loading branch information
sergiorgiraldo committed May 12, 2024
1 parent a8d8118 commit e0f533f
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ITERATION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.130
0.0.131
2 changes: 1 addition & 1 deletion _site/feed.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.3.3">Jekyll</generator><link href="https://sergiorgiraldo.github.io/phd/feed.xml" rel="self" type="application/atom+xml" /><link href="https://sergiorgiraldo.github.io/phd/" rel="alternate" type="text/html" /><updated>2024-05-10T14:23:44+02:00</updated><id>https://sergiorgiraldo.github.io/phd/feed.xml</id><title type="html">PHD SRG.</title><subtitle>My journey.
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.3.3">Jekyll</generator><link href="https://sergiorgiraldo.github.io/phd/feed.xml" rel="self" type="application/atom+xml" /><link href="https://sergiorgiraldo.github.io/phd/" rel="alternate" type="text/html" /><updated>2024-05-12T22:27:35+02:00</updated><id>https://sergiorgiraldo.github.io/phd/feed.xml</id><title type="html">PHD SRG.</title><subtitle>My journey.
May 2024 -&gt; ...</subtitle><author><name>Sergio Giraldo</name></author><entry><title type="html">AI Based Banking Data Analysis with a Design Thinking Approach</title><link href="https://sergiorgiraldo.github.io/phd/2024/05/09/AI-Based-Banking-Data-Analysis-with-a-Design-Think.html" rel="alternate" type="text/html" title="AI Based Banking Data Analysis with a Design Thinking Approach" /><published>2024-05-09T14:54:36+02:00</published><updated>2024-05-09T14:54:36+02:00</updated><id>https://sergiorgiraldo.github.io/phd/2024/05/09/AI-Based-Banking-Data-Analysis-with-a-Design-Think</id><content type="html" xml:base="https://sergiorgiraldo.github.io/phd/2024/05/09/AI-Based-Banking-Data-Analysis-with-a-Design-Think.html"><![CDATA[]]></content><author><name>Sergio Giraldo</name></author><category term="design-thinking" /><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">Leiden</title><link href="https://sergiorgiraldo.github.io/phd/2024/05/05/uni-leiden.html" rel="alternate" type="text/html" title="Leiden" /><published>2024-05-05T22:37:00+02:00</published><updated>2024-05-05T22:37:00+02:00</updated><id>https://sergiorgiraldo.github.io/phd/2024/05/05/uni-leiden</id><content type="html" xml:base="https://sergiorgiraldo.github.io/phd/2024/05/05/uni-leiden.html"><![CDATA[<p><a href="https://www.universiteitleiden.nl/en/science/graduate-school-of-science">Faculty of Science</a></p>]]></content><author><name>Sergio Giraldo</name></author><category term="unis" /><summary type="html"><![CDATA[Faculty of Science]]></summary></entry><entry><title type="html">Erasmus Rotterdam</title><link href="https://sergiorgiraldo.github.io/phd/2024/05/05/uni-erasmus.html" rel="alternate" type="text/html" title="Erasmus Rotterdam" /><published>2024-05-05T22:34:00+02:00</published><updated>2024-05-05T22:34:00+02:00</updated><id>https://sergiorgiraldo.github.io/phd/2024/05/05/uni-erasmus</id><content type="html" xml:base="https://sergiorgiraldo.github.io/phd/2024/05/05/uni-erasmus.html"><![CDATA[<p>I couldnt find a suitable program in the topics I chose. I’ll try again by EOY, maybe new fields arise.</p>]]></content><author><name>Sergio Giraldo</name></author><category term="unis" /><summary type="html"><![CDATA[I couldnt find a suitable program in the topics I chose. I’ll try again by EOY, maybe new fields arise.]]></summary></entry><entry><title type="html">University of Amsterdam - UvA</title><link href="https://sergiorgiraldo.github.io/phd/2024/05/05/uni-amsterdam.html" rel="alternate" type="text/html" title="University of Amsterdam - UvA" /><published>2024-05-05T22:28:00+02:00</published><updated>2024-05-05T22:28:00+02:00</updated><id>https://sergiorgiraldo.github.io/phd/2024/05/05/uni-amsterdam</id><content type="html" xml:base="https://sergiorgiraldo.github.io/phd/2024/05/05/uni-amsterdam.html"><![CDATA[<p>I couldnt find a suitable program in the topics I chose. I’ll try again by EOY, maybe new fields arise.</p>]]></content><author><name>Sergio Giraldo</name></author><category term="unis" /><summary type="html"><![CDATA[I couldnt find a suitable program in the topics I chose. I’ll try again by EOY, maybe new fields arise.]]></summary></entry><entry><title type="html">Design Thinking Topics</title><link href="https://sergiorgiraldo.github.io/phd/2024/05/03/homedt.html" rel="alternate" type="text/html" title="Design Thinking Topics" /><published>2024-05-03T17:02:00+02:00</published><updated>2024-05-03T17:02:00+02:00</updated><id>https://sergiorgiraldo.github.io/phd/2024/05/03/homedt</id><content type="html" xml:base="https://sergiorgiraldo.github.io/phd/2024/05/03/homedt.html"><![CDATA[<h4 id="2024-05-08">2024-05-08</h4>

<ul>
Expand Down
87 changes: 87 additions & 0 deletions queryproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/usr/bin/python3

import subprocess
import json

# Execute the command-line command
command = """
gh api graphql -f query='
query{
node(id: "PVT_kwHOABF2LM4AhB76") {
... on ProjectV2 {
items(first: 20) {
nodes{
fieldValues(last: 5) {
nodes{
... on ProjectV2ItemFieldTextValue {
field {
... on ProjectV2FieldCommon {
name
}
}
}
... on ProjectV2ItemFieldDateValue {
field {
... on ProjectV2FieldCommon {
name
}
}
}
... on ProjectV2ItemFieldSingleSelectValue {
name
field {
... on ProjectV2FieldCommon {
name
}
}
}
}
}
content{
... on DraftIssue {
title
}
...on Issue {
title
}
}
}
}
}
}
}'
"""
result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

# Check if the command executed successfully
if result.returncode == 0:
# Decode the output from bytes to string
output = result.stdout.decode("utf-8")

# Parse the output as JSON
json_data = json.loads(output)

statuses = set()
status_counts = {}

items = (json_data["data"]["node"]["items"]["nodes"])
for item in items:
status = item["fieldValues"]["nodes"][-1]["name"]
statuses.add(status)

# Increment the count for the current status
status_counts[status] = status_counts.get(status, 0) + 1

# print(item["fieldValues"]["nodes"][-1]["name"])
# print("-")
# print((item["content"]["title"]))
# print("\n--------\n")

for status in statuses:
if status != "Done":
print(status, status_counts[status])

else:
# Handle command execution error
error_message = result.stderr.decode('utf-8')
print(f"Error: {error_message}")

0 comments on commit e0f533f

Please sign in to comment.