Skip to content

CSV datamapping - #1576

Draft
danielpeintner wants to merge 10 commits into
masterfrom
glc-datamapping
Draft

danielpeintner wants to merge 10 commits into
masterfrom
glc-datamapping

Conversation

@danielpeintner

Copy link
Copy Markdown
Member

No description provided.

Comment thread .gitignore Resolved

@danielpeintner danielpeintner left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some early comments

Comment thread packages/core/src/content-serdes.ts Resolved
Comment thread packages/core/src/interaction-output.ts Outdated
Comment on lines +139 to +141
ContentSerdes.getMediaType(this.#content.type) === "text/csv"
? csvBindingOptionsFromForm(this.form as unknown as Record<string, unknown>)
: undefined;

@danielpeintner danielpeintner Oct 1, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we can find a more generic approach that works beyond text/csv ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I’ll remove the text/csv check and pass the decoding context through for every media type. CsvCodec will extract and validate its own form settings, keeping format-specific handling out of InteractionOutput.

Comment thread packages/core/src/content-serdes.ts Resolved
@danielpeintner

Copy link
Copy Markdown
Member Author

@wiresio I think this is an excellent start and proof of concept for CSV data handling. 👍

Some points

  • Not sure whether we want to merge it now or keep it in this PR/branch until the discussion in the TD has settled
  • The CI coding style check fails. Maybe you can take a look
  • You may want to add "CSV" to MediaType Support

@egekorkan @relu91 any comment?

Comment thread examples/datamapping/storm-data.td.json Outdated
"@context": [
"https://www.w3.org/2019/wot/td/v1",
{
"csvv": "https://www.w3.org/wot/payload-binding/csv/v1#",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not use real looking URLs here. example.org etc would be less misleading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be better to format the TDs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a URI scheme and the hrefs are relative. file:// should be used instead (seeing the client code)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used this in the client code:

// Set the base URL for the data directory instead of writing "file://" with full path to the href directly
thingDescription.base = dataDirectory;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about the level of this code. Shouldn't it be more in the codecs somehow? We cannot have a new binding in this level all the time I think?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielpeintner what do you think?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @egekorkan is right. It belongs to the codecs.

Some more toughts:

  • Currently we have the situation that most (not all) codecs are in the core. Do we want to have this in the core or should it be somewhere else?
  • Maybe another remark about the naming. The file currently reads csv-binding. Binding might be misleading. What do you think?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could

  • move csv-binding.ts to packages/core/src/codecs/csv-options.ts
  • rename CsvBindingOptions to CsvCodecOptions

That keeps the parsing separate from the codec implementation without suggesting a new binding layer.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it would be good to make one Thing file based and the other one HTTP? HTTP would serve the csv file over an endpoint and some uri variables can be used for date time filtering? Still csv response though

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can create a mock InfluxDB server and then a corresponding client. Maybe also a nice task for the plugfest.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be good to test this for other protocols and media types as well

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently only user story 2 with CSV is tested. More to come during the plugfest :-)

@relu91

relu91 commented Oct 16, 2026

Copy link
Copy Markdown
Member

We discussed in the committer call and resolved that this is an experiment. Therefore, we converted this PR to a draft.

@relu91
relu91 marked this pull request as draft October 16, 2026 08:40
@wiresio

wiresio commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

@wiresio I think this is an excellent start and proof of concept for CSV data handling. 👍

Some points

  • Not sure whether we want to merge it now or keep it in this PR/branch until the discussion in the TD has settled
  • The CI coding style check fails. Maybe you can take a look
  • You may want to add "CSV" to MediaType Support

@egekorkan @relu91 any comment?

Let's keep it on this PR draft for the moment. Will fix coding style and add "CSV" (as experimental).

Comment thread packages/core/src/codecs/csv-options.ts Resolved
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