File size: 42,391 Bytes
a99076c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "MoW8_q7gUlIW"
      },
      "outputs": [],
      "source": [
        "# Register at: https://stackapps.com/apps/oauth/register\n",
        "# !curl ipecho.net/plain\n",
        "\n",
        "secret = \"your_secret_key\"\n",
        "key = \"your_api_key\""
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "# Which site to extract questions from\n",
        "\n",
        "site = \"medicalsciences\"  # \"law\" or \"medicalsciences\" etc."
      ],
      "metadata": {
        "id": "ZCBvcPHXQDhP"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "R15jxqHE949f"
      },
      "outputs": [],
      "source": [
        "import requests\n",
        "from requests.adapters import HTTPAdapter, Retry\n",
        "from requests.exceptions import ConnectionError\n",
        "from tqdm.notebook import tqdm\n",
        "import json\n",
        "from time import sleep"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "GXc6vVHxetgV"
      },
      "source": [
        "# Get questions"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "7FWu3teNDblP"
      },
      "outputs": [],
      "source": [
        "url = \"https://api.stackexchange.com/2.3/questions/\"\n",
        "params = {\"client_secret\": secret,\n",
        "          \"key\": key,\n",
        "          \"site\": site,\n",
        "          \"filter\": \"withbody\",\n",
        "          \"order\":\"desc\",\n",
        "          \"sort\":\"votes\",\n",
        "          \"pagesize\":100\n",
        "          }\n",
        "\n",
        "max_pages = 80 # 300 for law or 80 for medicalsciences\n",
        "\n",
        "retries = Retry(total=5,\n",
        "                backoff_factor=0.1,\n",
        "                status_forcelist=[500, 502, 503, 504, 429])\n",
        "\n",
        "adapter = HTTPAdapter(max_retries=retries)\n",
        "session = requests.Session()\n",
        "\n",
        "# Use the adapter for all requests to endpoints that start with this URL\n",
        "session.mount('https://api.stackexchange.com/', adapter)\n",
        "\n",
        "retrieved_data = []\n",
        "\n",
        "for page in tqdm(range(max_pages)):\n",
        "  params[\"page\"] = page+1\n",
        "  response = session.get(url, params=params)\n",
        "\n",
        "  if response.status_code != 200:\n",
        "    print(\"Error:\", response.status_code)\n",
        "    break\n",
        "  else:\n",
        "    current_page = response.json()\n",
        "    for item in current_page['items']:\n",
        "      retrieved_data.append(item)\n",
        "    if current_page[\"has_more\"] == False:\n",
        "      print(\"No more pages\")\n",
        "      break"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "Ge00fuGnFzn1",
        "outputId": "320ed184-9ae7-4240-bdef-d6217a488b5e"
      },
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "7829"
            ]
          },
          "metadata": {},
          "execution_count": 11
        }
      ],
      "source": [
        "len(retrieved_data)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "xZkjwdb_EP-q",
        "outputId": "4397a793-0992-4120-b5aa-6475425d4dc7"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "{\n",
            "    \"tags\": [\n",
            "        \"covid-19\",\n",
            "        \"vaccination\",\n",
            "        \"side-effects\"\n",
            "    ],\n",
            "    \"owner\": {\n",
            "        \"account_id\": 27722897,\n",
            "        \"reputation\": 3,\n",
            "        \"user_id\": 26386,\n",
            "        \"user_type\": \"unregistered\",\n",
            "        \"profile_image\": \"https://www.gravatar.com/avatar/511c7e442e5fbe49cdcb16d96aa8cd19?s=256&d=identicon&r=PG\",\n",
            "        \"display_name\": \"Unknown user\",\n",
            "        \"link\": \"https://medicalsciences.stackexchange.com/users/26386/unknown-user\"\n",
            "    },\n",
            "    \"is_answered\": true,\n",
            "    \"view_count\": 67,\n",
            "    \"closed_date\": 1675778668,\n",
            "    \"accepted_answer_id\": 31982,\n",
            "    \"answer_count\": 1,\n",
            "    \"score\": -5,\n",
            "    \"last_activity_date\": 1685671894,\n",
            "    \"creation_date\": 1675753683,\n",
            "    \"question_id\": 31981,\n",
            "    \"link\": \"https://medicalsciences.stackexchange.com/questions/31981/how-bad-are-covid-vaccines\",\n",
            "    \"closed_reason\": \"Not suitable for this site\",\n",
            "    \"title\": \"How bad are covid vaccines?\",\n",
            "    \"body\": \"<p>For the past year I've been hearing about people claiming that those who took the covid jabs are dropping like flies. I even hear people claim that the covid vaccinations are depopulation tools and most people who get it are going to die within the next 10 years! As someone who (reluctantly) took the jabs in May 2021, this concerns me and I'm sure there are millions of people like me. If you go on bitchute there seems to be a lot of evidence in support of that notion and it worries me. I also hear about people on the internet saying that they or someone they know are having some nasty side effects. But today darkmatter2525 made a video saying that the whole &quot;died suddenly&quot; thing is just the frequency illusion and that claims saying that athletes are collapsing more than ever is just based on misleading data. Every time someone under 70 years old dies a lot of people are blaming the vaccine. But what's the truth? I know there's some truth to what these &quot;anti-vaxxers&quot; saying but just how bad is it and what exactly is going on? Should I be concerned for myself and my loved ones?</p>\\n\"\n",
            "}\n"
          ]
        }
      ],
      "source": [
        "import json\n",
        "\n",
        "print(json.dumps(retrieved_data[-1], indent=4))"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "8xM9SKctZaB1"
      },
      "outputs": [],
      "source": [
        "# Save file - test\n",
        "with open(\"example.json\", \"w\") as output:\n",
        "  json.dump(retrieved_data[:10], output, indent=4)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "KzfcTYt7XWgJ"
      },
      "outputs": [],
      "source": [
        "# Save the whole data\n",
        "import os\n",
        "\n",
        "# output_questions_file_name = \"law.stackexchange.json\"\n",
        "output_questions_file_name = \"medical.stackexchange.json\"\n",
        "directory = \"/content/drive/MyDrive/data/StackExchange/MedicalSciences\"\n",
        "full_output_path = os.path.join(directory, output_questions_file_name)\n",
        "\n",
        "with open(full_output_path, \"w+\") as output:\n",
        "  json.dump(retrieved_data, output, indent=4)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "SXrXjiiV7PVo"
      },
      "source": [
        "# Get answers"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "_K8jZu0F7RtY",
        "outputId": "b97611ce-7641-48fd-b04c-7ea0c8632e09"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Questions total: 7829\n",
            "Questions with answers: 4969\n"
          ]
        }
      ],
      "source": [
        "import os\n",
        "\n",
        "# file_path = \"/content/drive/MyDrive/data/StackExchange/Law/\"\n",
        "# file_name = \"law.stackexchange.json\"\n",
        "\n",
        "file_path = \"/content/drive/MyDrive/data/StackExchange/MedicalSciences/\"\n",
        "file_name = \"medical.stackexchange.json\"\n",
        "\n",
        "data = json.load(open(os.path.join(file_path, file_name)))\n",
        "questions = [question for question in data if question[\"is_answered\"]]\n",
        "\n",
        "print(\"Questions total:\", len(data))\n",
        "print(\"Questions with answers:\", len(questions))"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 49,
          "referenced_widgets": [
            "caef01b2ea1d490baca92066e9f7ae12",
            "7fccf71e710841c6aabcdad832b36c61",
            "9f9ac1d792f24afc8ee9a8bc38a1f7c8",
            "410b5fe10d0a45dfa5b24c5c9256ff86",
            "494f8244675041d4aaca3d83c7955365",
            "12fce8eb451f4e129a0dff5dffa84c2c",
            "bb22bbd047fc405db894526a3ca4d1b8",
            "9c1944fee7fb44d5b8b0e8eda7d31cac",
            "e068f8e3183844ec9db63f5bff304e62",
            "3400c1e7251e4d339a291f2cfa7b9c08",
            "e1ca24cc7b2f4355bc9a9b39eadb8baa"
          ]
        },
        "id": "BpRZN4zwZ7KD",
        "outputId": "7be24266-229f-400e-e191-24ea0c191ce6"
      },
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "  0%|          | 0/100 [00:00<?, ?it/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "caef01b2ea1d490baca92066e9f7ae12"
            }
          },
          "metadata": {}
        }
      ],
      "source": [
        "url = {\"url\":\"https://api.stackexchange.com/2.3/questions/{idx}/answers\"}\n",
        "params = {\"client_secret\": secret,\n",
        "          \"key\": key,\n",
        "          \"site\": site,\n",
        "          \"filter\": \"withbody\",\n",
        "          \"order\":\"desc\",\n",
        "          \"sort\":\"votes\",\n",
        "          \"pagesize\":100}\n",
        "\n",
        "retries = Retry(total=5,\n",
        "                backoff_factor=0.99,\n",
        "                status_forcelist=[400, 429, 500, 502, 503, 504])\n",
        "\n",
        "adapter = HTTPAdapter(max_retries=retries)\n",
        "session = requests.Session()\n",
        "\n",
        "# Use the adapter for all requests to endpoints that start with this URL\n",
        "session.mount('https://api.stackexchange.com/', adapter)\n",
        "\n",
        "questions_data = []\n",
        "\n",
        "for question_item in tqdm(questions):\n",
        "  question_id = question_item[\"question_id\"]\n",
        "\n",
        "  question = {}\n",
        "  question[\"question_id\"] = question_item[\"question_id\"]\n",
        "  question[\"tags\"] = question_item[\"tags\"]\n",
        "  question[\"score\"] = question_item[\"score\"]\n",
        "  question[\"license\"] = question_item.get(\"content_license\", \"\")\n",
        "  question[\"title\"] = question_item[\"title\"]\n",
        "  question[\"body\"] = question_item[\"body\"]\n",
        "  question[\"link\"] = question_item[\"link\"]\n",
        "  question[\"answers\"] = []\n",
        "\n",
        "  response = session.get(url[\"url\"].format(idx=question_id), params=params)\n",
        "\n",
        "  if response.status_code != 200:\n",
        "    print(\"Error:\", response.status_code)\n",
        "    break\n",
        "  else:\n",
        "    current_page = response.json()\n",
        "    for answer_item in current_page['items']:\n",
        "      if answer_item[\"score\"] >= 0:\n",
        "        answer = {}\n",
        "        answer[\"answer_id\"] = answer_item[\"answer_id\"]\n",
        "        answer[\"score\"] = answer_item[\"score\"]\n",
        "        answer[\"body\"] = answer_item[\"body\"]\n",
        "\n",
        "        question[\"answers\"].append(answer)\n",
        "\n",
        "  questions_data.append(question)\n",
        "  sleep(0.5)\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "zfQVzhOhhMPe"
      },
      "outputs": [],
      "source": [
        "print(len(questions_data))\n",
        "print(json.dumps(questions_data[-1], indent=2))"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "l1Pz83HF1NpA"
      },
      "outputs": [],
      "source": [
        "# Save the whole data\n",
        "\n",
        "# output_file_name = \"law.stackexchange-questions-answers.json\"\n",
        "output_file_name = \"medical.stackexchange-questions-answers.json\"\n",
        "\n",
        "full_output_path = os.path.join(file_path, output_file_name)\n",
        "\n",
        "with open(full_output_path, \"w+\") as output:\n",
        "  json.dump(questions_data, output, indent=4)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "UIp1PBiRCUQT",
        "outputId": "128de532-01cb-4630-bbad-f9199aad2623"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "medical.stackexchange.json  medical.stackexchange-questions-answers.json\n"
          ]
        }
      ],
      "source": [
        "!ls $file_path"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "Ky2qBJnfaO1Y"
      },
      "outputs": [],
      "source": [
        "import os\n",
        "import json\n",
        "\n",
        "# output_file_name = \"law.stackexchange-questions-answers.json\"\n",
        "output_file_name = \"medical.stackexchange-questions-answers.json\"\n",
        "\n",
        "full_output_path = os.path.join(file_path, output_file_name)\n",
        "\n",
        "with open(full_output_path, \"r\") as output:\n",
        "  questions_answers = json.load(output)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "Sbo2JcJCfrFp",
        "outputId": "f4d26220-2c7a-409d-bc7c-95d2830789b7"
      },
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "4969"
            ]
          },
          "metadata": {},
          "execution_count": 48
        }
      ],
      "source": [
        "len(questions_answers)"
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "print(json.dumps(questions_answers[0], indent=4))"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "LJabX_yzjg7X",
        "outputId": "518244ca-3a5b-4afb-e5c8-c2a598f8c2e4"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "{\n",
            "    \"question_id\": 52,\n",
            "    \"tags\": [\n",
            "        \"eye\",\n",
            "        \"computers\",\n",
            "        \"lifestyle\"\n",
            "    ],\n",
            "    \"score\": 112,\n",
            "    \"license\": \"CC BY-SA 3.0\",\n",
            "    \"title\": \"How can I protect my eyesight when using computers?\",\n",
            "    \"body\": \"<p>My job requires long periods of computer screen use. I have good eyesight (20/15) and don't wear glasses, but I definitely notice my eyes feeling fatigued at the end of the day. Sometimes when I'm short on sleep, I have trouble focusing or see slightly blurred vision.</p>\\n\\n<p>I want to protect my eyesight as much as possible. What are the best practices for doing so if you spend a lot of time staring at screens?</p>\\n\",\n",
            "    \"link\": \"https://medicalsciences.stackexchange.com/questions/52/how-can-i-protect-my-eyesight-when-using-computers\",\n",
            "    \"answers\": [\n",
            "        {\n",
            "            \"answer_id\": 85,\n",
            "            \"score\": 79,\n",
            "            \"body\": \"<h3>20-20-20 Rule</h3>\\n<p>Every 20 minutes of looking at the screen, look at something 20 feet away for 20 seconds. Also, try to blink a lot.</p>\\n<h3>Adjusting settings</h3>\\n<p>Using a larger font to read helps to reduce eye strain. Adjusting your brightness helps, usually brighter screens are better in brighter rooms, dimmer screens are better in dark rooms.</p>\\n<p>Also, try to make your computer screen lower than your eyes; more of your eye is covered by your eyelid when you look down, so there will be more lubrication and you will subconsciously blink more.</p>\\n<h3>Eating</h3>\\n<p>Eat foods with vitamin A, which helps with the health of your eyes. See <a href=\\\"https://health.stackexchange.com/questions/79/do-carrots-actually-improve-eyesight\\\">this question</a> for more.</p>\\n<hr />\\n<p><a href=\\\"http://visianinfo.com/the-20-20-20-rule-preventing-digital-eye-strain/\\\" rel=\\\"noreferrer\\\"><sup>The 20-20-20 Rule: Preventing Digital Eye Strain</sup></a><br />\\n<sub><a href=\\\"http://onlinelibrary.wiley.com/doi/10.1111/j.1475-1313.2011.00834.x/full\\\" rel=\\\"noreferrer\\\">Computer vision syndrome: a review of ocular causes and potential treatments</a></sub><br />\\n<sub><a href=\\\"http://commons.erau.edu/jaaer/vol24/iss2/5/?utm_source=commons.erau.edu%2Fjaaer%2Fvol24%2Fiss2%2F5&amp;utm_medium=PDF&amp;utm_campaign=PDFCoverPages\\\" rel=\\\"noreferrer\\\">Assessing Computer Vision Syndrome Risk for Pilots</a></sub><br />\\n<sub><a href=\\\"http://www.mayoclinic.org/diseases-conditions/eyestrain/basics/prevention/con-20032649\\\" rel=\\\"noreferrer\\\">Eyestrain</a></sub></p>\\n\"\n",
            "        },\n",
            "        {\n",
            "            \"answer_id\": 468,\n",
            "            \"score\": 25,\n",
            "            \"body\": \"<p>There are some options you have to reduce eye strain.</p>\\n\\n<ul>\\n<li><p>You can get an anti glare cover for your monitor</p></li>\\n<li><p>You can also adjust lighting of your work area (not always possible) \\nby lowering internal lighting and blocking external lighting.</p></li>\\n<li><p>You can adjust the setting of your monitor to make the brightness<br>\\nsimilar to your surroundings which will help with strain</p></li>\\n<li><p>You can blink more often to keep your eyes from drying out   You can \\ntake breaks both by leaving your computer or by moving your eyes<br>\\naround the room/desk and avoiding your computer every once in a<br>\\nwhile.</p></li>\\n<li><p>You can set up your desk to make sure printed material is in easy eye\\nreach and lighted similarly</p></li>\\n<li><p>You can look into getting specialized gaming/computer glasses which<br>\\nare designed to reduce eye strain and fatigue</p></li>\\n</ul>\\n\\n<p><a href=\\\"http://www.allaboutvision.com/cvs/irritated.htm\\\">http://www.allaboutvision.com/cvs/irritated.htm</a></p>\\n\"\n",
            "        },\n",
            "        {\n",
            "            \"answer_id\": 1104,\n",
            "            \"score\": 22,\n",
            "            \"body\": \"<p>The primary risk is what is called Computer Vision Syndrome (<a href=\\\"http://www.webmd.com/eye-health/computer-vision-syndrome\\\">ref</a>, <a href=\\\"http://www.aoa.org/patients-and-public/caring-for-your-vision/protecting-your-vision/computer-vision-syndrome?sso=y\\\">ref</a>, <a href=\\\"http://en.wikipedia.org/wiki/Computer_vision_syndrome\\\">ref</a>).</p>\\n\\n<p>The American Optometric Association (referenced above) recommends the following changes in viewing habits to alleviate symptoms:</p>\\n\\n<blockquote>\\n  <p>Some important factors in preventing or reducing the symptoms of CVS\\n  have to do with the computer and how it is used. This includes\\n  lighting conditions, chair comfort, location of reference materials,\\n  position of the monitor, and the use of rest breaks.</p>\\n  \\n  <ul>\\n  <li><strong>Location of computer screen</strong> - Most people find it more comfortable to\\n  view a computer when the eyes are looking downward. Optimally, the\\n  computer screen should be 15 to 20 degrees below eye level (about 4 or\\n  5 inches) as measured from the center of the screen and 20 to 28\\n  inches from the eyes. </li>\\n  <li><strong>Reference materials</strong> - These materials should be\\n  located above the keyboard and below the monitor. If this is not\\n  possible, a document holder can be used beside the monitor. The goal\\n  is to position the documents so you do not need to move your head to\\n  look from the document to the screen.</li>\\n  <li><strong>Lighting</strong> - Position the computer\\n  screen to avoid glare, particularly from overhead lighting or windows.\\n  Use blinds or drapes on windows and replace the light bulbs in desk\\n  lamps with bulbs of lower wattage. </li>\\n  <li><strong>Anti-glare screens</strong> - If there is no\\n  way to minimize glare from light sources, consider using a screen\\n  glare filter. These filters decrease the amount of light reflected\\n  from the screen.</li>\\n  <li><strong>Seating position</strong> - Chairs should be comfortably\\n  padded and conform to the body. Chair height should be adjusted so\\n  your feet rest flat on the floor. If your chair has arms, they should\\n  be adjusted to provide arm support while you are typing. Your wrists\\n  shouldn't rest on the keyboard when typing.</li>\\n  <li><strong>Rest breaks</strong> - To prevent\\n  eyestrain, try to rest your eyes when using the computer for long\\n  periods. Rest your eyes for 15 minutes after two hours of continuous\\n  computer use. Also, for every 20 minutes of computer viewing, look\\n  into the distance for 20 seconds to allow your eyes a chance to\\n  refocus. </li>\\n  <li><strong>Blinking</strong> - To minimize your chances of developing dry eye\\n  when using a computer, make an effort to blink frequently. Blinking\\n  keeps the front surface of your eye moist.</li>\\n  </ul>\\n  \\n  <p>Regular eye examinations and proper viewing habits can help to prevent\\n  or reduce the development of the symptoms associated with Computer\\n  Vision Syndrome.</p>\\n</blockquote>\\n\\n<p>Also, from WebMD:</p>\\n\\n<blockquote>\\n  <ul>\\n  <li><strong>Tweak your computer settings.</strong> You don't have to live with the factory-installed settings on your computer if you're uncomfortable. Adjust the brightness, contrast, and font size until you find the best settings for your vision.</li>\\n  </ul>\\n</blockquote>\\n\\n<p>Gunnar glasses: Studies have shown <a href=\\\"http://en.wikipedia.org/wiki/Gunnar_Optiks\\\">some short term relief</a> but generally no evidence has yet surfaced to support benefits of these glasses for long term health.</p>\\n\"\n",
            "        },\n",
            "        {\n",
            "            \"answer_id\": 907,\n",
            "            \"score\": 13,\n",
            "            \"body\": \"<p>You can also use <a href=\\\"https://justgetflux.com/\\\" rel=\\\"noreferrer\\\">f.lux</a>, it is a software that adjusts automatically and according to your location the brightness and contrast of your monitor. It lowers UV light during day, and lowers IR light during night.</p>\\n\"\n",
            "        },\n",
            "        {\n",
            "            \"answer_id\": 235,\n",
            "            \"score\": 6,\n",
            "            \"body\": \"<p>The health of your eyesight when using computer it really depends what kind of screen you're using and many other factors (DNA, diet, etc.), but in general, modern monitors (such as <a href=\\\"http://en.wikipedia.org/wiki/Liquid_crystal_display\\\" rel=\\\"nofollow\\\">LCD</a>, <a href=\\\"http://en.wikipedia.org/wiki/LED-backlit_LCD_display\\\" rel=\\\"nofollow\\\">LED-backlit</a>, <a href=\\\"http://en.wikipedia.org/wiki/LED_display\\\" rel=\\\"nofollow\\\">white-LED</a>, <a href=\\\"http://en.wikipedia.org/wiki/OLED#Disadvantages\\\" rel=\\\"nofollow\\\">OLED</a>) does nothing to the health of your eyes, unless you're still using <a href=\\\"http://en.wikipedia.org/wiki/Cathode_ray_tube\\\" rel=\\\"nofollow\\\">CRT</a> monitor. The bigger issue is rather neck and back if you don't site properly.</p>\\n\\n<p>Remember, if you feel your eyes are not comfortable, you may adjust the brightness and contrast of your screen.</p>\\n\\n<p>If you're using computer for too long, it's completely normal that your eyes would be tired and it really depends on the person (professionals can spent 8-12 everyday for years and their eyesight is perfect, for other 1h is enough). </p>\\n\\n<p>In this case, you simply need a rest. It's usually advice to do short breaks and take a fresh air. You may also consider to train your eye muscles as a number of <a href=\\\"http://en.wikipedia.org/wiki/Ophthalmology\\\" rel=\\\"nofollow\\\">ophthalmologists</a> believe that an exercise programme based on something called the <a href=\\\"http://en.wikipedia.org/wiki/Bates_method\\\" rel=\\\"nofollow\\\">Bates Method</a> may keep eyes in better shape.</p>\\n\\n<p>See: <a href=\\\"http://www.independent.co.uk/life-style/can-you-really-train-your-eyes-to-see-better-1240390.html\\\" rel=\\\"nofollow\\\">Can you really train your eyes to see better?</a> where we can read:</p>\\n\\n<blockquote>\\n  <p>Some of the principles of the Bates Method are already accepted by mainstream eye care.</p>\\n</blockquote>\\n\\n<hr>\\n\\n<p>More information about older monitors:</p>\\n\\n<p><strong><a href=\\\"http://en.wikipedia.org/wiki/Cathode_ray_tube\\\" rel=\\\"nofollow\\\">CRT</a></strong></p>\\n\\n<p>If you're using CRT most people experience mild discomfort unless the <a href=\\\"http://en.wikipedia.org/wiki/Refresh_rate\\\" rel=\\\"nofollow\\\">refresh rate</a> is set to 72 Hz or higher. A rate of 100 Hz is comfortable at almost any size. It's usually advice to have a screen protector. However CRT are long lost technologies and this doesn't apply anymore to LCD monitors. </p>\\n\"\n",
            "        },\n",
            "        {\n",
            "            \"answer_id\": 11235,\n",
            "            \"score\": 6,\n",
            "            \"body\": \"<p><a href=\\\"https://en.wikipedia.org/wiki/The_Vision_Council\\\" rel=\\\"noreferrer\\\">The Vision Council</a>, which represents the manufacturers and suppliers of the optical industry, suggests the following tips to prevent and lessen digital eye strain:</p>\\n\\n<ul>\\n<li>Adjust the brightness of your device. Consider changing your background color from bright white to cool gray.\\nAttach a glare reduction filter to your computer screen.</li>\\n<li>Frequently dust and wipe digital screens to help reduce glare.</li>\\n<li>Adjust your screen so that it is directly in front of your face and slightly below eye level. Do not tilt a computer\\nmonitor.</li>\\n<li>Position yourself or your device so there is sufficient distance between your eyes and the screen.</li>\\n<li>Lessen the amount of overhead and surrounding light that is competing with your device\\u2019s screen.</li>\\n<li>When using a computer, first sit in your chair and extend your arm. Your palm should rest comfortably on the\\nmonitor (as if you\\u2019re high-fiving the screen).</li>\\n<li>Keep handheld devices a safe distance from your eyes and just below eye level.</li>\\n<li>Increase text size to better define the content on your screen. Use the settings control to make adjustments that\\nfeel comfortable to your eyes.</li>\\n<li>Remind yourself to blink more often. Staring at a digital screen can affect the number of times you blink, causing\\neyes to dry.</li>\\n<li>Take a 20-20-20 break: Every 20 minutes, take a 20-second break and look at something 20 feet away.</li>\\n<li>Parents should limit the amount of screen time for children, and reduce their screen time in front of children so as\\nto set healthy standards in the home.</li>\\n<li>Blink. Breathe. Break.</li>\\n</ul>\\n\\n<p>Also check the following image as a guidance:</p>\\n\\n<p><a href=\\\"https://i.stack.imgur.com/zhAW3.jpg\\\" rel=\\\"noreferrer\\\"><img src=\\\"https://i.stack.imgur.com/zhAW3.jpg\\\" alt=\\\"Computer Eye-gonomics - tips to prevent and lessen digital eye strain\\\"></a></p>\\n\\n<p>Source: <a href=\\\"https://www.thevisioncouncil.org/sites/default/files/TVCDigitEYEzedReport2013.pdf\\\" rel=\\\"noreferrer\\\">Digiteyezed - The daily impack of digital screens on the eye health of Americans</a></p>\\n\"\n",
            "        }\n",
            "    ]\n",
            "}\n"
          ]
        }
      ]
    }
  ],
  "metadata": {
    "colab": {
      "machine_shape": "hm",
      "provenance": []
    },
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    },
    "language_info": {
      "name": "python"
    },
    "widgets": {
      "application/vnd.jupyter.widget-state+json": {
        "caef01b2ea1d490baca92066e9f7ae12": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_7fccf71e710841c6aabcdad832b36c61",
              "IPY_MODEL_9f9ac1d792f24afc8ee9a8bc38a1f7c8",
              "IPY_MODEL_410b5fe10d0a45dfa5b24c5c9256ff86"
            ],
            "layout": "IPY_MODEL_494f8244675041d4aaca3d83c7955365"
          }
        },
        "7fccf71e710841c6aabcdad832b36c61": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_12fce8eb451f4e129a0dff5dffa84c2c",
            "placeholder": "​",
            "style": "IPY_MODEL_bb22bbd047fc405db894526a3ca4d1b8",
            "value": "100%"
          }
        },
        "9f9ac1d792f24afc8ee9a8bc38a1f7c8": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_9c1944fee7fb44d5b8b0e8eda7d31cac",
            "max": 100,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_e068f8e3183844ec9db63f5bff304e62",
            "value": 100
          }
        },
        "410b5fe10d0a45dfa5b24c5c9256ff86": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_3400c1e7251e4d339a291f2cfa7b9c08",
            "placeholder": "​",
            "style": "IPY_MODEL_e1ca24cc7b2f4355bc9a9b39eadb8baa",
            "value": " 100/100 [00:53&lt;00:00,  1.91it/s]"
          }
        },
        "494f8244675041d4aaca3d83c7955365": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "12fce8eb451f4e129a0dff5dffa84c2c": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "bb22bbd047fc405db894526a3ca4d1b8": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "9c1944fee7fb44d5b8b0e8eda7d31cac": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "e068f8e3183844ec9db63f5bff304e62": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "3400c1e7251e4d339a291f2cfa7b9c08": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "e1ca24cc7b2f4355bc9a9b39eadb8baa": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        }
      }
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}