track claude skills in pijul

tests for utils/mapping.go

mark certainty=0 for  
Check                │ rqwTDv3Op63k
Don't Know           │ e-bBi7tasfya
Question             │ lR6WEIWL5CUE

mark certainty = 100 for
  │ Fake Kiwi            │ -6ghUwAPNQ2J │
  │ Haast Tokoeka        │ ANhV8iZPfIh8 │
  │ Kiwi                 │ 7LNNjRcptMev │
  │ Korero Gecko         │ YPFfCCNvDuuK │
  │ Rowi                 │ fDGmXv9c6xEn │
  │ S. Fiordland Tokoeka │ jqEQrViqRFFX │

mark all call types 100 certain

check bulk import gets stdout, stderr right
(base) skraak ➤ ./skraak import bulk --db ./db/skraak.duckdb --dataset la-JpAf2nLKG --csv "/media/david/Misc-2/Manu o Kahurangi kiwi survey (10)/NEW - MOK kiwi survey 20260306/import.csv" --log "/media/david/Misc-2/Manu o Kahurangi kiwi survey (10)/NEW - MOK kiwi survey 20260306/bulk_import.log"
Starting bulk import...
  Database: ./db/skraak.duckdb
  Dataset:  la-JpAf2nLKG
  CSV:      /media/david/Misc-2/Manu o Kahurangi kiwi survey (10)/NEW - MOK kiwi survey 20260306/import.csv
  Log:      /media/david/Misc-2/Manu o Kahurangi kiwi survey (10)/NEW - MOK kiwi survey 20260306/bulk_import.log

Monitor progress: tail -f /media/david/Misc-2/Manu o Kahurangi kiwi survey (10)/NEW - MOK kiwi survey 20260306/bulk_import.log

{
  "total_locations": 39,
  "clusters_created": 39,
  "clusters_existing": 0,
  "total_files_scanned": 24590,
  "files_imported": 24583,
  "files_duplicate": 1,
  "files_error": 6,
  "processing_time": "1h49m40.555152942s"
}


segment unstructured import into batches of 10000 files to keep within buffer limits, structured imports should be fine as we are talking 1 sd card (24/7 its 16000 max)

FIX wav/WAV case in from preds tool, again

ingest my training datasets 

buy a drive to backup mac ~

include skraak metadata in written .data files at the end of relevant section BUT ONLY on insert to db at end, final review.
file level metadata: skraak_dataset_id, skraak_location_id, skraak_cluster_id, skraak_file_id, skraak_file_hash
label level metadata: skraak_segment_id, skraak_label_id

Update tools could allow setting active to false??
look at nulls in schema, problem with updatde tool

Edit selection tool to change start end. Frameing 

Make import avianz, add skraak metadata
Where do I add skraak metadata 

Make freebird to .data tool

Clip from .data file
clip from tui
clips from folder



##### NEED TO MERGE LABELS ###################
SELECT id, label, ebird_code, description, active
  FROM species
  WHERE ebird_code IN ('lotkoe1', 'liskiw1', 'grskiw1', 'okbkiw1', 'sobkiw1', 'nibkiw1');
┌──────────────┬──────────────────────┬────────────┬───────────────────────────────────────────────┬─────────┐
│      id      │        label         │ ebird_code │                  description                  │ active  │
│   varchar    │       varchar        │  varchar   │                    varchar                    │ boolean │
├──────────────┼──────────────────────┼────────────┼───────────────────────────────────────────────┼─────────┤
│ CNi9X-Hkz4-A │ Kiwi_Brown           │ sobkiw1    │ FreebirdCode: 109,  BiowebCode: 10857,  Com…  │ false   │
│ D_pepf6f08kn │ Kiwi_Great_Spotted   │ grskiw1    │ FreebirdCode: 110,  BiowebCode: 10860,  Com…  │ false   │
│ di-jxVg8tcVO │ Kiwi_Little_Spotted  │ liskiw1    │ FreebirdCode: 111,  BiowebCode: 10859,  Com…  │ false   │
│ dZLV3Ue916E- │ Kiwi_Nth_Is_Brown    │ nibkiw1    │ FreebirdCode: 112,  BiowebCode: 10856,  Com…  │ false   │
│ 74yg7hquUKT9 │ Kiwi_Okarito_Brown   │ okbkiw1    │ FreebirdCode: 113,  BiowebCode: 13151,  Com…  │ false   │
│ ac0AgauTMvMT │ Kiwi_spp             │ sobkiw1    │ FreebirdCode: 114,  BiowebCode: 29709,  Com…  │ false   │
│ 4JOC8g7OsLGW │ Cuckoo_long-tailed   │ lotkoe1    │ FreebirdCode: 35,  BiowebCode: 11248, Long-…  │ false   │
│ rqIcB4EkSy2G │ Long-tailed Koel     │ lotkoe1    │ NULL                                          │ true    │
│ eYZ6Ns7XNbwR │ Kiwi pukupuku        │ liskiw1    │ Kiwi pukupuku / Little Spotted Kiwi           │ true    │
│ TSwVuQdE0cEA │ Roroa                │ grskiw1    │ Roroa / Great Spotted Kiwi                    │ true    │
│ fDGmXv9c6xEn │ Rowi                 │ okbkiw1    │ Rowi / Okarito Brown Kiwi                     │ true    │
│ jqEQrViqRFFX │ S. Fiordland Tokoeka │ sobkiw1    │ Southern Fiordland Tokoeka                    │ true    │
│ ANhV8iZPfIh8 │ Haast Tokoeka        │ sobkiw1    │ NULL                                          │ true    │
│ 7LNNjRcptMev │ Kiwi                 │ nibkiw1    │ Kiwi-nui / North Island Brown Kiwi            │ true    │
├──────────────┴──────────────────────┴────────────┴───────────────────────────────────────────────┴─────────┤
│ 14 rows                                                                                          5 columns │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────┘


on the duckdb cli How can i append this description
│ dZLV3Ue916E- │ Kiwi_Nth_Is_Brown    │ nibkiw1    │ FreebirdCode: 112,  BiowebCode: 10856,  Com…  │ false   │
to the following, and also overwrite the Kiwi label with Kiwi_Nth_Is_Brown
7LNNjRcptMev │ Kiwi                 │ nibkiw1    │ Kiwi-nui / North Island Brown Kiwi            │ true
then delete dZLV3Ue916E-
# Does not work.
UPDATE species
SET
    label = 'Kiwi_Nth_Is_Brown',
    description = description || ', ' || (
        SELECT description
        FROM species
        WHERE id = 'dZLV3Ue916E-'
    )
WHERE id = '7LNNjRcptMev';
DELETE FROM my_table
WHERE id = 'dZLV3Ue916E-';





time ./skraak calls from-preds --csv /media/david/SSD4/Twenty_Four_Seven/R620/2024-05-06/preds9_opensoundscape-multi-1.0_2025-07-22.csv > /media/david/SSD4/Twenty_Four_Seven/R620/2024-05-06/preds9_opensoundscape-multi-1.0_2025-07-22.json

file,start_time,end_time,ausbit1,bluduc1,comcha,comred,dunnoc1,eurbla,eursta,fernbi1,grskiw1,gryger1,kea1,liskiw1,lotkoe1,morepo2,nezbel1,nezfan1,nezkak1,nezpig2,nezrob3,nibkiw1,okbkiw1,parake,pipipi1,riflem1,shbcuc1,silver3,sobkiw2,soioys1,soiwre1,sonthr1,spocra2,tomtit1,tui1,varoys1,weka1,yellow2,weta,saddle3

ausbit1       Australasian Bittern
bluduc1       Blue Duck                                                              
comcha        Common Chaffinch
comred        Redpoll (Common)
dunnoc1       Dunnock
eurbla        Eurasian Blackbird
eursta        European Starling
fernbi1       New Zealand Fernbird
grskiw1       Great Spotted Kiwi
gryger1       Gray Gerygone
kea1          Kea
liskiw1       Little Spotted Kiwi                                                    
lotkoe1       Long-tailed Koel                                                       
morepo2       Morepork
nezbel1       New Zealand Bellbird
nezfan1       New Zealand Fantail
nezkak1       New Zealand Kaka
nezpig2       New Zealand Pigeon                                                     
nezrob3       South Island Robin
nibkiw1       North Island Brown Kiwi
okbkiw1       Okarito Brown Kiwi
parake        parakeet sp.                                                           
pipipi1       Pipipi
riflem1       Rifleman
saddle3       South Island Saddleback
shbcuc1       Shining Bronze-Cuckoo
silver3       Silvereye
sobkiw2       Southern Brown Kiwi (South I.)
soioys1       South Island Oystercatcher
soiwre1       South Island Wren
sonthr1       Song Thrush
spocra2       Spotless Crake
tomtit1       Tomtit
tui1          Tui
varoys1       Variable Oystercatcher                                                 
weka1         Weka
yellow2       Yellowhammer
weta


bluduc1       Duck_Blue_Whio  Blue Duck
comcha        Chaffinch       Common Chaffinch
dunnoc1       Dunnock_Hedge_Sparrow   Dunnock
fernbi1       Fernbird        New Zealand Fernbird
fernbi1       Fernbird_Nth Is New Zealand Fernbird
fernbi1       Fernbird_Sth Is New Zealand Fernbird                                   
grskiw1       Kiwi_Great_Spotted      Great Spotted Kiwi
grskiw1       Roroa   Great Spotted Kiwi
gryger1       Warbler_Grey    Gray Gerygone
kea1  Kea     Kea
liskiw1       Kiwi pukupuku   Little Spotted Kiwi
liskiw1       Kiwi_Little_Spotted     Little Spotted Kiwi                            
lotkoe1       Cuckoo_long-tailed      Long-tailed Koel
lotkoe1       Long-tailed Koel        Long-tailed Koel                               
morepo2       Morepork        Morepork                                               
nezbel1       Bellbird        New Zealand Bellbird
nezbel1       Bellbird_Poor_Knights   New Zealand Bellbird                           
nezbel1       Bellbird_Three_Kings    New Zealand Bellbird
nezfan1       Fantail New Zealand Fantail
nezfan1       Fantail_Chatham_Is      New Zealand Fantail
nezfan1       Fantail_Nth_Is  New Zealand Fantail
nezfan1       Fantail_Sth_Is  New Zealand Fantail                                    
nezkak1       Kaka    New Zealand Kaka
nezrob3       Robin_Stewart_Is        South Island Robin
nezrob3       Robin_Sth_Is    South Island Robin
nibkiw1       Kiwi    North Island Brown Kiwi                                        
nibkiw1       Kiwi_Nth_Is_Brown       North Island Brown Kiwi
okbkiw1       Kiwi_Okarito_Brown      Okarito Brown Kiwi                             
okbkiw1       Rowi    Okarito Brown Kiwi
riflem1       Rifleman        Rifleman
riflem1       Rifleman_Nth_Is Rifleman                                               
riflem1       Rifleman_Sth_Is Rifleman                                               
saddle3       Saddleback_Sth_Is       South Island Saddleback                        
shbcuc1       Cuckoo_Shining  Shining Bronze-Cuckoo
silver3       Silvereye       Silvereye
sobkiw2       Kiwi_Tokoeka_Haast      Southern Brown Kiwi (South I.)                 
sonthr1       Thrush_Song     Song Thrush                                            
spocra2       Crake_Spotless  Spotless Crake
tomtit1       Tomtit  Tomtit
tomtit1       Tomtit_Auckland_Is      Tomtit
tomtit1       Tomtit_Chatham_Is       Tomtit
tomtit1       Tomtit_Nth_Is   Tomtit
tomtit1       Tomtit_Snares_Is_Black  Tomtit
tomtit1       Tomtit_Sth_Is   Tomtit                                                 
tui1  Tui     Tui
tui1  Tui_Chatham_Is  Tui
varoys1       Oystercatcher_Variable  Variable Oystercatcher
weka1 Weka_Buff       Weka
weka1 Weka_Nth_Is     Weka
weka1 Weka_Stewart_Is Weka
weka1 Weka_Western    Weka
weka1 Weka_spp        Weka                                                           
yellow2       Yellowhammer    Yellowhammer

#######################################
Not in species table: ausbit1, comred, eurbla, eursta, nezpig2, parake, pipipi1, soioys1, soiwre1, weta




for item in a
    try
        jsonfile = replace(item, ".csv" => ".json")
        run(pipeline(`skraak calls from-preds --csv $item`, jsonfile))
    catch e
        @error "skraak failed on $item" exception=(e, catch_backtrace())
    end
end

model = "/media/david/SSD2/Secondary_Models/DFMN_Inge/model_DFMN1-5_CPU_epoch-9-0.9737-2024-10-25.jld2"
labels = Dict(1 => "Duet", 2 => "Female", 3 => "Male", 4 => "Don't Know")
predict(a, model, labels)


model = "/media/david/SSD2/Secondary_Models/LSK/model_GSK_LSK_DFM_FT_IngeDFMN_1-5_1-0_CPU_epoch-9-0.9745-2025-01-13.jld2"
labels = Dict(1 => "GSK", 2 => "GSK", 3 => "GSK", 4 => "LSK", 5 => "LSK", 6 => "LSK")
## Needed to change the logic
predict(a, model, labels)

skraak calls summarise --folder .

for item in a
    try
        jsonfile = "$item/segment_summary_2026-03-13.json"
        run(pipeline(`skraak calls summarise --folder $item`, jsonfile))
    catch e
        @error "skraak failed on $item" exception=(e, catch_backtrace())
    end
end

skraak calls summarise --folder ./recordings | jq 'del(.segments)'

for item in a
       try
           run(pipeline(`skraak calls summarise --folder $item`, `jq 'del(.segments)'`))
       catch e
           @error "skraak failed on $item" exception=(e, catch_backtrace())
       end
   end

open("summary_2026-03-13.jsonl", "w") do f
       for item in a
           try
               run(pipeline(`skraak calls summarise --folder $item`, `jq 'del(.segments)'`, f))
           catch e
               @error "skraak failed on $item" exception=(e, catch_backtrace())
           end
       end
   end



#compile for windows
Prerequisites:
- sudo apt install gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64
- MinGW set to posix variant:
sudo update-alternatives --set x86_64-w64-mingw32-gcc
/usr/bin/x86_64-w64-mingw32-gcc-posix
sudo update-alternatives --set x86_64-w64-mingw32-g++
/usr/bin/x86_64-w64-mingw32-g++-posix

echo 'extern "C" { void* _ZNSt15basic_streambufIcSt11char_traitsIcEE7seekposESt4fposI9_MbstatetESt13_Ios_Openmode() { return (void*)-1; } }' | tee /tmp/stub_seekpos.cpp

x86_64-w64-mingw32-g++ -c /tmp/stub_seekpos.cpp -o /tmp/stub_seekpos.o && \
CGO_ENABLED=1 \
CC=x86_64-w64-mingw32-gcc \
CXX=x86_64-w64-mingw32-g++ \
GOOS=windows GOARCH=amd64 \
go build -ldflags '-extldflags "/tmp/stub_seekpos.o -lucrt"' -o skraak.exe


Manually classify calls
./skraak calls classify --folder "/media/david/SSD4/Manu o Kahurangi kiwi survey (10)/NEW - MOK kiwi survey 20260306/tx51" \
  --reviewer David \
  --bind k=GSK \
  --bind d="GSK+Duet" \
  --bind f="GSK+Female" \
  --bind m="GSK+Male" \
  --bind n="Don't Know" \
  --bind p=Morepork \
  --bind w=Weka \
  --color

./skraak calls summarise --folder "/media/david/SSD4/Manu o Kahurangi kiwi survey (10)/NEW - MOK kiwi survey 20260306/tx51" > "/media/david/SSD4/Manu o Kahurangi kiwi survey (10)/NEW - MOK kiwi survey 20260306/tx51/summary_2026-03-15.json"

claude Skill(skraak-data-mapping): please help me make an import mapping for "/media/david/SSD4/Manu o Kahurangi kiwi survey (10)/NEW - MOK kiwi survey 20260306/tx51/"

./skraak import segments \
  --db ./db/test.duckdb \
  --dataset dataset_id \
  --location location_id \
  --cluster cluster_id \
  --folder "/media/david/SSD4/Manu o Kahurangi kiwi survey (10)/NEW - MOK kiwi survey 20260306/tx51" \
  --mapping "/media/david/SSD4/Manu o Kahurangi kiwi survey (10)/NEW - MOK kiwi survey 20260306/tx51/mapping_2026-03-15.json"

claude: please fill out the preceeding command to import data into test.duckdb. I need dataset id, location id, cluster id for the file path already filled in. use the skraak cli on test.duckdb to get this data

./skraak import segments \
    --db ./db/test.duckdb \
    --dataset la-JpAf2nLKG \
    --location lrTAO7rA7CIm \
    --cluster 2x2VZ5yNKQwA \
    --folder "/media/david/SSD4/Manu o Kahurangi kiwi survey (10)/NEW - MOK kiwi survey 20260306/tx51" \
    --mapping "/media/david/SSD4/Manu o Kahurangi kiwi survey (10)/NEW - MOK kiwi survey 20260306/tx51/mapping_2026-03-15.json"