edsl 0.1.27.dev2__py3-none-any.whl → 0.1.29__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. edsl/Base.py +107 -30
  2. edsl/BaseDiff.py +260 -0
  3. edsl/__init__.py +25 -21
  4. edsl/__version__.py +1 -1
  5. edsl/agents/Agent.py +103 -46
  6. edsl/agents/AgentList.py +97 -13
  7. edsl/agents/Invigilator.py +23 -10
  8. edsl/agents/InvigilatorBase.py +19 -14
  9. edsl/agents/PromptConstructionMixin.py +342 -100
  10. edsl/agents/descriptors.py +5 -2
  11. edsl/base/Base.py +289 -0
  12. edsl/config.py +2 -1
  13. edsl/conjure/AgentConstructionMixin.py +152 -0
  14. edsl/conjure/Conjure.py +56 -0
  15. edsl/conjure/InputData.py +659 -0
  16. edsl/conjure/InputDataCSV.py +48 -0
  17. edsl/conjure/InputDataMixinQuestionStats.py +182 -0
  18. edsl/conjure/InputDataPyRead.py +91 -0
  19. edsl/conjure/InputDataSPSS.py +8 -0
  20. edsl/conjure/InputDataStata.py +8 -0
  21. edsl/conjure/QuestionOptionMixin.py +76 -0
  22. edsl/conjure/QuestionTypeMixin.py +23 -0
  23. edsl/conjure/RawQuestion.py +65 -0
  24. edsl/conjure/SurveyResponses.py +7 -0
  25. edsl/conjure/__init__.py +9 -4
  26. edsl/conjure/examples/placeholder.txt +0 -0
  27. edsl/conjure/naming_utilities.py +263 -0
  28. edsl/conjure/utilities.py +165 -28
  29. edsl/conversation/Conversation.py +238 -0
  30. edsl/conversation/car_buying.py +58 -0
  31. edsl/conversation/mug_negotiation.py +81 -0
  32. edsl/conversation/next_speaker_utilities.py +93 -0
  33. edsl/coop/coop.py +337 -121
  34. edsl/coop/utils.py +56 -70
  35. edsl/data/Cache.py +74 -22
  36. edsl/data/CacheHandler.py +10 -9
  37. edsl/data/SQLiteDict.py +11 -3
  38. edsl/inference_services/AnthropicService.py +1 -0
  39. edsl/inference_services/DeepInfraService.py +20 -13
  40. edsl/inference_services/GoogleService.py +7 -1
  41. edsl/inference_services/InferenceServicesCollection.py +33 -7
  42. edsl/inference_services/OpenAIService.py +17 -10
  43. edsl/inference_services/models_available_cache.py +69 -0
  44. edsl/inference_services/rate_limits_cache.py +25 -0
  45. edsl/inference_services/write_available.py +10 -0
  46. edsl/jobs/Answers.py +15 -1
  47. edsl/jobs/Jobs.py +322 -73
  48. edsl/jobs/buckets/BucketCollection.py +9 -3
  49. edsl/jobs/buckets/ModelBuckets.py +4 -2
  50. edsl/jobs/buckets/TokenBucket.py +1 -2
  51. edsl/jobs/interviews/Interview.py +7 -10
  52. edsl/jobs/interviews/InterviewStatusMixin.py +3 -3
  53. edsl/jobs/interviews/InterviewTaskBuildingMixin.py +39 -20
  54. edsl/jobs/interviews/retry_management.py +4 -4
  55. edsl/jobs/runners/JobsRunnerAsyncio.py +103 -65
  56. edsl/jobs/runners/JobsRunnerStatusData.py +3 -3
  57. edsl/jobs/tasks/QuestionTaskCreator.py +4 -2
  58. edsl/jobs/tasks/TaskHistory.py +4 -3
  59. edsl/language_models/LanguageModel.py +42 -55
  60. edsl/language_models/ModelList.py +96 -0
  61. edsl/language_models/registry.py +14 -0
  62. edsl/language_models/repair.py +97 -25
  63. edsl/notebooks/Notebook.py +157 -32
  64. edsl/prompts/Prompt.py +31 -19
  65. edsl/questions/QuestionBase.py +145 -23
  66. edsl/questions/QuestionBudget.py +5 -6
  67. edsl/questions/QuestionCheckBox.py +7 -3
  68. edsl/questions/QuestionExtract.py +5 -3
  69. edsl/questions/QuestionFreeText.py +3 -3
  70. edsl/questions/QuestionFunctional.py +0 -3
  71. edsl/questions/QuestionList.py +3 -4
  72. edsl/questions/QuestionMultipleChoice.py +16 -8
  73. edsl/questions/QuestionNumerical.py +4 -3
  74. edsl/questions/QuestionRank.py +5 -3
  75. edsl/questions/__init__.py +4 -3
  76. edsl/questions/descriptors.py +9 -4
  77. edsl/questions/question_registry.py +27 -31
  78. edsl/questions/settings.py +1 -1
  79. edsl/results/Dataset.py +31 -0
  80. edsl/results/DatasetExportMixin.py +493 -0
  81. edsl/results/Result.py +42 -82
  82. edsl/results/Results.py +178 -66
  83. edsl/results/ResultsDBMixin.py +10 -9
  84. edsl/results/ResultsExportMixin.py +23 -507
  85. edsl/results/ResultsGGMixin.py +3 -3
  86. edsl/results/ResultsToolsMixin.py +9 -9
  87. edsl/scenarios/FileStore.py +140 -0
  88. edsl/scenarios/Scenario.py +59 -6
  89. edsl/scenarios/ScenarioList.py +138 -52
  90. edsl/scenarios/ScenarioListExportMixin.py +32 -0
  91. edsl/scenarios/ScenarioListPdfMixin.py +2 -1
  92. edsl/scenarios/__init__.py +1 -0
  93. edsl/study/ObjectEntry.py +173 -0
  94. edsl/study/ProofOfWork.py +113 -0
  95. edsl/study/SnapShot.py +73 -0
  96. edsl/study/Study.py +498 -0
  97. edsl/study/__init__.py +4 -0
  98. edsl/surveys/MemoryPlan.py +11 -4
  99. edsl/surveys/Survey.py +124 -37
  100. edsl/surveys/SurveyExportMixin.py +25 -5
  101. edsl/surveys/SurveyFlowVisualizationMixin.py +6 -4
  102. edsl/tools/plotting.py +4 -2
  103. edsl/utilities/__init__.py +21 -20
  104. edsl/utilities/gcp_bucket/__init__.py +0 -0
  105. edsl/utilities/gcp_bucket/cloud_storage.py +96 -0
  106. edsl/utilities/gcp_bucket/simple_example.py +9 -0
  107. edsl/utilities/interface.py +90 -73
  108. edsl/utilities/repair_functions.py +28 -0
  109. edsl/utilities/utilities.py +59 -6
  110. {edsl-0.1.27.dev2.dist-info → edsl-0.1.29.dist-info}/METADATA +42 -15
  111. edsl-0.1.29.dist-info/RECORD +203 -0
  112. edsl/conjure/RawResponseColumn.py +0 -327
  113. edsl/conjure/SurveyBuilder.py +0 -308
  114. edsl/conjure/SurveyBuilderCSV.py +0 -78
  115. edsl/conjure/SurveyBuilderSPSS.py +0 -118
  116. edsl/data/RemoteDict.py +0 -103
  117. edsl-0.1.27.dev2.dist-info/RECORD +0 -172
  118. {edsl-0.1.27.dev2.dist-info → edsl-0.1.29.dist-info}/LICENSE +0 -0
  119. {edsl-0.1.27.dev2.dist-info → edsl-0.1.29.dist-info}/WHEEL +0 -0
@@ -0,0 +1,203 @@
1
+ edsl/Base.py,sha256=ttNxUotSd9LSEJl2w6LdMtT78d0nMQvYDJ0q4JkqBfg,8945
2
+ edsl/BaseDiff.py,sha256=RoVEh52UJs22yMa7k7jv8se01G62jJNWnBzaZngo-Ug,8260
3
+ edsl/__init__.py,sha256=E6PkWI_owu8AUc4uJs2XWDVozqSbcRWzsIqf8_Kskho,1631
4
+ edsl/__version__.py,sha256=A-lFHZ4YpCrWZ6nw3tlt_yurFJ00mInm3gR6hz51Eww,23
5
+ edsl/agents/Agent.py,sha256=YQGx8iahP-t4azCYP4bEP2KPhEks2nqUxWTmd-6lLoU,27089
6
+ edsl/agents/AgentList.py,sha256=07RpCsqAJxyAEMY4NvvqWOXSk11i6b80UZhOwa1-y9A,9468
7
+ edsl/agents/Invigilator.py,sha256=gfy6yyaWKPa-OfMgZ3VvWAqBwppSdJSjSatH1Gmd_A0,10784
8
+ edsl/agents/InvigilatorBase.py,sha256=ncha1HF2V1Dz4f50Gekg6AzUXCD2Af82ztfSJZbgOHY,7469
9
+ edsl/agents/PromptConstructionMixin.py,sha256=MP2Frmm9iP3J50ijXKrr6YYIjB_38UuA2J7Mysfs0ZQ,15913
10
+ edsl/agents/__init__.py,sha256=a3H1lxDwu9HR8fwh79C5DgxPSFv_bE2rzQ6y1D8Ba5c,80
11
+ edsl/agents/descriptors.py,sha256=m8ND3-2-JbgNX1HGakBNLIeemwsgYa1mQxYO9GW33hw,2934
12
+ edsl/base/Base.py,sha256=DShsfI6A2ojg42muPFpVtUgTX33pnqT5vtN0SRlr-9Q,8866
13
+ edsl/config.py,sha256=--CQg-zL3-Jm8g5OUWsdWHxI-tEs_EDKCKFREcegYOI,5618
14
+ edsl/conjure/AgentConstructionMixin.py,sha256=qLLYJH02HotVwBUYzaHs4QW0t5nsC3NX15qxQLzEwLI,5702
15
+ edsl/conjure/Conjure.py,sha256=KBmF3d6EjzTI5f-j_cZBowxWQx7jZqezHgfPMkh-h8M,1884
16
+ edsl/conjure/InputData.py,sha256=RdFgkzzayddSTd6vcwBB8LC796YBj94pciwrQx9nBtg,22003
17
+ edsl/conjure/InputDataCSV.py,sha256=m4hHSQogxt7LNcGNxcGRkrbdGy8pIQu5KvXhIEt9i6k,1684
18
+ edsl/conjure/InputDataMixinQuestionStats.py,sha256=Jav5pqYCLSQ1pAbGV8O9VCBu0vL8Q6pteSEhRKrONuw,6256
19
+ edsl/conjure/InputDataPyRead.py,sha256=phGmzVi06jdbcxgngAp_lEawGkJr5dAC2B4ho5IrAy4,3064
20
+ edsl/conjure/InputDataSPSS.py,sha256=lv7NK8lpUfjsWh8h9MpqQrCjJX6Oyg3tIOrXcQYcS_4,223
21
+ edsl/conjure/InputDataStata.py,sha256=WbA7oUGHgHJgugKjakXzpFfzWxTI4bXGGSZLxM1-tEM,224
22
+ edsl/conjure/QuestionOptionMixin.py,sha256=RSLZ7AmA65MfwyxKKjqprR9FdkLP6MsCcmTbJoqu-MM,2870
23
+ edsl/conjure/QuestionTypeMixin.py,sha256=L2vU207aeezlI1OuJ4I4SdtFCWBZzE-mBk7VwnTghO8,892
24
+ edsl/conjure/RawQuestion.py,sha256=lo8k1aln4RfnfeS6OukzwC7P_cRe2LVZxcL6uwmim6A,2116
25
+ edsl/conjure/SurveyResponses.py,sha256=fdJNFasSXVf7S5KCsYE9WB6w17q7VRylzw0aD5zGO_M,191
26
+ edsl/conjure/__init__.py,sha256=1lPYFjV73GzYYSXiTyxopM4nKcXVHumEEo0fe06DbMo,535
27
+ edsl/conjure/examples/placeholder.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
+ edsl/conjure/naming_utilities.py,sha256=8uoGaCPZQKLwz2HudtsFSovivTGumQrFYxXxck5WUZQ,4964
29
+ edsl/conjure/utilities.py,sha256=yRdOJx9KIpWXMx41Bbfysx7Zd4v2ROwca5L4T1rmtQM,5539
30
+ edsl/conversation/Conversation.py,sha256=NdWH62XpcF6hoaG0ScMho_c3TO7PfBnbdlppUN-j07k,7627
31
+ edsl/conversation/car_buying.py,sha256=70nCXQNCc2kR-NBY6YOPHfkuZ5g7nww2r4GwlYosV4A,1948
32
+ edsl/conversation/mug_negotiation.py,sha256=mjvAqErD4AjN3G2za2c-X-3axOShW-zAJUeiJqTxVPA,2616
33
+ edsl/conversation/next_speaker_utilities.py,sha256=bqr5JglCd6bdLc9IZ5zGOAsmN2F4ERiubSMYvZIG7qk,3629
34
+ edsl/coop/__init__.py,sha256=4iZCwJSzJVyjBYk8ggGxY2kZjq9dXVT1jhyPDNyew4I,115
35
+ edsl/coop/coop.py,sha256=Kv6oUOZ9uuxxR59Rn6IG-tB3JaN2z8AnHVW8G-RSLQE,26928
36
+ edsl/coop/utils.py,sha256=BeBcMWWl9Kxjll_WfDQNHbp-6ct9QjVn4ph2V4ph6XE,3347
37
+ edsl/data/Cache.py,sha256=zu0wQ-853tQKgYem5MmnwG4jFbDyWnRukJ_p2Ujb4ug,15217
38
+ edsl/data/CacheEntry.py,sha256=AnZBUautQc19KhE6NkI87U_P9wDZI2eu-8B1XopPTOI,7235
39
+ edsl/data/CacheHandler.py,sha256=DTr8nJnbl_SidhsDetqbshu1DV-njPFiPPosUWTIBok,4789
40
+ edsl/data/SQLiteDict.py,sha256=V5Nfnxctgh4Iblqcw1KmbnkjtfmWrrombROSQ3mvg6A,8979
41
+ edsl/data/__init__.py,sha256=KBNGGEuGHq--D-TlpAQmvv_If906dJc1Gsy028zOx78,170
42
+ edsl/data/orm.py,sha256=Jz6rvw5SrlxwysTL0QI9r68EflKxeEBmf6j6himHDS8,238
43
+ edsl/data_transfer_models.py,sha256=17A3vpxTkJ2DnV8ggTPxwPzwlQAEYn94U4qiBv8hV3o,1026
44
+ edsl/enums.py,sha256=lW4rMKJJ-AsBdtDw_u6TitlNbHkTznorVPjqqmUKPE0,4876
45
+ edsl/exceptions/__init__.py,sha256=HVg-U-rJ0fRoG9Rws6gnK5S9B68SkPWDPsoD6KpMZ-A,1370
46
+ edsl/exceptions/agents.py,sha256=3SORFwFbMGrF6-vAL2GrKEVdPcXo7md_k2oYufnVXHA,673
47
+ edsl/exceptions/configuration.py,sha256=qH2sInNTndKlCLAaNgaXHyRFdKQHL7-dElB_j8wz9g4,351
48
+ edsl/exceptions/coop.py,sha256=xDr7k_Tir6L5AxO6GMmoFyUjZ3DIenPQflpUkaTqJl0,38
49
+ edsl/exceptions/data.py,sha256=K24CjgwFiMWxrF1Z2dF6F7Vfrge_y9kMK_wsYYSaroU,209
50
+ edsl/exceptions/general.py,sha256=ksuqTmy-7kP9H34Cu5fSKC3Q2cZIY4qJ7J9JZGdJLCE,1011
51
+ edsl/exceptions/jobs.py,sha256=sSUATmzBIN1oINWuwPExxPqIWmfCo0XYj_yR4dJzVjo,803
52
+ edsl/exceptions/language_models.py,sha256=KDChmr2rVGa1lj57i9-QGSLYTOeguRYyF2z8FyXEplA,1017
53
+ edsl/exceptions/prompts.py,sha256=vD_reI-RVKWYHYozenEmhmB7Rb1sIiXghgNUtbVGBUo,247
54
+ edsl/exceptions/questions.py,sha256=9z6RI7HRH-UMrnIlt28VTj9deCSbD1Frmpqi0H6YtF0,534
55
+ edsl/exceptions/results.py,sha256=cn6Zb86Y648ulN3RYXb52HGv1NT3ykBfE6g2Xu8TeIw,325
56
+ edsl/exceptions/surveys.py,sha256=lADtr-tvPmUYSfRy3TdkTV5SzZfShlMgCzm-ZGYRlGk,557
57
+ edsl/inference_services/AnthropicService.py,sha256=tjYRJRIvQ7Z6uCYdqxm5ZlVjZdVZCnHtQ6QGHT59PXs,2822
58
+ edsl/inference_services/DeepInfraService.py,sha256=fpjLJl7gyUFWVdR6U7XwIspD_pH5x55f4LamKT01Et4,3853
59
+ edsl/inference_services/GoogleService.py,sha256=IwSwXr7khvHjpDzgiW5PRVKMhI2wQ9D1_H1MRnHjefU,2732
60
+ edsl/inference_services/InferenceServiceABC.py,sha256=H6jW2gDKTLC3xgmqiSBdX4pGY1oauEO8VqGZoB3qvnQ,1790
61
+ edsl/inference_services/InferenceServicesCollection.py,sha256=1ulvUYs2gaJsb7t8Mkua-6_3gff6rJmH72_BbItkaCE,2274
62
+ edsl/inference_services/OpenAIService.py,sha256=OvczbY2wlEehZdaaMq69yeqzkjdrbbXlP8uC9WjgHq0,6021
63
+ edsl/inference_services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
+ edsl/inference_services/models_available_cache.py,sha256=ZT2pBGxJqTgwynthu-SqBjv8zl7ql44q3gA6xy7kqSU,2338
65
+ edsl/inference_services/rate_limits_cache.py,sha256=HYslviz7mxF9U4CUTPAkoyBsiXjSju-YCp4HHir6e34,1398
66
+ edsl/inference_services/registry.py,sha256=-Yz86do-KZraunIrziVs9b95EbY-__JUnQb5Ulni7KI,483
67
+ edsl/inference_services/write_available.py,sha256=NNwhATlaMp8IYY635MSx-oYxt5X15acjAfaqYCo_I1Y,285
68
+ edsl/jobs/Answers.py,sha256=z4TADN-iHIrbMtI1jVyiaetv0OkTv768dFBpREIQC6c,1799
69
+ edsl/jobs/Jobs.py,sha256=IH7DeLEZFBPq32Y8xrKH9hXCDd4t2MsbGFNSf9GaA0o,28825
70
+ edsl/jobs/__init__.py,sha256=aKuAyd_GoalGj-k7djOoVwEbFUE2XLPlikXaA1_8yAg,32
71
+ edsl/jobs/buckets/BucketCollection.py,sha256=LA8DBVwMdeTFCbSDI0S2cDzfi_Qo6kRizwrG64tE8S4,1844
72
+ edsl/jobs/buckets/ModelBuckets.py,sha256=Rlh1gkXzusyb9GAXYJ9spNCmDMr4Cz1lPLSRP8-f2dY,2038
73
+ edsl/jobs/buckets/TokenBucket.py,sha256=CUQDgzwNNJJxWr221Lwmp0KdUd10FFQgBVnMcnyuxCY,5188
74
+ edsl/jobs/interviews/Interview.py,sha256=t-rv-xINajj_YliRIseSJyj984CIu2sxJ0bqCJdn90A,9710
75
+ edsl/jobs/interviews/InterviewStatistic.py,sha256=hY5d2EkIJ96NilPpZAvZZzZoxLXM7ss3xx5MIcKtTPs,1856
76
+ edsl/jobs/interviews/InterviewStatisticsCollection.py,sha256=_ZZ0fnZBQiIywP9Q_wWjpWhlfcPe2cn32GKut10t5RI,788
77
+ edsl/jobs/interviews/InterviewStatusDictionary.py,sha256=MSyys4hOWe1d8gfsUvAPbcKrs8YiPnz8jpufBSJL7SU,2485
78
+ edsl/jobs/interviews/InterviewStatusLog.py,sha256=6u0F8gf5tha39VQL-IK_QPkCsQAYVOx_IesX7TDDX_A,3252
79
+ edsl/jobs/interviews/InterviewStatusMixin.py,sha256=74Efo4fCUWmlBNYPYCrJGLLk5WAbikvl1w1B4ONaKkY,1253
80
+ edsl/jobs/interviews/InterviewTaskBuildingMixin.py,sha256=Gy_giBIpBTV3tfhLc7rZTukLUVoxPsfyvF1yDtwTWU8,11672
81
+ edsl/jobs/interviews/ReportErrors.py,sha256=RSzDU2rWwtjfztj7sqaMab0quCiY-X2bG3AEOxhTim8,1745
82
+ edsl/jobs/interviews/interview_exception_tracking.py,sha256=tIcX92udnkE5fcM5_WXjRF9xgTq2P0uaDXxZf3NQGG0,3271
83
+ edsl/jobs/interviews/interview_status_enum.py,sha256=KJ-1yLAHdX-p8TiFnM0M3v1tnBwkq4aMCuBX6-ytrI8,229
84
+ edsl/jobs/interviews/retry_management.py,sha256=9Efn4B3aV45vbocnF6J5WQt88i2FgFjoi5ALzGUukEE,1375
85
+ edsl/jobs/runners/JobsRunnerAsyncio.py,sha256=GuOhSFud6JQ2bBUK9p99ij-VMe6A9bLFmjtJy0lnDSI,11840
86
+ edsl/jobs/runners/JobsRunnerStatusData.py,sha256=-mxcmX0a38GGO9DQ-ItTmj6mvCUk5uC-UudT77lXTG4,10327
87
+ edsl/jobs/runners/JobsRunnerStatusMixin.py,sha256=yxnXuOovwHgfDokNuluH_qulBcM0gCcbpCQibqVKXFI,3137
88
+ edsl/jobs/tasks/QuestionTaskCreator.py,sha256=SXO_ITNPAXh9oBvCh8rcbH9ln0VjOyuM_i2IrRDHnIo,10231
89
+ edsl/jobs/tasks/TaskCreators.py,sha256=DbCt5BzJ0CsMSquqLyLdk8el031Wst7vCszVW5EltX8,2418
90
+ edsl/jobs/tasks/TaskHistory.py,sha256=ZVellGW1cvwqdHt98dYPl0FYhk3VqRGHAZETDOxEkqg,10939
91
+ edsl/jobs/tasks/TaskStatusLog.py,sha256=bqH36a32F12fjX-M-4lNOhHaK2-WLFzKE-r0PxZPRjI,546
92
+ edsl/jobs/tasks/task_management.py,sha256=KMToZuXzMlnHRHUF_VHL0-lHMTGhklf2GHVuwEEHtzA,301
93
+ edsl/jobs/tasks/task_status_enum.py,sha256=DOyrz61YlIS8R1W7izJNphcLrJ7I_ReUlfdRmk23h0Q,5333
94
+ edsl/jobs/tokens/InterviewTokenUsage.py,sha256=u_6-IHpGFwZ6qMEXr24-jyLVUSSp4dSs_4iAZsBv7O4,1100
95
+ edsl/jobs/tokens/TokenUsage.py,sha256=odj2-wDNEbHl9noyFAQ0DSKV0D9cv3aDOpmXufKZ8O4,1323
96
+ edsl/language_models/LanguageModel.py,sha256=ighiMbpkppcDMlW0s-5PYsPOUTFIpbDfdO6Cr87JUjo,18886
97
+ edsl/language_models/ModelList.py,sha256=DLeAq7o8uniZkP_-z8vJDMwf4JXksqLoPqOeeLI3QBE,2687
98
+ edsl/language_models/RegisterLanguageModelsMeta.py,sha256=2bvWrVau2BRo-Bb1aO-QATH8xxuW_tF7NmqBMGDOfSg,8191
99
+ edsl/language_models/__init__.py,sha256=bvY7Gy6VkX1gSbNkRbGPS-M1kUnb0EohL0FSagaEaTs,109
100
+ edsl/language_models/registry.py,sha256=J7blAbRFHxr2nWSoe61G4p-6kOgzUlKclJ55xVldKWc,3191
101
+ edsl/language_models/repair.py,sha256=xaNunBRpMWgceSPOzk-ugp5WXtgLuuhj23TgXUeOobw,5963
102
+ edsl/language_models/unused/ReplicateBase.py,sha256=J1oqf7mEyyKhRwNUomnptVqAsVFYCbS3iTW0EXpKtXo,3331
103
+ edsl/notebooks/Notebook.py,sha256=tv5D-ZTNcYcheG3UJu5MAiM0urHw2Au1CjdTN5t5FBU,7114
104
+ edsl/notebooks/__init__.py,sha256=VNUA3nNq04slWNbYaNrzOhQJu3AZANpvBniyCJSzJ7U,45
105
+ edsl/prompts/Prompt.py,sha256=12cbeQTKqfVQGpd1urqKZeXiDtKz2RAJqftoXS3q-DE,10070
106
+ edsl/prompts/QuestionInstructionsBase.py,sha256=xico6ob4cqWsHl-txj2RbY_4Ny5u9UqvIjmoTVgjUhk,348
107
+ edsl/prompts/__init__.py,sha256=Z0ywyJfnV0i-sR1SCdK4mHhgECT5cXpHVA-pKuBTifc,85
108
+ edsl/prompts/library/agent_instructions.py,sha256=_2kCDYvh3ZOF72VvcIH5jhmHjM6AAgQdkWrHvR52Yhg,1100
109
+ edsl/prompts/library/agent_persona.py,sha256=jEl1LjlOP67vOPiRW0S_-TRMz3n6Tp3mPRvltM2r2_k,516
110
+ edsl/prompts/library/question_budget.py,sha256=RAc7pmQRbs_-xksU52yYl8iqJ7HejPY4sQOlCSQLGWs,1190
111
+ edsl/prompts/library/question_checkbox.py,sha256=NIGcdnfkJ8_XbGsdq9toeWA_phQVx5FIBOAe0mReXJw,1462
112
+ edsl/prompts/library/question_extract.py,sha256=QxNiNBjUk25Ss_Pax0iDgmgTYXEycpWJk2z0evmqsP0,775
113
+ edsl/prompts/library/question_freetext.py,sha256=_I7hcniRfVwmZr2wXAasfbZ0GTu41ZIKfcoixGhzZUI,510
114
+ edsl/prompts/library/question_linear_scale.py,sha256=sQpgjSvqJU-uQti-DCxOzLzj05ENkpyxmH-qTFq39x0,778
115
+ edsl/prompts/library/question_list.py,sha256=KYi3gtcWyDzRLyAb2-k7C-QJ9TAfbLGPkWVvVmdT6xg,731
116
+ edsl/prompts/library/question_multiple_choice.py,sha256=_2LUM9bOInODoFyaTrKfMkcb5Z7RDj_odq5iAnD7KVQ,1617
117
+ edsl/prompts/library/question_numerical.py,sha256=ZdWnDbTU0gQdMMqcWHw_eIHEZkJ_kuE-XWrnCYFR07w,1456
118
+ edsl/prompts/library/question_rank.py,sha256=WDgXyph0EKWJrSgsW2eqcx3xdU-WA1LEvB2jvQFOQ8s,882
119
+ edsl/prompts/prompt_config.py,sha256=O3Y5EvBsCeKs9m9IjXiRXOcHWlWvQV0yqsNb2oSR1ow,974
120
+ edsl/prompts/registry.py,sha256=XOsqGsvNOmIG83jqoszqI72yNZkkszKR4FrEhwSzj_Q,8093
121
+ edsl/questions/AnswerValidatorMixin.py,sha256=U5i79HoEHpSoevgtx68TSg8a9tELq3R8xMtYyK1L7DQ,12106
122
+ edsl/questions/QuestionBase.py,sha256=L0-IMnSGiUh5Uw7kFDsPV057mR9tL9aMwHUtxjLlKsg,19017
123
+ edsl/questions/QuestionBudget.py,sha256=K8cc1YOfoLWRoZBAkWO7WsMDZne0a5oAJMSxv2Jzd1E,6143
124
+ edsl/questions/QuestionCheckBox.py,sha256=YHS-LEvR_1CWyg4usOlWfj9Gb_cCQlfIWIWhYRWn7Wo,6129
125
+ edsl/questions/QuestionExtract.py,sha256=fjnsNLS2fNW6dfFuRyc2EgKEHx8ujjONmg2nSRynje4,3988
126
+ edsl/questions/QuestionFreeText.py,sha256=umLzZvhDcJlmPwev4z5VFV6cIO-omifPtyBR3EQc4mk,3173
127
+ edsl/questions/QuestionFunctional.py,sha256=s49mQBVGc7B4-3sX49_a_mgVZsR9bdPra2VYe4m8XoY,3961
128
+ edsl/questions/QuestionList.py,sha256=Wf7xDXJsQBsAD_yOrzZ_GstKGT7aZjimTkU6qyqOhhM,4051
129
+ edsl/questions/QuestionMultipleChoice.py,sha256=wnYcuAonfeRGSpfO2rCuJWiN5MEJm4PxDHMo0GkHRe4,4494
130
+ edsl/questions/QuestionNumerical.py,sha256=QArFDhP9Adb4l6y-udnUqPNk2Q6vT4pGsY13TkHsLGs,3631
131
+ edsl/questions/QuestionRank.py,sha256=NEAwDt1at0zEM2S-E7jXMjglnlB0WhUlxSVJkzH4xSs,5876
132
+ edsl/questions/RegisterQuestionsMeta.py,sha256=unON0CKpW-mveyhg9V3_BF_GYYwytMYP9h2ZZPetVNM,1994
133
+ edsl/questions/SimpleAskMixin.py,sha256=YRLiHA6TPMKyLWvdAi7Mfnxcqtw7Kem6tH28YNb8n4U,2227
134
+ edsl/questions/__init__.py,sha256=U7t2dk_dHSaFRciHETXaGaJRnCobaik3mIKCpGRUuJo,1160
135
+ edsl/questions/compose_questions.py,sha256=ZcLkwNaofk-o0-skGXEDGZAj6DumOhVhyIUjqEnKrbg,3380
136
+ edsl/questions/derived/QuestionLikertFive.py,sha256=zKkjKI3HSt9ZGyBBNgXNsfXZ7gOoOknidLDPgMN_PcI,2475
137
+ edsl/questions/derived/QuestionLinearScale.py,sha256=7tybIaMaDTMkTFC6CymusW69so-zf5jUn8Aqf5pw__Y,2673
138
+ edsl/questions/derived/QuestionTopK.py,sha256=TouXKZt_h6Jd-2rAjkEOCJOzzei4Wa-3hjYq9CLxWws,2744
139
+ edsl/questions/derived/QuestionYesNo.py,sha256=KtMGuAPYWv-7-9WGa0fIS2UBxf6KKjFpuTk_h8FPZbg,2076
140
+ edsl/questions/derived/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
141
+ edsl/questions/descriptors.py,sha256=kqjV3pRbyq0ch-fSg4vkTz1ZH3ckud5Pd1HzR-R7pdE,13310
142
+ edsl/questions/question_registry.py,sha256=ZD7Y_towDdlnnmLq12vVewgQ3fEk9Ur0tCTWK8-WqeQ,5241
143
+ edsl/questions/settings.py,sha256=er_z0ZW_dgmC5CHLWkaqBJiuWgAYzIund85M5YZFQAI,291
144
+ edsl/results/Dataset.py,sha256=DZgb3vIj69ON7APQ6DimjBwAS1xZvZiXOg68CjW9E3I,8662
145
+ edsl/results/DatasetExportMixin.py,sha256=KktaYseAewdl2HyYePDlBAkomhnWFvH5yPaMB_UPtJA,17961
146
+ edsl/results/Result.py,sha256=EqIP8EAL9svpgUuHx5_DRYUtSbkZAffz7EONNNEf31Y,12735
147
+ edsl/results/Results.py,sha256=FuwUbcsa0rK3OWX4-nFUBq0egAeVVz7-Zgc8UAH3GkA,36326
148
+ edsl/results/ResultsDBMixin.py,sha256=Vs95zbSB4G7ENY4lU7OBdekg9evwTrtPH0IIL2NAFTk,7936
149
+ edsl/results/ResultsExportMixin.py,sha256=XizBsPNxziyffirMA4kS7UHpYM1WIE4s1K-B7TqTfDw,1266
150
+ edsl/results/ResultsFetchMixin.py,sha256=VEa0TKDcXbnTinSKs9YaE4WjOSLmlp9Po1_9kklFvSo,848
151
+ edsl/results/ResultsGGMixin.py,sha256=SAYz8p4wb1g8x6KhBVz9NHOGib2c2XsqtTclpADrFeM,4344
152
+ edsl/results/ResultsToolsMixin.py,sha256=I19kAO-BKszgjxzMljE1W8ZsOnpozmO2nc43-XBbrZk,2976
153
+ edsl/results/__init__.py,sha256=2YcyiVtXi-3vIV0ZzOy1PqBLm2gaziufJVi4fdNrAt8,80
154
+ edsl/scenarios/FileStore.py,sha256=sQAhmi7hXzfI9y-q3hOiBbTd-BAIRw9FusMyefM4mSI,4460
155
+ edsl/scenarios/Scenario.py,sha256=KCMze1PL0uxLMrqaneEXZBDc65q7AUV71zZIEmeGSVo,14766
156
+ edsl/scenarios/ScenarioHtmlMixin.py,sha256=EmugmbPJYW5eZS30rM6pDMDQD9yrrvHjmgZWB1qBfq4,1882
157
+ edsl/scenarios/ScenarioImageMixin.py,sha256=VJ5FqyPrL5-ieORlWMpnjmOAFIau8QFZCIZyEBKgb6I,3530
158
+ edsl/scenarios/ScenarioList.py,sha256=9oxTglFTmKtkBexyNOLhIxocs1Jycuqf84OumHGsoII,18629
159
+ edsl/scenarios/ScenarioListExportMixin.py,sha256=h5_yc__e6XolY6yP6T8cka5zU1mko8T5xbIQtYijNWQ,1003
160
+ edsl/scenarios/ScenarioListPdfMixin.py,sha256=sRCHVG7z4u4ST4ce-I_Y4md8ZzC9-tj4an9PMouaHVg,3765
161
+ edsl/scenarios/__init__.py,sha256=KRwZCLf2R0qyJvv1NGbd8M51Bt6Ia6Iylg-Xq_2Fa6M,98
162
+ edsl/shared.py,sha256=lgLa-mCk2flIhxXarXLtfXZjXG_6XHhC2A3O8yRTjXc,20
163
+ edsl/study/ObjectEntry.py,sha256=e3xRPH8wCN8Pum5HZsQRYgnSoauSvjXunIEH79wu5A8,5788
164
+ edsl/study/ProofOfWork.py,sha256=FaqYtLgeiTEQXWKukPgPUTWMcIN5t1FR7h7Re8QEtgc,3433
165
+ edsl/study/SnapShot.py,sha256=-5zoP4uTvnqtu3zRNMD-fKsNAVYX9psoKRADfotsF9E,2439
166
+ edsl/study/Study.py,sha256=Rh4Wq4Qxlpb5fOBsrMIXYfiCn-THBS9mk11AZjOzmGw,16934
167
+ edsl/study/__init__.py,sha256=YAvPLTPG3hK_eN9Ar3d1_d-E3laXpSya879A25-JAxU,170
168
+ edsl/surveys/DAG.py,sha256=ozQuHo9ZQ8Eet5nDXtp7rFpiSocvvfxIHtyTnztvodg,2380
169
+ edsl/surveys/Memory.py,sha256=-ikOtkkQldGB_BkPCW3o7AYwV5B_pIwlREw7aVCSHaQ,1113
170
+ edsl/surveys/MemoryPlan.py,sha256=BeLuqS5Q8G2jSluHYFCAxVmj7cNPK-rDQ3mUsuDjikQ,7979
171
+ edsl/surveys/Rule.py,sha256=ddZyZSObs4gsKtFSmcXkPigXDX8rrh1NFvAplP02TcA,11092
172
+ edsl/surveys/RuleCollection.py,sha256=sN7aYDQJG3HmE-WxohgpctcQbHewjwE6NAqEVTxvFP8,13359
173
+ edsl/surveys/Survey.py,sha256=q-AbzbyOsRZw_zRLrdDOM7y5kYQT6XlgYKQfxjdm1AQ,47107
174
+ edsl/surveys/SurveyCSS.py,sha256=NjJezs2sTlgFprN6IukjGKwNYmNdXnLjzV2w5K4z4RI,8415
175
+ edsl/surveys/SurveyExportMixin.py,sha256=vj9bZReHx0wBK9sVuS0alzPIUDdg6AFFMd7bl1RKWKI,6555
176
+ edsl/surveys/SurveyFlowVisualizationMixin.py,sha256=Z-YqeedMqWOtCFy003YJ9aneJ1n4bn70lDoILwLtTc0,3966
177
+ edsl/surveys/__init__.py,sha256=vjMYVlP95fHVqqw2FfKXRuYbTArZkZr1nK4FnXzZWzs,129
178
+ edsl/surveys/base.py,sha256=n5PBx0BF0powzBXCsufpUekfNK_9huf3rohtU1mMCq0,1001
179
+ edsl/surveys/descriptors.py,sha256=3B-hBVvGpLlVBCyOnPuxkLjesvpr0QIuATbggp_MJ7o,2076
180
+ edsl/tools/__init__.py,sha256=4iRiX1K0Yh8RGwlUBuzipvFfRrofKqCRQ0SzNK_2oiQ,41
181
+ edsl/tools/clusters.py,sha256=uvDN76bfHIHS-ykB2iioXu0gKeP_UyD7Q9ee67w_fV4,6132
182
+ edsl/tools/embeddings.py,sha256=-mHqApiFbGzj_2Cr_VVl_7XiBBDyPB5-6ZO7IsXvaig,677
183
+ edsl/tools/embeddings_plotting.py,sha256=fznAqLnjF_K8PkJy1C4hBRObm3f8ebDIxQzrqRXlEJM,3564
184
+ edsl/tools/plotting.py,sha256=DbVNlm8rNCnWHXi5wDPnOviZ1Qxz-rHvtQM1zHWw1f8,3120
185
+ edsl/tools/summarize.py,sha256=YcdB0IjZn92qv2zVJuxsHfXou810APWYKeaHknsATqM,656
186
+ edsl/utilities/SystemInfo.py,sha256=qTP_aKwECPxtTnbEjJ7F1QqKU9U3rcEEbppg2ilQGuY,792
187
+ edsl/utilities/__init__.py,sha256=oUWx_h-8OFb1Of2SgIQZuIu7hX_bhDuwCSwksKGWZ6k,544
188
+ edsl/utilities/ast_utilities.py,sha256=49KDDu-PHYpzDN5cCaDf-ReQH-1dzjT5EG3WVSa8THk,868
189
+ edsl/utilities/data/Registry.py,sha256=q2DKc7CpG_7l47MxxsSi6DJOs4p1Z3qNx7PV-v8CUOE,176
190
+ edsl/utilities/data/__init__.py,sha256=pDjGnzC11q4Za8qX5zcg6plcQ_8Qjpb-sAKPwOlKmCY,62
191
+ edsl/utilities/data/scooter_results.json,sha256=tRtVAI5haLMh_-wjz9it_uk_I1bGe5qdFHsIRQMi_ks,250944
192
+ edsl/utilities/decorators.py,sha256=rlTSMItwmWUxHQBIEUDxX3lFzgtiT8PnfNavakuf-2M,2319
193
+ edsl/utilities/gcp_bucket/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
194
+ edsl/utilities/gcp_bucket/cloud_storage.py,sha256=dStHsG181YP9ALW-bkyO-sgMWuLV5aaLsnsCOVD8jJw,3472
195
+ edsl/utilities/gcp_bucket/simple_example.py,sha256=pR_IH_Y640_-YnEyNpE7V_1MtBFC9nD3dg2NdSVcuXY,251
196
+ edsl/utilities/interface.py,sha256=AaKpWiwWBwP2swNXmnFlIf3ZFsjfsR5bjXQAW47tD-8,19656
197
+ edsl/utilities/repair_functions.py,sha256=tftmklAqam6LOQQu_-9U44N-llycffhW8LfO63vBmNw,929
198
+ edsl/utilities/restricted_python.py,sha256=5-_zUhrNbos7pLhDl9nr8d24auRlquR6w-vKkmNjPiA,2060
199
+ edsl/utilities/utilities.py,sha256=oU5Gg6szTGqsJ2yBOS0aC3XooezLE8By3SdrQLLpqvA,10107
200
+ edsl-0.1.29.dist-info/LICENSE,sha256=_qszBDs8KHShVYcYzdMz3HNMtH-fKN_p5zjoVAVumFc,1111
201
+ edsl-0.1.29.dist-info/METADATA,sha256=-nDfE3d1qhpsEUtI8rVmC-JIl8HPCy4g6Yyy3aBLfk0,4098
202
+ edsl-0.1.29.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
203
+ edsl-0.1.29.dist-info/RECORD,,
@@ -1,327 +0,0 @@
1
- from collections import UserDict
2
- from typing import List, Dict, Optional
3
- import textwrap
4
- import re
5
-
6
- from edsl.questions.QuestionBase import QuestionBase
7
- from edsl.questions.QuestionFreeText import QuestionFreeText
8
-
9
- from edsl.conjure.utilities import convert_value, Missing
10
-
11
-
12
- class KeyValidator:
13
- """A class to represent a key validator.
14
-
15
- >>> k = KeyValidator()
16
- >>> k.validate_key("asdf")
17
- True
18
- >>> k.validate_key("ASDF")
19
- False
20
-
21
- """
22
-
23
- def __set_name__(self, owner, name):
24
- self.name = name
25
-
26
- def validate_key(self, key):
27
- if not isinstance(key, str):
28
- # "Key must be a string"
29
- return False
30
- if key.lower() != key:
31
- # "Key must be lowercase"
32
- return False
33
- if not key.isidentifier() or not re.match(r"^[a-zA-Z_][a-zA-Z0-9_]*$", key):
34
- # raise ValueError("Key must be a valid Python identifier")
35
- return False
36
- return True
37
-
38
-
39
- class ReplacementFinder:
40
- """This class finds a replacement name for a bad question name.
41
-
42
- >>> r = ReplacementFinder(lookup_dict = {'Poop ': 'poop'})
43
- >>> r('Poop ')
44
- 'poop'
45
-
46
- """
47
-
48
- def __init__(self, lookup_dict: Optional[dict] = None):
49
- if lookup_dict is None:
50
- lookup_dict = {}
51
-
52
- self.lookup_dict = lookup_dict
53
-
54
- def __call__(self, bad_question_name):
55
- """Finds a replacement name for a bad question name.
56
- TODO: We should add a check to see if the new name is already in use.
57
- """
58
- if bad_question_name in self.lookup_dict:
59
- return self.lookup_dict[bad_question_name]
60
-
61
- q = QuestionFreeText(
62
- question_text=f"""We have a survey with a question name: {bad_question_name}.
63
- The question name is not a valid Python identifier.
64
- We need a valid Python identifier to use as a column name in a dataframe.
65
- What would be a better name for this question?
66
- Shorter is better.
67
- Just return the proposed identifier with no other text.
68
- """,
69
- question_name="identifier",
70
- )
71
- new_identifer = q.run().select("identifier").first().lower()
72
- self.lookup_dict[bad_question_name] = new_identifer
73
- return new_identifer
74
-
75
- def __repr__(self):
76
- return f"ReplacementFinder({self.lookup_dict})"
77
-
78
- def to_json(self):
79
- return self.lookup_dict
80
-
81
- @classmethod
82
- def from_json(cls, json_dict):
83
- return cls(json_dict)
84
-
85
-
86
- get_replacement_name = ReplacementFinder({})
87
-
88
-
89
- class CustomDict(UserDict):
90
- """
91
- This class is a dictionary that only allows lowercase keys that are valid Python identifiers.
92
- If a key is not a valid Python identifier, it will be replaced with a valid Python identifier.
93
-
94
- >>> d = CustomDict()
95
- >>> d = CustomDict({"7asdf": 123, "FAMILY": 12})
96
- >>> d
97
- {'q7asdf': 123, 'family': 12}
98
- """
99
-
100
- key_validator = KeyValidator()
101
-
102
- def __init__(self, data=None, verbose=False):
103
- super().__init__()
104
- self.verbose = verbose
105
- if data:
106
- for key, value in data.items():
107
- self[key] = value
108
-
109
- def __setitem__(self, key, value):
110
- if key != key.lower():
111
- key = key.lower()
112
- while not self.key_validator.validate_key(key):
113
- if self.verbose:
114
- print(f"Column heading incapable of being a key: {key}")
115
- if key in get_replacement_name.lookup_dict:
116
- key = get_replacement_name.lookup_dict[key]
117
- else:
118
- key = get_replacement_name(key)
119
- if self.verbose:
120
- print(f"New key: {key}")
121
- super().__setitem__(key, value)
122
-
123
-
124
- class RawResponseColumn:
125
- """A class to represent a raw responses from a survey we are parsing.
126
-
127
- If the dataset was square, we would think of this as a column in a dataframe.
128
-
129
- """
130
-
131
- def __init__(
132
- self,
133
- question_name: str,
134
- raw_responses: List[str],
135
- answer_codebook: Dict[str, str],
136
- question_text: str,
137
- ):
138
- """
139
- :param question_name: The name of the question.
140
- :param raw_responses: A list of responses to the question.
141
- :param answer_codebook: A dictionary mapping the raw responses to the actual responses.
142
- :param question_text: The text of the question.
143
-
144
- >>> r = RawResponseColumn(question_name="Q1", raw_responses=["1", "2", "3"], answer_codebook={"1": "Yes", "2": "No"}, question_text="Do you like ice cream?")
145
- >>> r.responses
146
- ['Yes', 'No', '3']
147
- >>> r.question_name
148
- 'q1'
149
-
150
- >>> r = RawResponseColumn(question_name="Q1", raw_responses=["1", "2", "3"], answer_codebook={"1": "Yes", "2": "No"}, question_text="Do you like ice cream?")
151
- >>> r.inferred_question_type
152
- 'multiple_choice'
153
-
154
- """
155
- d = CustomDict(
156
- {question_name: ""}
157
- ) # if the question_name is not a valid Python identifier, it will be replaced with a valid Python identifier.
158
- self.question_name = list(d.keys())[0]
159
- self.raw_responses = raw_responses
160
- self.answer_codebook = answer_codebook
161
- if question_text is None or len(question_text) == 0:
162
- self.question_text = "Question text not available"
163
- else:
164
- self.question_text = question_text
165
-
166
- @staticmethod
167
- def edsl_question_inference(question_text, responses):
168
- """Infer the question type from the responses.
169
-
170
- TODO: Not currently used. We should use this to infer the question type.
171
-
172
- >>> from edsl import QuestionFreeText
173
- >>> q = QuestionFreeText(question_text="Tell me about your childhood.", question_name = 'color')
174
- >>> r = RawResponseColumn.edsl_question_inference(q.question_text, ["Rather not say", "Happy!", "luge lessons and meat helmets"])
175
- >>> r
176
- 'free_text'
177
-
178
- """
179
- from edsl.questions import QuestionMultipleChoice
180
-
181
- q = QuestionMultipleChoice(
182
- question_text="""We have a survey question and we are trying to infer its type.
183
- The question text is: '{{question_text}}'.
184
- The first few responses are: '{{responses}}'.
185
- """,
186
- question_name="infer_question_type",
187
- question_options=[
188
- "budget",
189
- "checkbox",
190
- "extract",
191
- "free_text",
192
- "likert_five",
193
- "linear_scale",
194
- "list",
195
- "multiple_choice",
196
- "numerical",
197
- "rank",
198
- "top_k",
199
- "yes_no",
200
- ],
201
- )
202
- response = (
203
- q.to_survey()(question_text=question_text, responses=responses)
204
- .select("infer_question_type")
205
- .first()
206
- )
207
- return response
208
-
209
- @property
210
- def responses(self):
211
- """Returns the responses, with the answer codebook applied."""
212
- if hasattr(self, "answer_codebook") is None:
213
- converted_responses = [convert_value(x) for x in self.raw_responses]
214
- return converted_responses
215
- else:
216
- return [self.answer_codebook.get(x, x) for x in self.raw_responses]
217
-
218
- @property
219
- def inferred_question_type(self):
220
- "Tries to infer the type of question from the responses and other information"
221
- max_items = 15
222
- options = list(self.unique_responses.keys())
223
- if len(options) > max_items or len(options) <= 1:
224
- return "free_text"
225
- else:
226
- cv = [convert_value(o) for o in options]
227
- return "multiple_choice"
228
-
229
- def get_ordering(self, options_list):
230
- """Returns a multiple choice question with the options in the correct order.
231
- For example, if the options are ["<10", "10-20", "30+", "20-30"], the question would be:
232
- """
233
- from edsl.questions.QuestionList import QuestionList
234
-
235
- q = QuestionList(
236
- question_text=textwrap.dedent(
237
- """\
238
- We have a survey question with the following options: '{{options_list}}'.
239
- The options might be out of order. Please put them in the correct order.
240
- If there is not natural order, just put then in order they were presented.
241
- """
242
- ),
243
- question_name="ordering",
244
- )
245
-
246
- return q.to_survey()(options_list=options_list).select("ordering").first()
247
-
248
- def to_question(self) -> QuestionBase:
249
- """Returns a Question object."""
250
- d = {}
251
- d["question_name"] = self.question_name
252
- d["question_text"] = self.question_text
253
- d["question_type"] = self.inferred_question_type
254
- if d["question_type"] == "multiple_choice":
255
- d["question_options"] = self.get_ordering(list(self.unique_responses))
256
- return QuestionBase.from_dict(d)
257
-
258
- @property
259
- def unique_responses(self) -> set:
260
- """Returns the unique responses for a given question; useful to build up mulitple choice questions.
261
-
262
- >>> r = RawResponseColumn(question_name="Q1", raw_responses=["1", "2", "3"], answer_codebook={"1": "Yes", "2": "No"}, question_text="Do you like ice cream?")
263
- >>> r.unique_responses
264
- {'Yes', 'No', '3'}
265
- """
266
- from collections import defaultdict
267
-
268
- s = defaultdict(int)
269
- for response in self.responses:
270
- if isinstance(response, Missing):
271
- continue
272
- else:
273
- s[str(response)] += 1
274
- return s
275
-
276
- def response_category(self):
277
- """Returns the inferred category of the question."""
278
- from edsl.questions import QuestionMultipleChoice
279
-
280
- q = QuestionMultipleChoice(
281
- question_text=textwrap.dedent(
282
- f"""\
283
- I have data from a survey. One of the column labels: {self.question_text}.
284
- I want to know what the data represents."""
285
- ),
286
- question_options=[
287
- "Something asked of the respondent that interested the survey company",
288
- "A fixed characteristic of the respondent, like gender or age",
289
- "Measured by survey company like an internal code or start of the interview",
290
- ],
291
- question_name="opinion_or_characteristic",
292
- )
293
- result = q.run().select("opinion_or_characteristic").first()
294
- return result
295
-
296
- def __repr__(self):
297
- raw_response_display = self.raw_responses[0 : min(len(self.responses), 5)]
298
- if len(self.responses) > 5:
299
- raw_response_display.append("...")
300
-
301
- raw_response_display = self.responses[0 : min(len(self.responses), 5)]
302
- if len(self.responses) > 5:
303
- raw_response_display.append("...")
304
-
305
- return f"""RawResponseColumn(question_name="{self.question_name}", question_text="{self.question_text}", raw_responses={raw_response_display}, responses={raw_response_display}, unqiue_responses={self.unique_responses}, answer_codebook={self.answer_codebook})"""
306
-
307
-
308
- if __name__ == "__main__":
309
- import doctest
310
-
311
- doctest.testmod()
312
- # d = CustomDict()
313
- # d = CustomDict({"7asdf": 123, "FAMILY": 12})
314
- # d["a"] = 123
315
- # d["#_family_members"] = 4
316
-
317
- # d["FAMILY_MEMBERS"] = 12
318
- # d["0x1389"] = 123
319
- # print(d)
320
- # r = RawResponseColumn(
321
- # question_name="_x family MeMbers",
322
- # raw_responses=["1", "2", "3"],
323
- # question_text="fake",
324
- # answer_codebook={},
325
- # )
326
-
327
- # get_replacement_name