todays objective is total DSR automation. here we go!

This commit is contained in:
Charles N Wyble 2024-11-30 07:53:37 -06:00
parent 1af0c072b9
commit a57254f8aa
6 changed files with 115 additions and 27 deletions

View File

@ -1,3 +1,22 @@
# DailyStakeholderReport-Pipeline
Scripts I use to help gather data and publish my daily stakeholder report.
## Introduction
I publish a daily stakeholder report to the TSYS Group discourse every day. Up until 11/29 I was performing the publishing step manually.
On 11/29 I automated the process. I also begin work on automated gathering of data going into the new version of the report.
These scripts help me maintain a daily report and high fidelity information in the report for my stakeholderrs.
## Scripts
### Publishing the report
Publishing the report involves three steps:
1. Exporting the markdown from Joplin (and attachments) I am currently doing this manually (but see export-joplin-note for a chatgpt take on automating it.).
2. Creating a (formatted/styled) PDF from the exported markdown/attachments. See the script: **create-dsr.sh**.
3. Uploading the PDF to discourse and creating a new topic in the appropriate category. See the script: **publish-dsr.sh**
### Data Gathering
I am trying to fully instrument my CTO/founder life. See the **data-gathering** sub directory (and README located therein) for WIP on that.

16
create-dsr.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/bash
echo "Creating PDF of DSR from markdown input via pandoc..."
INPUT_FILE="./DSR-$(date +%m-%d-%Y).md"
OUTPUT_FILE="./DSR-$(date +%m-%d-%Y).pdf"
METADATA_FILE="daily-stakeholder-report.yml"
TEMPLATE="eisvogel"
pandoc \
$INPUT_FILE \
--template $TEMPLATE \
--metadata-file=$METADATA_FILE \
--from markdown \
--to=pdf \
--output $OUTPUT_FILE

19
data-gathering/README.md Normal file
View File

@ -0,0 +1,19 @@
# Data Gathering for the @ReachableCEO daily stakeholder report
## Introduction
I'm trying to life a fully instrumented CTO/founder life and #buildInPublic. And unlike most of the founders doing so, I'm actually publishing daily reports and live streaming my workstation all dya.
I want to automate the instrumentation/reporting process as much as possible to get the highest fidelity information for stakeholders consumption.
## Data sources
- Apple Health (exporting via AutoHealthExport)
- Workout (evaluating a cou
- Nutrition
- Daily habit tracking
- ActivityWatch
- WakaAPI
## Scripts

59
export-joplin-note.sh Normal file
View File

@ -0,0 +1,59 @@
#!/bin/bash
# Functions
# Search for a note by title and return its ID
search_note() {
local title="$1"
echo "Searching for note with title: $title"
note_id=$(joplin search "$title" --fields id --limit 1 --json | jq -r '.[0].id')
if [[ -z "$note_id" || "$note_id" == "null" ]]; then
echo "Error: Note with title '$title' not found."
exit 1
fi
echo "Found note with ID: $note_id"
echo "$note_id"
}
# Export the note by ID to the specified directory
export_note() {
local note_id="$1"
local output_dir="$2"
echo "Exporting note ID: $note_id to directory: $output_dir"
mkdir -p "$output_dir" || {
echo "Error: Unable to create directory $output_dir"
exit 1
}
# Export the note with attachments to the specified directory
joplin export "$note_id" --format md --output "$output_dir" || {
echo "Error: Failed to export note ID $note_id"
exit 1
}
echo "Note exported successfully to $output_dir"
}
# Main function
main() {
if [[ $# -lt 2 ]]; then
echo "Usage: $0 <note-title> <output-directory>"
exit 1
fi
local note_title="$1"
local output_dir="$2"
# Search for the note and get its ID
local note_id
note_id=$(search_note "$note_title")
# Export the note
export_note "$note_id" "$output_dir"
}
# Run the main function with all script arguments
main "$@"

View File

@ -1,5 +1,6 @@
#!/bin/bash
secrets_manager()
{
@ -36,25 +37,6 @@ export DISCOURSE_APIKEY="$(bw get password APIKEY-discourse)"
}
generate_dsr()
{
echo "Creating PDF of DSR from markdown input via pandoc..."
INPUT_FILE="./DSR-$(date +%m-%d-%Y).md"
OUTPUT_FILE="./DSR-$(date +%m-%d-%Y).pdf"
METADATA_FILE="daily-stakeholder-report.yml"
TEMPLATE="eisvogel"
pandoc \
$INPUT_FILE \
--template $TEMPLATE \
--metadata-file=$METADATA_FILE \
--from markdown \
--to=pdf \
--output $OUTPUT_FILE
}
post_dsr()
{
@ -136,15 +118,8 @@ else
echo "$post_response"
exit 1
fi
}
#Create PDF from joplin exported markdown
generate_dsr
#Get discourse api key
secrets_manager