Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Measurement converter #256

Open
TobiasNx opened this issue Sep 6, 2022 · 9 comments
Open

Measurement converter #256

TobiasNx opened this issue Sep 6, 2022 · 9 comments
Assignees
Labels
enhancement New feature or request

Comments

@TobiasNx
Copy link
Collaborator

TobiasNx commented Sep 6, 2022

In context of OERSI I need to transform ms into ISO 8601:2004-Format: https://www.iso.org/standard/40874.html

83941 -> 01M24S (if I am not mistaken)

Is there a way to introduce a measurement converter perhaps not only for day-time but for other measurement units and standards too?

unit_converter("duration",is: "ms", to:"ISO8601:2004")

@TobiasNx
Copy link
Collaborator Author

TobiasNx commented Sep 12, 2022

Basis for the converter could be https://github.com/metafacture/metafacture-core/blob/master/metamorph/src/main/java/org/metafacture/metamorph/functions/DateFormat.java

and then it could be enhanced to support other kinds of measures, isos and units.

@TobiasNx
Copy link
Collaborator Author

For my transformation the java library https://www.joda.org/joda-time/ (java.time) could be used. Perhaps instead of creating a general measurement converter we start with a more simple dayTime-converter?

@TobiasNx
Copy link
Collaborator Author

TobiasNx commented Jan 6, 2023

Other scenario I need is to convert 14.24 MB into bytes

@fsteeg
Copy link
Member

fsteeg commented Feb 27, 2023

The approach sketched here is pretty involved and will probably take some time to implement. To find a good starting point that addresses the actual use case, could you expand a bit about the background in OERSI that you need this for? Is it described in some OERSI issue?

@TobiasNx
Copy link
Collaborator Author

TobiasNx commented Feb 27, 2023

For my transformation the java library https://www.joda.org/joda-time/ (java.time) could be used. Perhaps instead of creating a general measurement converter we start with a more simple dayTime-converter?

I remarked that a general measurement converter is probably to broad.
There are two scenarios I need at the moment.

First is convert incoming ms into ISO 8601:2004-Format: https://www.iso.org/standard/40874.html

83941 -> 01M24S (if I am not mistaken)
dateTime_converter("duration",is: "ms", to:"ISO8601:2004")

Other scenario I need is to convert 14.24 MB into bytes.

fileSize_converter("encoding.*.size",is: "ms", to:"ISO8601:2004")

I could illustrate them on a more concrete level, since both are related to orca_educast

@TobiasNx
Copy link
Collaborator Author

TobiasNx commented Feb 27, 2023

@TobiasNx
Copy link
Collaborator Author

TobiasNx commented Feb 27, 2023

@fsteeg
Copy link
Member

fsteeg commented Mar 1, 2023

For a general approach in metafacture-fix, we might want to use the existing format method, perhaps with some additional options, so roughly something like format("duration", "ISO8601", input: "ms"). However, to get the use cases clearer and have a working solution in OERSI sooner, I suggest we implement custom Java functions in the OERSI project first, and based on that consider integrating it in metafacture-fix.

@blackwinter
Copy link
Member

format("duration", "ISO8601", input: "ms")

Unfortunately, this would not be compatible with the current format string parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

3 participants