Delete original text from [Talk to the City
In Talk to the City, click on a dot to see the original text. However, there is a problem that the report screen becomes heavy because all data is embedded to display the original text, and there are cases where the original text is not desired to be displayed due to lack of permission for the right to make the original text transmittable, etc.
- After talking to someone who is familiar with the law, I realized that I could claim “citation” in a broader scope than I had originally thought.
- Related: Anything published can be cited.
Remove from UI
If this range is commented out, it can be removed from the UI (static content must be regenerated).
$ main.py -o visualization config/...
erase from data as well
. But I’d like to erase it from the data as well (it would be needlessly heavy).
The data type looks like this ts
Where are you reading the data? index.tsx
export async function getStaticProps({ params }: any) {
const report = process.env.REPORT
if (report && report.length) {
const fs = require('fs');
const result = fs.readFileSync(`../pipeline/outputs/${report}/result.json`, 'utf8');
return { props: { result: JSON.parse(result) } }
}
const fs = require('fs');
const subfolders = fs.readdirSync(outputs, { withFileTypes: true })
.map((x: any) => x.name)
.filter((x: string) => !x.startsWith('.'));
return { props: { subfolders } };
}
The result.json of the output of the analysis execution environment is read and turned into static HTML by server-side rendering.
To delete from static HTML already generated
This data is under _next/data
after static output
Let’s empty this.
comment emptying process
. python
import json
filename = "_next/data/8gQb47OhoAQvRNCBqVMIF/index.json"
python
data = json.load(open(filename))
comments = data["pageProps"]["result"]["comments"]
for k in comments:
comments[k]["comment"] = ""
json.dump(data, open(filename, "w"), ensure_ascii=False)
I was able to turn it off.
But this wasn’t enough to make it disappear from the web screen. I wondered why it was all embedded in index.html in the first place (what is index.json for? Is it being read?) json
The contents of index.json are embedded in the … The contents of index.json are embedded in the If you replace the contents here with the contents of the comment-empty index.json
It was confirmed to have disappeared from the data as well.
When performing UI regenerations I think it would be better to erase it from the JSON before visualization.
This page is auto-translated from [/nishio/Talk to the Cityから原文を消す](https://scrapbox.io/nishio/Talk to the Cityから原文を消す) using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I’m very happy to spread my thought to non-Japanese readers.