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

Define JSON format #52

Closed
wowry opened this issue Feb 5, 2022 · 7 comments
Closed

Define JSON format #52

wowry opened this issue Feb 5, 2022 · 7 comments
Assignees
Labels
Projects

Comments

@wowry
Copy link
Contributor

wowry commented Feb 5, 2022

Define JSON format that contains node, link and info.

@wowry wowry self-assigned this Feb 5, 2022
@wowry wowry added the design label Feb 5, 2022
@wowry
Copy link
Contributor Author

wowry commented Feb 5, 2022

Format

{
    "nodes": {
        "id": string,
        "isMain"?: boolean,
    }[],
    "links": {
        "source": string,
        "target": string
    }[],
    "info": {
        "id": string,
        "isMain"?: boolean,
        "onyomi": string[],
        "kunyomi": string[],
        "meaning": string[]
    }[]
}

Example

{
    "nodes": [ 
        { 
            "id": "",
            "isMain": true
        },
        {
            "id": ""
        }
    ],
    "links": [
        {
            "source": "",
            "target": ""
        }
    ],
    "info": [
        {
            "id": "",
            "isMain": true,
            "onyomi": ["サン", "セン"],
            "kunyomi": ["ヤマ"],
            "meaning": ["mountain"]
        },
        {
            "id": "",
            "onyomi": ["", "トウ"],
            "kunyomi": ["ノボる"],
            "meaning": ["ascend", "climb up"]
        }
    ]
}

@wowry
Copy link
Contributor Author

wowry commented Feb 5, 2022

"links": [
    {
        "source": "",
        "target": ""
    }
],

Here, the values of source and target are the node IDs. In this case, the arrow will be connected from "登" to "山", like this: 登→山.

@wowry
Copy link
Contributor Author

wowry commented Feb 5, 2022

My understanding is that nodes and links will be generated in GraphController, and info will be generated in InfoController. And then, we can combine them into a single JSON in main.py, and send it to the frontend.

@wowry
Copy link
Contributor Author

wowry commented Feb 5, 2022

"nodes": [ 
    { 
      "id": "",
      "isMain": true
    },
    { 
      "id": ""
    }
],

Please set "isMain": true if it is the main node, and do the same for info.

@teruto725
Copy link
Contributor

Sorry I implemented json response temporary.
But don't care. you can update it.
#53

@wowry
Copy link
Contributor Author

wowry commented Feb 5, 2022

OK, thanks. I'll check it.

@ani-hovhannisyan
Copy link
Owner

ani-hovhannisyan commented Feb 9, 2022

The format is ok, I constructed same in GC (GraphController) like this

{
		"nodes": [{
			"id": "山",
			"isMain": "true"
		}, {
			"id": "陰"
		}, {
			"id": "治"
		}, {
			"id": "開"
		}, {
			"id": "道"
		}, {
			"id": "須"
		}, {
			"id": "弥"
		}, {
			"id": "奥"
		}, {
			"id": "青"
		}, {
			"id": "富"
		}, {
			"id": "士"
		}, {
			"id": "脈"
		}, {
			"id": "火"
		}, {
			"id": "登"
		}, {
			"id": "岩"
		}, {
			"id": "事"
		}],
		"links": [{
			"source": "山",
			"target": "陰"
		}, {
			"source": "治",
			"target": "山"
		}, {
			"source": "開",
			"target": "山"
		}, {
			"source": "山",
			"target": "道"
		}, {
			"source": "須",
			"target": "弥"
		}, {
			"source": "弥",
			"target": "山"
		}, {
			"source": "奥",
			"target": "山"
		}, {
			"source": "青",
			"target": "山"
		}, {
			"source": "富",
			"target": "士"
		}, {
			"source": "士",
			"target": "山"
		}, {
			"source": "山",
			"target": "脈"
		}, {
			"source": "火",
			"target": "山"
		}, {
			"source": "登",
			"target": "山"
		}, {
			"source": "岩",
			"target": "山"
		}, {
			"source": "山",
			"target": "火"
		}, {
			"source": "火",
			"target": "事"
		}]
	}

Closing because both side have more and less defined the format.

@ani-hovhannisyan ani-hovhannisyan moved this from In progress to Done in PBL Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
PBL
Done
Development

No branches or pull requests

3 participants