Skip to content

Add Kaleido-CSV-Importer feature - #2090

Merged
MAKOMO merged 7 commits into
artisan-roaster-scope:masterfrom
Terracotta-6:csv-import-kaleido
Jan 7, 2026
Merged

MAKOMO merged 7 commits into
artisan-roaster-scope:masterfrom
Terracotta-6:csv-import-kaleido

Conversation

@Terracotta-6

Copy link
Copy Markdown
Contributor

Added an import tool for Kaleido format CSV files, file path: src/artisanlib/kaleido_csv_importer.py.

@AppVeyorBot

Copy link
Copy Markdown

Build artisan 8774178 (1779) failed (commit 87741784eb by @lxk36)

@MAKOMO

MAKOMO commented Jan 6, 2026

Copy link
Copy Markdown
Member

Thanks for this!

Could you please rework this a little?

  • remove the test change in the README.md
  • translate all comments to english
  • add test Kaleido csv files under src/test/sanity/data/kaleido/

I will then take it from there

@MAKOMO

MAKOMO commented Jan 6, 2026

Copy link
Copy Markdown
Member

It might also be a good idea to merge this code into src/artisanlib/kaleido.py instead of keeping this in a separate file not to have too many machine specific parts

@Terracotta-6

Copy link
Copy Markdown
Contributor Author

It might also be a good idea to merge this code into src/artisanlib/kaleido.py instead of keeping this in a separate file not to have too many machine specific parts
That’s a great idea! Merging the code into src/artisanlib/kaleido.py would help keep things organized and reduce fragmentation across machine-specific files. It’ll also make maintenance and future updates much easier.
The sampling cycle of the Kaleido industrial control screen is 1.5 seconds, and the ROR (Rate of Rise) is calculated based on C/30s. However, I suspect there might be an error in the ROR conversion. Could you please help verify it?

@Terracotta-6

Copy link
Copy Markdown
Contributor Author

Thanks for this!

Could you please rework this a little?

  • remove the test change in the README.md
  • translate all comments to english
  • add test Kaleido csv files under src/test/sanity/data/kaleido/

I will then take it from there

I’ve already made the requested changes:

Removed the test change from README.md
Translated all comments to English
Added the test Kaleido CSV files under src/test/sanity/data/kaleido/
Feel free to take it from here!

@AppVeyorBot

Copy link
Copy Markdown

@MAKOMO

MAKOMO commented Jan 6, 2026

Copy link
Copy Markdown
Member

Thanks! The test files are still missing. Please add them.

@AppVeyorBot

Copy link
Copy Markdown

@MAKOMO

MAKOMO commented Jan 7, 2026

Copy link
Copy Markdown
Member

Thanks, I take it from here!

@MAKOMO
MAKOMO merged commit 57b1a34 into artisan-roaster-scope:master Jan 7, 2026
1 check was pending
@Terracotta-6
Terracotta-6 deleted the csv-import-kaleido branch January 7, 2026 09:52
@Terracotta-6
Terracotta-6 restored the csv-import-kaleido branch January 7, 2026 22:29
@Terracotta-6

Copy link
Copy Markdown
Contributor Author

Grateful to the Artisan team for merging PR #2090 (Kaleido CSV Importer). Thanks for the great collaboration!

@MAKOMO

MAKOMO commented Jan 8, 2026

Copy link
Copy Markdown
Member

Please test this carefully and report if there are further changes needed. Thanks for your contribution!

@Terracotta-6

Copy link
Copy Markdown
Contributor Author

Please test this carefully and report if there are further changes needed. Thanks for your contribution!

A big thank you to MAKOMO for the dedicated work on this feature! I will run careful and comprehensive tests, and meanwhile, I’ll notify both the official Kaleido team and our large user group to join the collaborative testing process.

@Terracotta-6

Copy link
Copy Markdown
Contributor Author

official Kaleido CSV test samples Import error Value Error: Import Kaleido CSV: 'utf-8' codec can't decode byte Oxce in position 136: invalid continuation byte

@MAKOMO

MAKOMO commented Jan 9, 2026

Copy link
Copy Markdown
Member

Where to find those official Kaleido CSV test samples?

@Terracotta-6

Copy link
Copy Markdown
Contributor Author

Where to find those official Kaleido CSV test samples?

Ask the Kaleido official for it

@MAKOMO

MAKOMO commented Jan 9, 2026

Copy link
Copy Markdown
Member

I have no contact to Kaleido official. Sorry.

@Terracotta-6

Copy link
Copy Markdown
Contributor Author

I have no contact to Kaleido official. Sorry.

No worries at all! I have direct contact with the official Kaleido team. I can provide the latest official sample files, format specifications, and share test results to assist with adapting the feature. Feel free to let me know if any further details are needed!

@MAKOMO

MAKOMO commented Jan 9, 2026

Copy link
Copy Markdown
Member

In the best case you can provide the failing test files, or at least one of them if the issue is the same in those. Alternatively I need detailed debug logs and the back and forth might cost quite some resources on my and your side. Is there anything criticial such that CSV text files of some sample roasts can not be shared?

@Terracotta-6

Copy link
Copy Markdown
Contributor Author

PR Summary: Fix Chinese Character Encoding Issue in Kaleido CSV Import

Problem Description
When importing Kaleido CSV files containing Chinese characters, an error occurred: Import Kaleido CSV: 'utf-8' codec
can't decode byte 0xb6 in position 134: invalid start byte, causing Chinese characters to display as gibberish.

Changes Made

  1. Multi-encoding Support
    Modified the file reading logic to support multiple encodings instead of using UTF-8 only:
  • Original code: with open(file, encoding='utf-8') as f:
  • New code: Try encodings in sequence ['utf-8', 'gbk', 'gb2312', 'latin-1'], fallback to UTF-8 with error ignoring
    if all fail
  1. Chinese Character Encoding Conversion
    Apply encoding conversion to the Comment section using the encodeLocalStrict function:
  • Original code: Direct assignment res['title'] = comment
  • New code: Encoding conversion with encodeLocalStrict(comment_raw) before assignment
  1. Event String Encoding Processing
    Apply encoding conversion to special event strings as well:
  • Original code: specialeventsStrings.append(f'SM={int(sm)}%')
  • New code: specialeventsStrings.append(encodeLocalStrict(f'SM={int(sm)}%'))
  1. Code Cleanup
    Removed duplicate encodeLocalStrict import statement to keep the code clean.

Resolution Effects

  • Resolves encoding errors when importing Kaleido CSV files containing Chinese characters
  • Ensures Chinese characters in Comment fields display correctly
  • Ensures Chinese characters in event descriptions display correctly
  • Maintains backward compatibility without affecting files with English characters

✦ Technical Details

  • Preserved the original from artisanlib.util import encodeLocalStrict import
  • Used Artisan's internal encoding conversion function to handle multi-byte characters
  • Implemented progressive encoding trial strategy to improve file compatibility

@MAKOMO

MAKOMO commented Jan 9, 2026

Copy link
Copy Markdown
Member

Sounds ok, but please use a separate PR against the current trunk!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants