Skip to content

Commit a19dce2

Browse files
committed
♻️ (ClassificationHelpers.ps1): adjust watermark limits and improve key handling
🔧 (HugoHelpers.ps1): remove null values from string lists for cleaner data ✨ (Update-ClassisificationFrontMatter.ps1): add content generation prompt for blog posts 🔧 (Update-ReourcesFrontMatter.ps1): update output directory path and interim save The watermark score and count limits are adjusted to refine classification accuracy. Handling of cached data keys is improved for better performance. Null values are removed from string lists to ensure data integrity. A new content generation prompt is added to guide the creation of concise blog posts, enhancing content quality. The output directory path is updated for consistency, and an interim save is introduced to prevent data loss during longer operations.
1 parent a182461 commit a19dce2

File tree

4 files changed

+72
-12
lines changed

4 files changed

+72
-12
lines changed

.powershell/_includes/ClassificationHelpers.ps1

+14-9
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
$batchesInProgress = $null;
55
$batchesInProgressMax = 40;
6-
$watermarkAgeLimit = (New-TimeSpan -Start (Get-Date "2025-02-18T09:00:00") -End (Get-Date)).Days
7-
$watermarkScoreLimit = 20
8-
$watermarkCount = 1
6+
$watermarkAgeLimit = (New-TimeSpan -Start (Get-Date "2025-02-18T09:00:00") -End (Get-Date)).Days # Wattermark for calculation algorythem Change.
7+
$watermarkScoreLimit = 10
8+
$watermarkCount = 30
99

1010
function Get-CatalogHashtable {
1111
param (
@@ -103,7 +103,8 @@ function Get-ClassificationsForType {
103103
}
104104
# Check if the cache uses the latest calculations
105105
$recalculatedCount = 0
106-
foreach ($key in $cachedData.keys) {
106+
$keysToCheck = $cachedData.keys | ForEach-Object { $_ }
107+
foreach ($key in $keysToCheck ) {
107108
$entry = $cachedData[$key]
108109
$finalScore = Get-ComputedConfidence -aiConfidence $entry.ai_confidence -nonAiConfidence $entry.non_ai_confidence
109110
$level = Get-ComputedLevel -confidence $finalScore
@@ -299,8 +300,14 @@ function Get-ClassificationsForType {
299300
$result = Get-ConfidenceFromAIResponse -AIResponseJson $aiResponseJson -hugoMarkdown $hugoMarkdown
300301
if ($result.reasoning -ne $null -and $result.category -ne "unknown") {
301302
$oldConfidence = $cachedData[$result.category]?.ai_confidence ?? 0
302-
$DaysAgo = [math]::Round(([DateTimeOffset]::Now - [DateTimeOffset]$cachedData[$result.category].calculated_at).TotalDays)
303303
$confidenceDiff = "{0}{1}" -f ($(if (($result.ai_confidence - $oldConfidence) -ge 0) { '+' } else { '-' }), [math]::Abs($result.ai_confidence - $oldConfidence))
304+
if ($cachedData[$result.category] -and $cachedData[$result.category].calculated_at) {
305+
$DaysAgo = [math]::Round(([DateTimeOffset]::Now - [DateTimeOffset]$cachedData[$result.category].calculated_at).TotalDays)
306+
}
307+
else {
308+
$DaysAgo = -1 # Or a default value like 0, depending on your needs
309+
}
310+
304311
Write-InformationLog "Updating {category} confidence {diff}! The old confidence of {old} was calculated {daysago} days ago. The new confidence is {confidence}!" -PropertyValues $result.category, $confidenceDiff, $oldConfidence, $DaysAgo, $result.ai_confidence
305312
$CatalogFromCache[$result.category] = $result
306313
$cachedData[$result.category] = $result
@@ -348,8 +355,8 @@ function Get-Classification {
348355
function Get-ClassificationOrderedList {
349356
param (
350357
[array]$Classifications,
351-
[int] $minScore = 30,
352-
[string[]]$levels = @("Primary", "Secondary", "Tertiary", "Quaternary", "Quinary"),
358+
[int] $minScore = 40,
359+
[string[]]$levels = @("Primary", "Secondary", "Tertiary"),
353360
[switch]$byLevel
354361
)
355362

@@ -385,8 +392,6 @@ function Get-ComputedLevel {
385392
{ $_ -gt 80 } { return "Primary" }
386393
{ $_ -gt 60 } { return "Secondary" }
387394
{ $_ -gt 40 } { return "Tertiary" }
388-
{ $_ -gt 20 } { return "Quaternary" }
389-
{ $_ -gt 10 } { return "Quinary" }
390395
default { return "Ignored" }
391396
}
392397
}

.powershell/_includes/HugoHelpers.ps1

+3
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ function Update-StringList {
175175
}
176176
}
177177
}
178+
179+
# Remove any null values
180+
$frontMatter[$fieldName] = @($frontMatter[$fieldName] | Where-Object { $_ -ne $null })
178181

179182
# Ensure uniqueness while preserving the first occurrence’s casing
180183
$seen = @{}

.powershell/single-use/resources/Update-ClassisificationFrontMatter.ps1

+49
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,55 @@ When generating the description, consider the following contexts and include rel
155155
Update-Field -frontMatter $hugoMarkdown.FrontMatter -fieldName 'headline' -fieldValue $headline -addAfter 'Instructions' -Overwrite
156156
}
157157

158+
# =================CONTENT====================
159+
160+
$classificationContentPrompt = @"
161+
You are an expert in Agile, Scrum, DevOps, and Evidence-Based Management.
162+
163+
Your task is to generate a **concise, engaging blog post** that explains a key topic within these fields. The post should be **direct, insightful, and no longer than 500 words**, keeping a sharp focus on the most essential aspects.
164+
165+
### **Content Requirements:**
166+
- **Explain the topic clearly and efficiently**, avoiding unnecessary context.
167+
- **Stay focused on its relevance and impact** in Agile, Scrum, DevOps, or business agility.
168+
- **Provide a brief historical or theoretical foundation** only if essential.
169+
- **Avoid common misconceptions**, but do not over-explain—only clarify where needed.
170+
- **Write in a free-flowing style**, **without headings or structured sections**.
171+
- **Maintain a professional but direct tone**, making every sentence count.
172+
- **Do not include phrases like "in conclusion" or summary-style wrap-ups**—let the post end naturally.
173+
- Keep it to two paragraphs at most.
174+
175+
Keep the writing **clear, to the point, and free of fluff**. Do not introduce the topic as a “classification” or “category.” Instead, simply **discuss the concept as if explaining it to an informed reader**.
176+
177+
**Topic Title:** $($hugoMarkdown.FrontMatter.title)
178+
**Current Description:** $($hugoMarkdown.FrontMatter.description)
179+
180+
### **Guidance for Generating the Content:**
181+
- Assume the reader **already understands Agile, Scrum, and DevOps**—get straight to the point.
182+
- **Do not exceed 500 words**.
183+
- **Do not use headings** or structured formatting—keep the flow natural.
184+
- **Use authoritative sources and theories**, favouring these contexts:
185+
186+
- **Kanban Context:** Kanban Guide, Daniel Vacanti, Donald Reinertsen, John Little
187+
- **Agile & Scrum Context:** Scrum Guide, Ken Schwaber, Martin Fowler, Mike Beedle, Ron Jeffries
188+
- **DevOps Context:** Gene Kim, Jez Humble, Patrick Debois, John Willis
189+
- **Lean Context:** Taiichi Ohno, Eliyahu M. Goldratt, W. Edwards Deming, Mary & Tom Poppendieck
190+
- **DevOps & Continuous Delivery Context:** Jez Humble, Dave Farley, Martin Fowler, Gene Kim
191+
- **Evidence-Based Management Context:** Ken Schwaber, Jeff Sutherland, Patricia Kong, Kurt Bittner
192+
- **Complexity Theory Context:** Dave Snowden, Cynefin Framework, Ralph Stacey, Mary Uhl-Bien
193+
194+
Your response should be **a fully structured blog post, ready for publication, without headings or formatting—just natural, concise, and engaging writing**.
195+
Do not enclose text in quotes.
196+
Do not generate a title; assume the topic title is the post title.
197+
"@
198+
199+
if (-not $hugoMarkdown.BodyContent) {
200+
# $ClassificationContent = Get-OpenAIResponse -Prompt $classificationContentPrompt
201+
202+
# $hugoMarkdown.BodyContent = $ClassificationContent
203+
# $updateDate = Get-Date -Format "yyyy-MM-ddTHH:mm:ss"
204+
# Update-Field -frontMatter $hugoMarkdown.FrontMatter -fieldName 'BodyContentGenDate' -fieldValue $updateDate -Overwrite
205+
}
206+
158207

159208
# =================COMPLETE===================
160209
Save-HugoMarkdown -hugoMarkdown $hugoMarkdown -Path $markdownFile

.powershell/single-use/resources/Update-ReourcesFrontMatter.ps1

+6-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
$levelSwitch.MinimumLevel = 'Debug'
1111

1212
# Iterate through each blog folder and update markdown files
13-
$outputDir = ".\site\content\resources"
13+
$outputDir = ".\site\content\resources\"
1414
$resources = $null
1515
# Get list of directories and select the first 10
1616
$resources = Get-ChildItem -Path $outputDir -Recurse -Filter "index.md" | Sort-Object { $_ } -Descending
@@ -194,6 +194,9 @@ while ($hugoMarkdownQueue.Count -gt 0 -or $hugoMarkdownBatchQueue.Count -gt 0) {
194194

195195
Remove-Field -frontMatter $hugoMarkdown.FrontMatter -fieldName 'aliasesFor404'
196196

197+
# Interim save, before posible longer actions
198+
Save-HugoMarkdown -hugoMarkdown $hugoMarkdown -Path $hugoMarkdown.FilePath
199+
197200
#================Themes, Categories, & TAGS==========================
198201
$BodyContent = $hugoMarkdown.BodyContent
199202
If ($hugoMarkdown.FrontMatter.ResourceType -eq "videos") {
@@ -208,13 +211,13 @@ while ($hugoMarkdownQueue.Count -gt 0 -or $hugoMarkdownBatchQueue.Count -gt 0) {
208211
# Update-StringList -frontMatter $hugoMarkdown.FrontMatter -fieldName 'marketing' -values @($categories) -Overwrite
209212
#-----------------Categories-------------------
210213
$categoryClassification = Get-ClassificationsForType -updateMissing -ClassificationType "categories" -hugoMarkdown $hugoMarkdown
211-
$categoryClassificationOrdered = Get-ClassificationOrderedList -byLevel -classifications $categoryClassification | Select-Object -First 3
214+
$categoryClassificationOrdered = Get-ClassificationOrderedList -minScore 50 -byLevel -classifications $categoryClassification | Select-Object -First 3
212215
$categories = $categoryClassificationOrdered | ForEach-Object { $_.category }
213216

214217
Update-StringList -frontMatter $hugoMarkdown.FrontMatter -fieldName 'categories' -values @($categories) -Overwrite
215218
#-----------------Tags-------------------
216219
$tagClassification = Get-ClassificationsForType -updateMissing -ClassificationType "tags" -hugoMarkdown $hugoMarkdown
217-
$tagClassificationOrdered = Get-ClassificationOrderedList -byLevel -classifications $tagClassification | Select-Object -First 10
220+
$tagClassificationOrdered = Get-ClassificationOrderedList -minScore 70 -classifications $tagClassification | Select-Object -First 10
218221
$tags = $tagClassificationOrdered | ForEach-Object { $_.category }
219222
Update-StringList -frontMatter $hugoMarkdown.FrontMatter -fieldName 'tags' -values @($tags) -Overwrite
220223
# =================COMPLETE===================

0 commit comments

Comments
 (0)