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

Feature/add export and import data #183

Draft
wants to merge 15 commits into
base: develop
Choose a base branch
from

Conversation

yu-smc
Copy link
Collaborator

@yu-smc yu-smc commented Sep 6, 2024

No description provided.

Copy link

vercel bot commented Sep 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
starrydigitizer ⬜️ Ignored (Inspect) Sep 20, 2024 9:53am

import { PlotDataScheme } from './plotDataScheme'

export interface allDataScheme {
appVersion: string
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure if we need app version in the json data, but currently each scheme has its own scheme version and all-data scheme has an app version.

Another option is to have only one global scheme version on the allDataScheme, and not to have app version or have both

Copy link
Owner

Choose a reason for hiding this comment

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

If it will be a single JSON, then having just one would be fine. However, if multiple JSONs are generated upon output, it might be better to have each separately. I assume it's the former, though

Copy link
Owner

@t29mato t29mato Sep 20, 2024

Choose a reason for hiding this comment

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

ah, this first comment looks outdated 😓

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

AllDataSchema will be one single JSON, but each of PlotDataSchema and ConfigDataSchema might be imported in other export formats.
So for now I think it would be better to have schema versions for each🤔

@yu-smc yu-smc requested a review from t29mato September 9, 2024 07:52
@@ -0,0 +1,2 @@
//e.g. 1.2.0 is described as [1, 2, 0]
export type SemanticVersion = [number, number, number]
Copy link
Collaborator Author

@yu-smc yu-smc Sep 19, 2024

Choose a reason for hiding this comment

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

Added new type 'SemanticVersion' to describe versions as an array of numbers(referred to WPD json
schema)

SemanticVersionConverter(string <-> array) will be implemented soon, mauybe...

points: Array<{
value: number
coord: Coord
}>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed the pixelDataSchema and integrated it into the plotDataSchema: now each axis and point has the combination of coordinates(pixel) and an actual value


export interface PlotDataSchema {
schemaVersion: SemanticVersion
axisSets: Array<{
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Used Array<{}> instead of {}[]
I think Array<{}> is better to clearly know it is array

coord: Coord
}
xScale: 'linear' | 'log' //TODO: create type AxisScale: 'linear' | 'log'
yScale: 'linear' | 'log'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated overall schema of axis set to be more simple and following the original data structure of StarryDigitizer.


export interface allDataSchema {
appVersion: SemanticVersion
plotImageBase64: string
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added plot image as base 64 string.
The reason why it is not in the plotDataSchema is that we may want to export plot data without image data.

Copy link
Owner

@t29mato t29mato left a comment

Choose a reason for hiding this comment

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

Thank you for the revisions. I've left a few comments on some minor points, so please address them accordingly.

//TODO: move definition of type Coord to more global directoly (e.g. @types)
import { Coord } from '@/domain/models/dataset/datasetInterface'

export interface PlotDataSchema {
Copy link
Owner

Choose a reason for hiding this comment

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

It seems that configDataSchema and PlotDataSchema are not consistently using camelCase and PascalCase.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed in: 9fb1e4b

import { SemanticVersion } from '@/@types/types'

//NOTE: Add any information about StarryDigitizer configurations which is necassary to reconstruct the application states here.
export interface configDataSchema {
Copy link
Owner

Choose a reason for hiding this comment

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

I believe that the interfaces used for external integration are named 〇〇DataSchema, and those used internally are named 〇〇interface, but I think people who are new to the code might not understand this distinction. It might be better to either change the naming or leave a note somewhere to clarify the usage.

Copy link
Collaborator Author

@yu-smc yu-smc Sep 20, 2024

Choose a reason for hiding this comment

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

Thank you. I will leave a comment about that.

BTW, TS Deep Dive says that we should avoid prefix 'I' on the interface names (which I guess is similar to put suffix 'Interface')
This is one of my current interests about TS and thinking how to avoid conflict between interface names and class name

https://typescript-jp.gitbook.io/deep-dive/styleguide#%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%BC%E3%83%95%E3%82%A7%E3%83%BC%E3%82%B9
(Sadly, the anchor link is not working...)

figure: {
scale: number
}
axisSets: {
Copy link
Owner

Choose a reason for hiding this comment

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

it might be better to use array type annotations here for clarity.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed in: 77ca8f4

}
axisSets: {
id: number
pointMode: 0 | 1
Copy link
Owner

Choose a reason for hiding this comment

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

Since it’s a magic number, it would be good to address it later

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed in: 5cc6831

import { PlotDataSchema } from './plotDataSchema'

export interface allDataSchema {
appVersion: SemanticVersion
Copy link
Owner

Choose a reason for hiding this comment

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

As a type, it's a semantic version, and when actually used, it's the app version. This usage looks good.

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.

2 participants