Spaces:
Running
Running
studyvariables
#3
by
akera
- opened
- .gitignore +1 -4
- .gradio/certificate.pem +0 -31
- app.py +169 -452
- config.py +0 -2
- config/pdf_config.yaml +0 -0
- data/.keep +0 -0
- data/ebscohost_zotero_items.json +0 -0
- data/exportedris-file-1-of-1-1_zotero_items.json +0 -813
- data/kayongo-papers_zotero_items.json +0 -222
- interface.py +0 -47
- rag/rag_pipeline.py +41 -156
- rag/rag_pipeline_backup.py +0 -94
- requirements.txt +1 -4
- study_files.json +1 -3
- study_files_backup.json +0 -13
- utils/helpers.py +7 -60
- utils/pdf_processor.py +0 -193
- utils/prompts.py +0 -2
- utils/zotero_manager.py +1 -3
.gitignore
CHANGED
@@ -171,7 +171,4 @@ poetry.toml
|
|
171 |
|
172 |
# LSP config files
|
173 |
pyrightconfig.json
|
174 |
-
|
175 |
-
# data
|
176 |
-
# data/
|
177 |
-
study_export_*
|
|
|
171 |
|
172 |
# LSP config files
|
173 |
pyrightconfig.json
|
174 |
+
phase-1.png
|
|
|
|
|
|
.gradio/certificate.pem
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
-----BEGIN CERTIFICATE-----
|
2 |
-
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
|
3 |
-
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
|
4 |
-
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
|
5 |
-
WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
|
6 |
-
ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
|
7 |
-
MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
|
8 |
-
h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
|
9 |
-
0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
|
10 |
-
A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
|
11 |
-
T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH
|
12 |
-
B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC
|
13 |
-
B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv
|
14 |
-
KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn
|
15 |
-
OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn
|
16 |
-
jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw
|
17 |
-
qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI
|
18 |
-
rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
|
19 |
-
HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq
|
20 |
-
hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
|
21 |
-
ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ
|
22 |
-
3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK
|
23 |
-
NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5
|
24 |
-
ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur
|
25 |
-
TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC
|
26 |
-
jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc
|
27 |
-
oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq
|
28 |
-
4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
|
29 |
-
mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
|
30 |
-
emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
|
31 |
-
-----END CERTIFICATE-----
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
@@ -1,146 +1,32 @@
|
|
1 |
-
# app.py
|
2 |
-
|
3 |
-
import csv
|
4 |
-
|
5 |
-
import datetime
|
6 |
-
|
7 |
-
# from datetime import datetime
|
8 |
-
import io
|
9 |
import json
|
10 |
-
import
|
11 |
import os
|
12 |
-
from typing import Tuple, List, Any
|
13 |
|
14 |
import gradio as gr
|
15 |
-
import openai
|
16 |
from dotenv import load_dotenv
|
17 |
from slugify import slugify
|
18 |
|
19 |
-
from config import STUDY_FILES
|
20 |
from rag.rag_pipeline import RAGPipeline
|
21 |
-
from utils.helpers import
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
25 |
)
|
26 |
-
|
27 |
-
from utils.zotero_manager import ZoteroManager
|
28 |
|
29 |
-
from
|
30 |
-
from utils.
|
31 |
|
32 |
-
# Configure logging
|
33 |
-
logging.basicConfig(level=logging.INFO)
|
34 |
-
logger = logging.getLogger(__name__)
|
35 |
load_dotenv()
|
36 |
|
37 |
openai.api_key = OPENAI_API_KEY
|
38 |
|
39 |
-
# Initialize ChromaDB with study files
|
40 |
-
add_study_files_to_chromadb("study_files.json", "study_files_collection")
|
41 |
-
|
42 |
# Cache for RAG pipelines
|
43 |
rag_cache = {}
|
44 |
|
45 |
-
|
46 |
-
def get_rag_pipeline(study_name: str) -> RAGPipeline:
|
47 |
-
"""Get or create a RAGPipeline instance for the given study by querying ChromaDB."""
|
48 |
-
if study_name not in rag_cache:
|
49 |
-
collection = chromadb_client.get_or_create_collection("study_files_collection")
|
50 |
-
result = collection.get(ids=[study_name]) # Retrieve document by ID
|
51 |
-
|
52 |
-
if not result or len(result["metadatas"]) == 0:
|
53 |
-
raise ValueError(f"Invalid study name: {study_name}")
|
54 |
-
|
55 |
-
study_file = result["metadatas"][0].get("file_path")
|
56 |
-
if not study_file:
|
57 |
-
raise ValueError(f"File path not found for study name: {study_name}")
|
58 |
-
|
59 |
-
rag_cache[study_name] = RAGPipeline(study_file)
|
60 |
-
|
61 |
-
return rag_cache[study_name]
|
62 |
-
|
63 |
-
|
64 |
-
def get_study_info(study_name: str) -> str:
|
65 |
-
"""Retrieve information about the specified study."""
|
66 |
-
|
67 |
-
collection = chromadb_client.get_or_create_collection("study_files_collection")
|
68 |
-
result = collection.get(ids=[study_name]) # Query by study name (as a list)
|
69 |
-
logging.info(f"Result: ======> {result}")
|
70 |
-
|
71 |
-
if not result or len(result["metadatas"]) == 0:
|
72 |
-
raise ValueError(f"Invalid study name: {study_name}")
|
73 |
-
|
74 |
-
study_file = result["metadatas"][0].get("file_path")
|
75 |
-
logging.info(f"study_file: =======> {study_file}")
|
76 |
-
if not study_file:
|
77 |
-
raise ValueError(f"File path not found for study name: {study_name}")
|
78 |
-
|
79 |
-
with open(study_file, "r") as f:
|
80 |
-
data = json.load(f)
|
81 |
-
return f"### Number of documents: {len(data)}"
|
82 |
-
|
83 |
-
|
84 |
-
def markdown_table_to_csv(markdown_text: str) -> str:
|
85 |
-
"""Convert a markdown table to CSV format."""
|
86 |
-
lines = [line.strip() for line in markdown_text.split("\n") if line.strip()]
|
87 |
-
table_lines = [line for line in lines if line.startswith("|")]
|
88 |
-
|
89 |
-
if not table_lines:
|
90 |
-
return ""
|
91 |
-
|
92 |
-
csv_data = []
|
93 |
-
for line in table_lines:
|
94 |
-
if "---" in line:
|
95 |
-
continue
|
96 |
-
# Split by |, remove empty strings, and strip whitespace
|
97 |
-
cells = [cell.strip() for cell in line.split("|") if cell.strip()]
|
98 |
-
csv_data.append(cells)
|
99 |
-
|
100 |
-
output = io.StringIO()
|
101 |
-
writer = csv.writer(output)
|
102 |
-
writer.writerows(csv_data)
|
103 |
-
return output.getvalue()
|
104 |
-
|
105 |
-
|
106 |
-
def cleanup_temp_files():
|
107 |
-
"""Clean up old temporary files."""
|
108 |
-
try:
|
109 |
-
current_time = datetime.datetime.now()
|
110 |
-
for file in os.listdir():
|
111 |
-
if file.startswith("study_export_") and file.endswith(".csv"):
|
112 |
-
file_time = datetime.datetime.fromtimestamp(os.path.getmtime(file))
|
113 |
-
# Calculate the time difference in seconds
|
114 |
-
time_difference = (current_time - file_time).total_seconds()
|
115 |
-
if time_difference > 20: # 5 minutes in seconds
|
116 |
-
try:
|
117 |
-
os.remove(file)
|
118 |
-
except Exception as e:
|
119 |
-
logging.warning(f"Failed to remove temp file {file}: {e}")
|
120 |
-
except Exception as e:
|
121 |
-
logging.warning(f"Error during cleanup: {e}")
|
122 |
-
|
123 |
-
|
124 |
-
def chat_function(message: str, study_name: str, prompt_type: str) -> str:
|
125 |
-
"""Process a chat message and generate a response using the RAG pipeline."""
|
126 |
-
|
127 |
-
if not message.strip():
|
128 |
-
return "Please enter a valid query."
|
129 |
-
|
130 |
-
rag = get_rag_pipeline(study_name)
|
131 |
-
logging.info(f"rag: ==> {rag}")
|
132 |
-
prompt = {
|
133 |
-
"Highlight": highlight_prompt,
|
134 |
-
"Evidence-based": evidence_based_prompt,
|
135 |
-
}.get(prompt_type)
|
136 |
-
|
137 |
-
response, _ = rag.query(message, prompt_template=prompt) # Unpack the tuple
|
138 |
-
return response
|
139 |
-
|
140 |
-
|
141 |
-
def process_zotero_library_items(
|
142 |
-
zotero_library_id: str, zotero_api_access_key: str
|
143 |
-
) -> str:
|
144 |
if not zotero_library_id or not zotero_api_access_key:
|
145 |
return "Please enter your zotero library Id and API Access Key"
|
146 |
|
@@ -156,17 +42,11 @@ def process_zotero_library_items(
|
|
156 |
)
|
157 |
|
158 |
zotero_collections = zotero_manager.get_collections()
|
159 |
-
zotero_collection_lists = zotero_manager.list_zotero_collections(
|
160 |
-
zotero_collections
|
161 |
-
)
|
162 |
filtered_zotero_collection_lists = (
|
163 |
-
zotero_manager.filter_and_return_collections_with_items(
|
164 |
-
zotero_collection_lists
|
165 |
-
)
|
166 |
)
|
167 |
|
168 |
-
study_files_data = {} # Dictionary to collect items for ChromaDB
|
169 |
-
|
170 |
for collection in filtered_zotero_collection_lists:
|
171 |
collection_name = collection.get("name")
|
172 |
if collection_name not in STUDY_FILES:
|
@@ -175,362 +55,199 @@ def process_zotero_library_items(
|
|
175 |
zotero_collection_items = (
|
176 |
zotero_manager.get_collection_zotero_items_by_key(collection_key)
|
177 |
)
|
178 |
-
|
179 |
-
zotero_items_json = zotero_manager.zotero_items_to_json(
|
180 |
-
zotero_collection_items
|
181 |
-
)
|
182 |
export_file = f"{slugify(collection_name)}_zotero_items.json"
|
183 |
zotero_manager.write_zotero_items_to_json_file(
|
184 |
zotero_items_json, f"data/{export_file}"
|
185 |
)
|
186 |
-
append_to_study_files(
|
187 |
-
"study_files.json", collection_name, f"data/{export_file}"
|
188 |
-
)
|
189 |
-
|
190 |
-
# Collect for ChromaDB
|
191 |
-
study_files_data[collection_name] = f"data/{export_file}"
|
192 |
-
|
193 |
-
# Update in-memory STUDY_FILES for reference in current session
|
194 |
-
STUDY_FILES.update({collection_name: f"data/{export_file}"})
|
195 |
-
logging.info(f"STUDY_FILES: {STUDY_FILES}")
|
196 |
-
|
197 |
-
# After loop, add all collected data to ChromaDB
|
198 |
-
add_study_files_to_chromadb("study_files.json", "study_files_collection")
|
199 |
message = "Successfully processed items in your zotero library"
|
200 |
except Exception as e:
|
201 |
message = f"Error process your zotero library: {str(e)}"
|
202 |
-
|
203 |
return message
|
204 |
|
205 |
|
206 |
-
def
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
|
215 |
-
def download_as_csv(markdown_content):
|
216 |
-
"""Convert markdown table to CSV and provide for download."""
|
217 |
-
if not markdown_content:
|
218 |
-
return None
|
219 |
|
220 |
-
|
221 |
-
|
222 |
-
|
|
|
223 |
|
224 |
-
|
225 |
-
|
226 |
-
temp_path = f"study_export_{timestamp}.csv"
|
227 |
|
228 |
-
|
229 |
-
|
|
|
|
|
|
|
230 |
|
231 |
-
|
|
|
232 |
|
233 |
|
234 |
-
|
|
|
235 |
|
|
|
|
|
|
|
236 |
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
return "Please upload PDF files and provide a collection name"
|
241 |
|
242 |
-
try:
|
243 |
-
processor = PDFProcessor()
|
244 |
-
|
245 |
-
# Save uploaded files temporarily
|
246 |
-
file_paths = []
|
247 |
-
for file in files:
|
248 |
-
# Get the actual file path from the Gradio File object
|
249 |
-
if hasattr(file, "name"): # If it's already a path
|
250 |
-
temp_path = file.name
|
251 |
-
else: # If it needs to be saved
|
252 |
-
temp_path = os.path.join(processor.upload_dir, file.orig_name)
|
253 |
-
file.save(temp_path)
|
254 |
-
file_paths.append(temp_path)
|
255 |
-
|
256 |
-
# Process PDFs
|
257 |
-
output_path = processor.process_pdfs(file_paths, collection_name)
|
258 |
-
|
259 |
-
# Add to study files and ChromaDB
|
260 |
-
collection_id = f"pdf_{slugify(collection_name)}"
|
261 |
-
append_to_study_files("study_files.json", collection_id, output_path)
|
262 |
-
add_study_files_to_chromadb("study_files.json", "study_files_collection")
|
263 |
-
|
264 |
-
# Cleanup temporary files if they were created by us
|
265 |
-
for path in file_paths:
|
266 |
-
if path.startswith(processor.upload_dir):
|
267 |
-
try:
|
268 |
-
os.remove(path)
|
269 |
-
except Exception as e:
|
270 |
-
logger.warning(f"Failed to remove temporary file {path}: {e}")
|
271 |
-
|
272 |
-
return f"Successfully processed PDFs into collection: {collection_id}"
|
273 |
|
274 |
-
|
275 |
-
|
276 |
-
return f"Error processing PDF files: {str(e)}"
|
277 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
278 |
|
279 |
-
def chat_response(
|
280 |
-
message: str,
|
281 |
-
history: List[Tuple[str, str]],
|
282 |
-
study_name: str,
|
283 |
-
pdf_processor: PDFProcessor,
|
284 |
-
) -> Tuple[List[Tuple[str, str]], str, Any]:
|
285 |
-
"""Generate chat response and update history."""
|
286 |
-
if not message.strip():
|
287 |
-
return history, None, None
|
288 |
|
289 |
-
|
290 |
-
|
291 |
-
history.append((message, response))
|
292 |
-
|
293 |
-
# Generate PDF preview if source information is available
|
294 |
-
preview_image = None
|
295 |
-
if (
|
296 |
-
source_info
|
297 |
-
and source_info.get("source_file")
|
298 |
-
and source_info.get("page_numbers")
|
299 |
-
):
|
300 |
-
try:
|
301 |
-
# Get the first page number from the source
|
302 |
-
page_num = source_info["page_numbers"][0]
|
303 |
-
preview_image = pdf_processor.render_page(
|
304 |
-
source_info["source_file"], int(page_num)
|
305 |
-
)
|
306 |
-
except Exception as e:
|
307 |
-
logger.error(f"Error generating PDF preview: {str(e)}")
|
308 |
|
309 |
-
|
|
|
|
|
|
|
|
|
|
|
310 |
|
311 |
|
312 |
def create_gr_interface() -> gr.Blocks:
|
313 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
with gr.Blocks() as demo:
|
315 |
gr.Markdown("# ACRES RAG Platform")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
316 |
|
317 |
-
|
318 |
-
|
319 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
320 |
with gr.Row():
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
collection = chromadb_client.get_or_create_collection(
|
338 |
-
"study_files_collection"
|
339 |
-
)
|
340 |
-
all_documents = collection.query(
|
341 |
-
query_texts=[""], n_results=1000
|
342 |
-
)
|
343 |
-
study_choices = [
|
344 |
-
doc_id
|
345 |
-
for doc_id in all_documents.get("ids")[0]
|
346 |
-
if all_documents
|
347 |
-
]
|
348 |
-
|
349 |
-
study_dropdown = gr.Dropdown(
|
350 |
-
choices=study_choices,
|
351 |
-
label="Select Study",
|
352 |
-
value=(study_choices[0] if study_choices else None),
|
353 |
-
)
|
354 |
-
study_info = gr.Markdown(label="Study Details")
|
355 |
-
prompt_type = gr.Radio(
|
356 |
-
["Default", "Highlight", "Evidence-based"],
|
357 |
-
label="Prompt Type",
|
358 |
-
value="Default",
|
359 |
-
)
|
360 |
-
|
361 |
-
with gr.Column(scale=3):
|
362 |
-
gr.Markdown("### Study Variables")
|
363 |
-
with gr.Row():
|
364 |
-
study_variables = gr.Textbox(
|
365 |
-
show_label=False,
|
366 |
-
placeholder="Type your variables separated by commas e.g (Study ID, Study Title, Authors etc)",
|
367 |
-
scale=4,
|
368 |
-
lines=1,
|
369 |
-
autofocus=True,
|
370 |
-
)
|
371 |
-
submit_btn = gr.Button("Submit", scale=1)
|
372 |
-
answer_output = gr.Markdown(label="Answer")
|
373 |
-
download_btn = gr.DownloadButton(
|
374 |
-
"Download as CSV",
|
375 |
-
variant="primary",
|
376 |
-
size="sm",
|
377 |
-
scale=1,
|
378 |
-
visible=False,
|
379 |
-
)
|
380 |
-
|
381 |
-
# Tab 2: PDF Chat Interface
|
382 |
-
with gr.Tab("PDF Chat"):
|
383 |
-
pdf_processor = PDFProcessor()
|
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 |
study_dropdown.change(
|
428 |
-
get_study_info,
|
|
|
|
|
429 |
)
|
430 |
|
431 |
-
|
432 |
-
|
433 |
-
inputs=[study_variables, study_dropdown, prompt_type],
|
434 |
-
outputs=[answer_output, download_btn],
|
435 |
-
)
|
436 |
-
|
437 |
-
download_btn.click(
|
438 |
-
fn=download_as_csv, inputs=[answer_output], outputs=[download_btn]
|
439 |
-
).then(fn=cleanup_temp_files, inputs=None, outputs=None)
|
440 |
-
|
441 |
-
# Event handlers for PDF Chat tab
|
442 |
-
|
443 |
-
def handle_pdf_upload(files, name):
|
444 |
-
if not name:
|
445 |
-
return "Please provide a collection name", None
|
446 |
-
if not files:
|
447 |
-
return "Please select PDF files", None
|
448 |
-
|
449 |
-
try:
|
450 |
-
result = process_pdf_uploads(files, name)
|
451 |
-
collection_id = f"pdf_{slugify(name)}"
|
452 |
-
return result, collection_id
|
453 |
-
except Exception as e:
|
454 |
-
logger.error(f"Error in handle_pdf_upload: {str(e)}")
|
455 |
-
return f"Error: {str(e)}", None
|
456 |
-
|
457 |
-
upload_btn.click(
|
458 |
-
handle_pdf_upload,
|
459 |
-
inputs=[pdf_files, collection_name],
|
460 |
-
outputs=[pdf_status, current_collection],
|
461 |
-
)
|
462 |
-
|
463 |
-
def add_message(history, message):
|
464 |
-
"""Add user message to chat history."""
|
465 |
-
if not message.strip():
|
466 |
-
raise gr.Error("Please enter a message")
|
467 |
-
history = history + [(message, None)]
|
468 |
-
return history, "", None
|
469 |
-
|
470 |
-
def generate_chat_response(history, collection_id, pdf_processor):
|
471 |
-
"""Generate response for the last message in history."""
|
472 |
-
if not collection_id:
|
473 |
-
raise gr.Error("Please upload PDFs first")
|
474 |
-
if len(history) == 0:
|
475 |
-
return history, None
|
476 |
-
|
477 |
-
last_message = history[-1][0]
|
478 |
-
try:
|
479 |
-
# Get response and source info
|
480 |
-
rag = get_rag_pipeline(collection_id)
|
481 |
-
response, source_info = rag.query(last_message)
|
482 |
-
|
483 |
-
# Generate preview if source information is available
|
484 |
-
preview_image = None
|
485 |
-
if (
|
486 |
-
source_info
|
487 |
-
and source_info.get("source_file")
|
488 |
-
and source_info.get("page_number") is not None
|
489 |
-
):
|
490 |
-
try:
|
491 |
-
page_num = source_info["page_number"]
|
492 |
-
logger.info(f"Attempting to render page {page_num}")
|
493 |
-
preview_image = pdf_processor.render_page(
|
494 |
-
source_info["source_file"], page_num
|
495 |
-
)
|
496 |
-
if preview_image:
|
497 |
-
logger.info(
|
498 |
-
f"Successfully generated preview for page {page_num}"
|
499 |
-
)
|
500 |
-
else:
|
501 |
-
logger.warning(
|
502 |
-
f"Failed to generate preview for page {page_num}"
|
503 |
-
)
|
504 |
-
except Exception as e:
|
505 |
-
logger.error(f"Error generating PDF preview: {str(e)}")
|
506 |
-
preview_image = None
|
507 |
-
|
508 |
-
# Update history with response
|
509 |
-
history[-1] = (last_message, response)
|
510 |
-
return history, preview_image
|
511 |
-
|
512 |
-
except Exception as e:
|
513 |
-
logger.error(f"Error in generate_chat_response: {str(e)}")
|
514 |
-
history[-1] = (last_message, f"Error: {str(e)}")
|
515 |
-
return history, None
|
516 |
-
|
517 |
-
# Update PDF event handlers
|
518 |
-
upload_btn.click( # Change from pdf_files.upload to upload_btn.click
|
519 |
-
handle_pdf_upload,
|
520 |
-
inputs=[pdf_files, collection_name],
|
521 |
-
outputs=[pdf_status, current_collection],
|
522 |
-
)
|
523 |
-
|
524 |
-
# Fixed chat event handling
|
525 |
-
chat_submit_btn.click(
|
526 |
-
add_message,
|
527 |
-
inputs=[chat_history, query_input],
|
528 |
-
outputs=[chat_history, query_input, pdf_preview],
|
529 |
-
).success(
|
530 |
-
lambda h, c: generate_chat_response(h, c, pdf_processor),
|
531 |
-
inputs=[chat_history, current_collection],
|
532 |
-
outputs=[chat_history, pdf_preview],
|
533 |
-
)
|
534 |
|
535 |
return demo
|
536 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import json
|
2 |
+
from typing import List, Tuple
|
3 |
import os
|
|
|
4 |
|
5 |
import gradio as gr
|
|
|
6 |
from dotenv import load_dotenv
|
7 |
from slugify import slugify
|
8 |
|
9 |
+
from config import STUDY_FILES
|
10 |
from rag.rag_pipeline import RAGPipeline
|
11 |
+
from utils.helpers import generate_follow_up_questions, append_to_study_files
|
12 |
+
from utils.prompts import (
|
13 |
+
highlight_prompt,
|
14 |
+
evidence_based_prompt,
|
15 |
+
sample_questions,
|
16 |
)
|
17 |
+
import openai
|
|
|
18 |
|
19 |
+
from config import STUDY_FILES, OPENAI_API_KEY
|
20 |
+
from utils.zotero_manager import ZoteroManager
|
21 |
|
|
|
|
|
|
|
22 |
load_dotenv()
|
23 |
|
24 |
openai.api_key = OPENAI_API_KEY
|
25 |
|
|
|
|
|
|
|
26 |
# Cache for RAG pipelines
|
27 |
rag_cache = {}
|
28 |
|
29 |
+
def process_zotero_library_items(zotero_library_id: str, zotero_api_access_key: str) -> str:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
if not zotero_library_id or not zotero_api_access_key:
|
31 |
return "Please enter your zotero library Id and API Access Key"
|
32 |
|
|
|
42 |
)
|
43 |
|
44 |
zotero_collections = zotero_manager.get_collections()
|
45 |
+
zotero_collection_lists = zotero_manager.list_zotero_collections(zotero_collections)
|
|
|
|
|
46 |
filtered_zotero_collection_lists = (
|
47 |
+
zotero_manager.filter_and_return_collections_with_items(zotero_collection_lists)
|
|
|
|
|
48 |
)
|
49 |
|
|
|
|
|
50 |
for collection in filtered_zotero_collection_lists:
|
51 |
collection_name = collection.get("name")
|
52 |
if collection_name not in STUDY_FILES:
|
|
|
55 |
zotero_collection_items = (
|
56 |
zotero_manager.get_collection_zotero_items_by_key(collection_key)
|
57 |
)
|
58 |
+
#### Export zotero collection items to json ####
|
59 |
+
zotero_items_json = zotero_manager.zotero_items_to_json(zotero_collection_items)
|
|
|
|
|
60 |
export_file = f"{slugify(collection_name)}_zotero_items.json"
|
61 |
zotero_manager.write_zotero_items_to_json_file(
|
62 |
zotero_items_json, f"data/{export_file}"
|
63 |
)
|
64 |
+
append_to_study_files("study_files.json", collection_name, f"data/{export_file}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
message = "Successfully processed items in your zotero library"
|
66 |
except Exception as e:
|
67 |
message = f"Error process your zotero library: {str(e)}"
|
68 |
+
|
69 |
return message
|
70 |
|
71 |
|
72 |
+
def get_rag_pipeline(study_name: str) -> RAGPipeline:
|
73 |
+
"""Get or create a RAGPipeline instance for the given study."""
|
74 |
+
if study_name not in rag_cache:
|
75 |
+
study_file = STUDY_FILES.get(study_name)
|
76 |
+
if not study_file:
|
77 |
+
raise ValueError(f"Invalid study name: {study_name}")
|
78 |
+
rag_cache[study_name] = RAGPipeline(study_file)
|
79 |
+
return rag_cache[study_name]
|
80 |
|
|
|
|
|
|
|
|
|
81 |
|
82 |
+
def chat_function(
|
83 |
+
message: str, study_name: str, prompt_type: str
|
84 |
+
) -> str:
|
85 |
+
"""Process a chat message and generate a response using the RAG pipeline."""
|
86 |
|
87 |
+
if not message.strip():
|
88 |
+
return "Please enter a valid query."
|
|
|
89 |
|
90 |
+
rag = get_rag_pipeline(study_name)
|
91 |
+
prompt = {
|
92 |
+
"Highlight": highlight_prompt,
|
93 |
+
"Evidence-based": evidence_based_prompt,
|
94 |
+
}.get(prompt_type)
|
95 |
|
96 |
+
response = rag.query(message, prompt_template=prompt)
|
97 |
+
return response.response
|
98 |
|
99 |
|
100 |
+
def get_study_info(study_name: str) -> str:
|
101 |
+
"""Retrieve information about the specified study."""
|
102 |
|
103 |
+
study_file = STUDY_FILES.get(study_name)
|
104 |
+
if not study_file:
|
105 |
+
return "Invalid study name"
|
106 |
|
107 |
+
with open(study_file, "r") as f:
|
108 |
+
data = json.load(f)
|
109 |
+
return f"### Number of documents: {len(data)}"
|
|
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
+
def update_interface(study_name: str) -> Tuple[str, gr.update, gr.update, gr.update]:
|
113 |
+
"""Update the interface based on the selected study."""
|
|
|
114 |
|
115 |
+
study_info = get_study_info(study_name)
|
116 |
+
questions = sample_questions.get(study_name, [])[:3]
|
117 |
+
if not questions:
|
118 |
+
questions = sample_questions.get("General", [])[:3]
|
119 |
+
visible_questions = [gr.update(visible=True, value=q) for q in questions]
|
120 |
+
hidden_questions = [gr.update(visible=False) for _ in range(3 - len(questions))]
|
121 |
+
return (study_info, *visible_questions, *hidden_questions)
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
+
def set_question(question: str) -> str:
|
125 |
+
return question.lstrip("✨ ")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
+
def process_multi_input(text, study_name, prompt_type):
|
128 |
+
# Split input based on commas and strip any extra spaces
|
129 |
+
variable_list = [word.strip().upper() for word in text.split(',')]
|
130 |
+
user_message =f"Extract and present in a tabular format the following variables for each {study_name} study: {', '.join(variable_list)}"
|
131 |
+
response = chat_function(user_message, study_name, prompt_type)
|
132 |
+
return response
|
133 |
|
134 |
|
135 |
def create_gr_interface() -> gr.Blocks:
|
136 |
+
"""
|
137 |
+
Create and configure the Gradio interface for the RAG platform.
|
138 |
+
|
139 |
+
This function sets up the entire user interface, including:
|
140 |
+
- Chat interface with message input and display
|
141 |
+
- Study selection dropdown
|
142 |
+
- Sample and follow-up question buttons
|
143 |
+
- Prompt type selection
|
144 |
+
- Event handlers for user interactions
|
145 |
+
|
146 |
+
Returns:
|
147 |
+
gr.Blocks: The configured Gradio interface ready for launching.
|
148 |
+
"""
|
149 |
+
|
150 |
with gr.Blocks() as demo:
|
151 |
gr.Markdown("# ACRES RAG Platform")
|
152 |
+
|
153 |
+
with gr.Row():
|
154 |
+
with gr.Column(scale=1):
|
155 |
+
gr.Markdown("### Zotero Credentials")
|
156 |
+
zotero_library_id = gr.Textbox(label="Zotero Library ID", type="password", placeholder="Enter Your Zotero Library ID here...")
|
157 |
+
zotero_api_access_key = gr.Textbox(label="Zotero API Access Key", type="password", placeholder="Enter Your Zotero API Access Key...")
|
158 |
+
process_zotero_btn = gr.Button("Process your Zotero Library")
|
159 |
+
zotero_output = gr.Markdown(label="Zotero")
|
160 |
+
|
161 |
+
gr.Markdown("### Study Information")
|
162 |
+
study_dropdown = gr.Dropdown(
|
163 |
+
choices=list(STUDY_FILES.keys()),
|
164 |
+
label="Select Study",
|
165 |
+
value=list(STUDY_FILES.keys())[0],
|
166 |
+
)
|
167 |
+
study_info = gr.Markdown(label="Study Details")
|
168 |
|
169 |
+
gr.Markdown("### Settings")
|
170 |
+
prompt_type = gr.Radio(
|
171 |
+
["Default", "Highlight", "Evidence-based"],
|
172 |
+
label="Prompt Type",
|
173 |
+
value="Default",
|
174 |
+
)
|
175 |
+
# clear = gr.Button("Clear Chat")
|
176 |
+
|
177 |
+
with gr.Column(scale=3):
|
178 |
+
gr.Markdown("### Study Variables")
|
179 |
with gr.Row():
|
180 |
+
study_variables = gr.Textbox(
|
181 |
+
show_label=False,
|
182 |
+
placeholder="Type your variables separated by commas e.g (Study ID, Study Title, Authors etc)",
|
183 |
+
scale=4,
|
184 |
+
lines=1,
|
185 |
+
autofocus=True,
|
186 |
+
)
|
187 |
+
submit_btn = gr.Button("Submit", scale=1)
|
188 |
+
answer_output = gr.Markdown(label="Answer")
|
189 |
+
|
190 |
+
def user(
|
191 |
+
user_message: str, history: List[List[str]]
|
192 |
+
) -> Tuple[str, List[List[str]]]:
|
193 |
+
return "", (
|
194 |
+
history + [[user_message, None]] if user_message.strip() else history
|
195 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
|
197 |
+
def bot(
|
198 |
+
history: List[List[str]], study_name: str, prompt_type: str
|
199 |
+
) -> List[List[str]]:
|
200 |
+
"""
|
201 |
+
Generate bot response and update the interface.
|
202 |
+
|
203 |
+
This function:
|
204 |
+
1. Processes the latest user message
|
205 |
+
2. Generates a response using the RAG pipeline
|
206 |
+
3. Updates the chat history
|
207 |
+
4. Generates follow-up questions
|
208 |
+
5. Prepares interface updates for follow-up buttons
|
209 |
+
|
210 |
+
Args:
|
211 |
+
history (List[List[str]]): The current chat history.
|
212 |
+
study_name (str): The name of the current study.
|
213 |
+
prompt_type (str): The type of prompt being used.
|
214 |
+
|
215 |
+
Returns:
|
216 |
+
Tuple[List[List[str]], gr.update, gr.update, gr.update]:
|
217 |
+
Updated chat history and interface components for follow-up questions.
|
218 |
+
"""
|
219 |
+
if not history:
|
220 |
+
return history, [], [], []
|
221 |
+
|
222 |
+
user_message = history[-1][0]
|
223 |
+
bot_message = chat_function(user_message, history, study_name, prompt_type)
|
224 |
+
history[-1][1] = bot_message
|
225 |
+
|
226 |
+
return history
|
227 |
+
|
228 |
+
# msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
|
229 |
+
# bot,
|
230 |
+
# [chatbot, study_dropdown, prompt_type],
|
231 |
+
# [chatbot, *follow_up_btns],
|
232 |
+
# )
|
233 |
+
# send_btn.click(user, [msg, chatbot], [msg, chatbot], queue=False).then(
|
234 |
+
# bot,
|
235 |
+
# [chatbot, study_dropdown, prompt_type],
|
236 |
+
# [chatbot, *follow_up_btns],
|
237 |
+
# )
|
238 |
+
# for btn in follow_up_btns + sample_btns:
|
239 |
+
# btn.click(set_question, inputs=[btn], outputs=[msg])
|
240 |
+
|
241 |
+
# clear.click(lambda: None, None, chatbot, queue=False)
|
242 |
|
243 |
study_dropdown.change(
|
244 |
+
fn=get_study_info,
|
245 |
+
inputs=study_dropdown,
|
246 |
+
outputs=[study_info],
|
247 |
)
|
248 |
|
249 |
+
process_zotero_btn.click(process_zotero_library_items, inputs=[zotero_library_id, zotero_api_access_key], outputs=[zotero_output], queue=False)
|
250 |
+
submit_btn.click(process_multi_input, inputs=[study_variables, study_dropdown, prompt_type], outputs=[answer_output], queue=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
|
252 |
return demo
|
253 |
|
config.py
CHANGED
@@ -1,5 +1,3 @@
|
|
1 |
-
# config.py
|
2 |
-
|
3 |
import os
|
4 |
|
5 |
from dotenv import load_dotenv
|
|
|
|
|
|
|
1 |
import os
|
2 |
|
3 |
from dotenv import load_dotenv
|
config/pdf_config.yaml
DELETED
File without changes
|
data/.keep
DELETED
File without changes
|
data/ebscohost_zotero_items.json
DELETED
The diff for this file is too large to render.
See raw diff
|
|
data/exportedris-file-1-of-1-1_zotero_items.json
DELETED
@@ -1,813 +0,0 @@
|
|
1 |
-
[
|
2 |
-
{
|
3 |
-
"key": "B4DGMAWK",
|
4 |
-
"title": "Afghanistan Safety Nets Evaluation",
|
5 |
-
"abstract": "The primary objective of this evaluation is to estimate the causal impact of an unconditional cash transfer on the ability of the poorest families in select districts in Afghanistan to smooth consumption during seasonal shocks (e.g., winter-related, agricultural, and water shocks). Secondarily, the study will assess intervention effects on other economic outcomes, ownership and preservation of assets, child wellbeing (including nutrition, education, and refrainment from labor), migration, psychological well-being, and confidence in institutions. The target population consists of the poorest quintile of families with children under the age of five. Unconditional cash transfers will be provided to poor families in three installments: before, at the beginning, and at the end of the lean season. The annual benefit will amount to approximately 8,500 AFN (125 USD) for families with one more child under five; each payment installment is of equal amount.",
|
6 |
-
"full_text": "",
|
7 |
-
"authors": [
|
8 |
-
"Matthew Morton",
|
9 |
-
"Lucian Bucur Pop"
|
10 |
-
],
|
11 |
-
"doi": "",
|
12 |
-
"year": null,
|
13 |
-
"item_type": "journalArticle",
|
14 |
-
"url": "https://ridie.3ieimpact.org/index.php?r=search/detailView&id=404"
|
15 |
-
},
|
16 |
-
{
|
17 |
-
"key": "P2VD3QWB",
|
18 |
-
"title": "Financial Education and Financial Access for Transnational Households: Field Experimental Evidence from the Philippines",
|
19 |
-
"abstract": "We implemented a randomized controlled trial among transnational households in the Philippines estimating impacts of a financial education treatment, a financial access treatment, and the combination of the two on financial behaviors. We test whether there are complementarities between both interventions and provide insight into the nature of constraints operating in financial services markets. We find no evidence of complementarities between the financial education and access treatments. In addition, while we find no evidence of constraints in access to formal credit and savings products, our results suggest that access constraints exist in the formal insurance market. Impacts on other financial behaviors are suggestive of the importance of information constraints in financial decision-making. These results provide guidance to designers of financial interventions in similar populations.",
|
20 |
-
"full_text": "",
|
21 |
-
"authors": [
|
22 |
-
"Abarcar P",
|
23 |
-
"Barua R",
|
24 |
-
"Yang D"
|
25 |
-
],
|
26 |
-
"doi": "10.1086/703045",
|
27 |
-
"year": null,
|
28 |
-
"item_type": "journalArticle",
|
29 |
-
"url": ""
|
30 |
-
},
|
31 |
-
{
|
32 |
-
"key": "QD6ZPX6I",
|
33 |
-
"title": "Labor Supply Responses to Large Social Transfers: Longitudinal Evidence from South Africa",
|
34 |
-
"abstract": "We quantify the labor supply responses of prime-aged adults to the presence of pensioners in their households, using longitudinal data collected in South Africa. We compare households and individuals before and after pension receipt and pension loss, which allows us to control for a host of unobservable household and individual characteristics that may determine labor market behavior. We,find large cash transfers to the elderly lead to increased employment among prime-aged adults, which occurs primarily through labor migration. The pension's impact is attributable to the increase in household resources it represents, which can be used to stake migrants until they become self-sufficient, and to the presence of pensioners who can care for small children, which allows prime-aged adults to look for work elsewhere. (JEL H23, H55, I38, J22, O15)",
|
35 |
-
"full_text": "",
|
36 |
-
"authors": [
|
37 |
-
"Ardington C",
|
38 |
-
"Case A",
|
39 |
-
"Hosegood V"
|
40 |
-
],
|
41 |
-
"doi": "10.1257/app.1.1.22",
|
42 |
-
"year": null,
|
43 |
-
"item_type": "journalArticle",
|
44 |
-
"url": ""
|
45 |
-
},
|
46 |
-
{
|
47 |
-
"key": "VUJDLBR5",
|
48 |
-
"title": "Aid programs' unintended effects: The case of Progresa and migration",
|
49 |
-
"abstract": "This paper analyzes the effect of aid on international and domestic migration and explores the causal effect of income on migration. The theoretical model predicts that the effect of aid \u2026",
|
50 |
-
"full_text": "",
|
51 |
-
"authors": [
|
52 |
-
"Angelucci M"
|
53 |
-
],
|
54 |
-
"doi": "",
|
55 |
-
"year": null,
|
56 |
-
"item_type": "journalArticle",
|
57 |
-
"url": "https://papers.ssrn.com/sol3/papers.cfm?abstract_id=868646"
|
58 |
-
},
|
59 |
-
{
|
60 |
-
"key": "29J6T354",
|
61 |
-
"title": "Information, Intermediaries, and International Migration",
|
62 |
-
"abstract": "Job seekers face substantial information frictions, especially in international labor markets where intermediaries match prospective migrants with overseas employers. We conducted a randomized trial in Indonesia to explore how information about intermediary quality shapes migration outcomes. Holding access to information about the return to choosing a high-quality intermediary constant, intermediary-specific quality disclosure reduces the migration rate, cutting use of low-quality providers. Workers who do migrate receive better pre-departure preparation and have improved experiences abroad, despite no change in occupation or destination. These results are not driven by changes in beliefs about average provider quality or the return to migration. Nor does selection explain improved outcomes for those who migrate with quality disclosure. Together, our findings are consistent with an increase in the option value of search: with better ability to differentiate offer quality, workers search longer, select higher-quality intermediaries, and ultimately have better migration experiences.",
|
63 |
-
"full_text": "",
|
64 |
-
"authors": [
|
65 |
-
"Bazzi Samuel",
|
66 |
-
"Cameron Lisa",
|
67 |
-
"Schaner Simone",
|
68 |
-
"Witoelar Firman"
|
69 |
-
],
|
70 |
-
"doi": "",
|
71 |
-
"year": null,
|
72 |
-
"item_type": "journalArticle",
|
73 |
-
"url": ""
|
74 |
-
},
|
75 |
-
{
|
76 |
-
"key": "YIL3BQE5",
|
77 |
-
"title": "An Adaptive Targeted Field Experiment: Job Search Assistance for Refugees in Jordan",
|
78 |
-
"abstract": "We introduce an adaptive targeted treatment assignment methodology for field experiments. Our Tempered Thompson Algorithm balances the goals of maximizing the precision of treatment effect estimates and maximizing the welfare of experimental participants. A hierarchical Bayesian model allows us to adaptively target treatments. We implement our methodology in Jordan, testing policies to help Syrian refugees and local jobseekers to find work. The immediate employment impacts of a small cash grant, information and psychological support are small, but targeting raises employment by 1 percentage-point (20%). After four months, cash has a sizable effect on employment and earnings of Syrians.",
|
79 |
-
"full_text": "",
|
80 |
-
"authors": [
|
81 |
-
"Caria Stefano",
|
82 |
-
"Gordon Grant",
|
83 |
-
"Kasy Maximilian",
|
84 |
-
"Quinn Simon",
|
85 |
-
"Shami Soha",
|
86 |
-
"Teytelboym Alexander"
|
87 |
-
],
|
88 |
-
"doi": "",
|
89 |
-
"year": null,
|
90 |
-
"item_type": "journalArticle",
|
91 |
-
"url": ""
|
92 |
-
},
|
93 |
-
{
|
94 |
-
"key": "JINCDGIG",
|
95 |
-
"title": "Social Protection and Labor Market Outcomes of Youth in South Africa",
|
96 |
-
"abstract": "An Apartheid-driven spatial mismatch between workers and jobs leads to high job search costs for people living in rural areas of South Africa--costs that many young people cannot pay. In this article, the authors examine whether the arrival of a social grant--specifically a generous state-funded old-age pension given to men and women above prime age--enhances the ability of young men in rural areas to seek better work opportunities elsewhere. Based on eight waves of socioeconomic data on household living arrangements and household members' characteristics and employment status, collected between 2001 and 2011 at a demographic surveillance site in KwaZulu-Natal, the authors find that young men are significantly more likely to become labor migrants when someone in their household becomes age-eligible for the old-age pension. But this effect applies only to those who have completed high school (matric), who are on average 8 percentage points more likely to migrate for work when their households become pension eligible, compared with other potential labor migrants. The authors also find that, upon pension loss, it is the youngest migrants who are the most likely to return to their sending households, perhaps because they are the least likely to be self-sufficient at the time the pension is lost. The evidence is consistent with binding credit constraints limiting young men from poorer households from seeking more lucrative work elsewhere.",
|
97 |
-
"full_text": "",
|
98 |
-
"authors": [
|
99 |
-
"Ardington Cally",
|
100 |
-
"Barnighausen Till",
|
101 |
-
"Case Anne",
|
102 |
-
"Menendez Alicia"
|
103 |
-
],
|
104 |
-
"doi": "",
|
105 |
-
"year": null,
|
106 |
-
"item_type": "journalArticle",
|
107 |
-
"url": ""
|
108 |
-
},
|
109 |
-
{
|
110 |
-
"key": "F3ZV6MYR",
|
111 |
-
"title": "Unilateral Facilitation Does Not Raise International Labor Migration From The Philippines",
|
112 |
-
"abstract": "Significant income gains from migrating from poorer to richer countries have motivated unilateral (source-country) policies facilitating labor emigration. However, their effectiveness is unknown. We conducted a large-scale randomized experiment in the Philippines testing the impact of unilaterally facilitating international labor migration. Our most intensive treatment doubled the rate of job offers but had no identifiable effect on international labor migration. Even the highest overseas job-search rate we induced (22%), falls far short of the share initially expressing interest in migrating (34%). We conclude that unilateral migration facilitation will at most induce a trickle, not a flood, of additional emigration.",
|
113 |
-
"full_text": "",
|
114 |
-
"authors": [
|
115 |
-
"Beam Emily A",
|
116 |
-
"Mckenzie David",
|
117 |
-
"Yang Dean"
|
118 |
-
],
|
119 |
-
"doi": "10.1086/683999",
|
120 |
-
"year": null,
|
121 |
-
"item_type": "journalArticle",
|
122 |
-
"url": "https://www.journals.uchicago.edu/doi/10.1086/683999"
|
123 |
-
},
|
124 |
-
{
|
125 |
-
"key": "7CUVDKRR",
|
126 |
-
"title": "Long-term impacts of the oportunidades conditional cash transfer program on rural youth in Mexico",
|
127 |
-
"abstract": "This paper studies the long-term effects of partici pation in the Mexican Oportunidades program on a\nvariety of outcomes and behaviors of rural youth in\nMexico. It analyzes data from a social experiment,\nwhich randomly phased-in the program in rural Mex ican villages. In 1997, 320 villages (the treatment\ngroup) were randomly selected for early incorpora tion into the program and 186 villages (the control\ngroup) were designated as a control group to be in corporated eighteen months later. This paper ex amines whether differential exposure to the program\nsignificantly impacted educational attainment, labor\nmarket outcomes, marriage, migration and cognitive\nachievement of youth. The results show positive im pacts of longer exposure on grades of schooling at tained, but no effects on achievement tests. With\nrespect to work, we find an overall reduction in work\nfor male youth.",
|
128 |
-
"full_text": "",
|
129 |
-
"authors": [
|
130 |
-
"Behrman J R",
|
131 |
-
"Parker S W",
|
132 |
-
"Todd P E"
|
133 |
-
],
|
134 |
-
"doi": "",
|
135 |
-
"year": null,
|
136 |
-
"item_type": "journalArticle",
|
137 |
-
"url": ""
|
138 |
-
},
|
139 |
-
{
|
140 |
-
"key": "PKYZCRJU",
|
141 |
-
"title": "Climate and Resilience Impact Evaluation Window: Experimental Evidence from Several Countries",
|
142 |
-
"abstract": "The concept of resilience has gained attention because it recognises the importance of addressing shorter-term humanitarian needs while simultaneously supporting communities to face future crises induced by climate change, conflict, and other factors. Many institutions, including the World Food Programme (WFP), have increasingly used the concept as a basis for their programming. WFP's integrated packages of interventions aim to improve food security and nutrition by smoothing food consumption in the short-term, while supporting livelihoods and addressing barriers to development (e.g., better climate information, access to markets, education, WASH, etc.) in the long-term. While all programme activities are potentially important for building resilience, livelihood activities are clearly connected to both immediate and future wellbeing. These activities include cash or in-kind transfers to the household and support for creating assets that could benefit the household or the community in the future. Therefore, livelihood activities have the potential to support households in improving and maintaining their wellbeing when facing future shocks and stressors. This pre-analysis plan describes policy experiments to estimate the impacts of experimentally varying WFP's activities on resilience as measured by community and household wellbeing. This approach follows others in conceptualizing resilience through changes in wellbeing (Knippenberg et al, 2019, Phadera et al. 2019, Jones and Tanner, 2017; Barrett et al, 2020). We design and run these experiments in the context of livelihoods programs implemented by the World Food Programme (WFP) across 6 countries. Beyond testing the overall impact of livelihood activities on wellbeing, a key ambition of this paper is to investigate whether activities themselves can be timed to accommodate households? vulnerability to seasonal fluctuations and shocks that are often connected to weather patterns and agricultural cycle. We identify two such mechanisms: adjusting the timing of cash transfers and labor requirements; and/or allowing for re-targeting participants over time to account for changes in vulnerability status.",
|
143 |
-
"full_text": "",
|
144 |
-
"authors": [],
|
145 |
-
"doi": "10.1257/rct.6851-3.1",
|
146 |
-
"year": null,
|
147 |
-
"item_type": "journalArticle",
|
148 |
-
"url": "https://www.socialscienceregistry.org/trials/6851"
|
149 |
-
},
|
150 |
-
{
|
151 |
-
"key": "IDE53VC5",
|
152 |
-
"title": "Migration policy: did an emergency provision displace standard rules? Evidence from Italy",
|
153 |
-
"abstract": "In 2011, to manage the exceptional flow of people escaping North Africa, the Italian government released the North Africa Emergency (Emergenza Nord Africa, ENA) provision, temporarily relaxing migration policies for some categories of asylum seekers. Using data from an important charity, we perform baseline difference-in-differences regressions to investigate the impact of this emergency rule on the probability of migrants regularizing their legal status. We exploit the timing of the enactment of the ENA accessibility criteriasuch that potential beneficiaries learned of its existence only after the realization of the state of entitlementto identify the effects of the emergency policy provision on treated and control groups of immigrants. The results show an increased number of successful applications in favor of eligible individuals, although a dramatic boost in the denial rate for other migrants is also observed. This suggests either that some migrants suffered displacement due to the emergency rule, and/or that improper submissions of ENA-oriented applications have occurred. We extend our analysis to the use of multilevel models to shed light on these possible (non-mutually excludable) explanations. Results seem to support the presence of some rule-displacement effects, although the existence of a set of wrongful submissions cannot be excluded. We discuss these possibilities from a policy perspective.",
|
154 |
-
"full_text": "",
|
155 |
-
"authors": [
|
156 |
-
"dalla Pellegrina L",
|
157 |
-
"Saraceno M",
|
158 |
-
"Suardi M"
|
159 |
-
],
|
160 |
-
"doi": "10.1007/s40888-018-0128-0",
|
161 |
-
"year": null,
|
162 |
-
"item_type": "journalArticle",
|
163 |
-
"url": ""
|
164 |
-
},
|
165 |
-
{
|
166 |
-
"key": "44ICCPGX",
|
167 |
-
"title": "Does the Role Model Encourage Female Labor Force Participation? Field Experiment in Bangladesh",
|
168 |
-
"abstract": "Enhancing female labor force participation is considered key to economic growth, poverty alleviation, and women?s empowerment. Despite its importance both at the national and household/individual levels, the female labor force participation rate remains low in South Asian countries. It has been a great interest for researchers and policy makers how to enhance female labor force participation in these countries. We investigate whether providing unmarried young women and their parents with information about working conditions through the role model working women encourages unmarried young women?s labor force participation in rural Bangladesh, and if so, how. For this objective, we conduct the randomized controlled trial.",
|
169 |
-
"full_text": "",
|
170 |
-
"authors": [],
|
171 |
-
"doi": "10.1257/rct.4940-2.0",
|
172 |
-
"year": null,
|
173 |
-
"item_type": "journalArticle",
|
174 |
-
"url": "https://www.socialscienceregistry.org/trials/4940"
|
175 |
-
},
|
176 |
-
{
|
177 |
-
"key": "AEMAYDTW",
|
178 |
-
"title": "Managing the impact of climate on migration: Evidence from Mexico",
|
179 |
-
"abstract": "Although there is a growing literature on the impact of climate and weather-related events on migration, little is known about the mitigating effect of policies directed toward the agricultural sector, or aimed at insuring against environmental disasters. This paper uses state-level data on migration flows between Mexico and the USA from 1999 to 2012 to investigate the mitigating impact of an agricultural cash transfer program (PROCAMPO) and a disaster fund (Fonden) on the migration response to weather shocks. We find that Fonden decreases migration in response to heavy rainfall, hurricanes and droughts. Increases in PROCAMPO amounts paid to small producers play a more ambiguous role in the migration response to shocks. Changes in the distribution of PROCAMPO payments favoring more vulnerable producers in the non-irrigated ejido sector, however, seem to mitigate the impact of droughts on migration.",
|
180 |
-
"full_text": "",
|
181 |
-
"authors": [
|
182 |
-
"Chort I",
|
183 |
-
"Rupelle M de La"
|
184 |
-
],
|
185 |
-
"doi": "10.1007/s00148-022-00894-1",
|
186 |
-
"year": null,
|
187 |
-
"item_type": "journalArticle",
|
188 |
-
"url": "https://link.springer.com/article/10.1007/s00148-022-00894-1"
|
189 |
-
},
|
190 |
-
{
|
191 |
-
"key": "74WHPTAN",
|
192 |
-
"title": "Impact assessment of the Migrant Resource Centres in the Silk Routes Region",
|
193 |
-
"abstract": "Executive summary Several Migrant Resource Centres (MRCs) have been set up in recent years jointly by national administrations of origin and destination countries and the \u2026",
|
194 |
-
"full_text": "",
|
195 |
-
"authors": [
|
196 |
-
"Dennison J"
|
197 |
-
],
|
198 |
-
"doi": "",
|
199 |
-
"year": null,
|
200 |
-
"item_type": "journalArticle",
|
201 |
-
"url": "https://www.budapestprocess.org/wp-content/uploads/2022/12/ICMPD_MRC_impact_assessment_2022.pdf"
|
202 |
-
},
|
203 |
-
{
|
204 |
-
"key": "EYAF27EQ",
|
205 |
-
"title": "Employment and Irregular Migration: Evidence from Two Randomized Controlled Trials in Egypt",
|
206 |
-
"abstract": "Addressing the root causes of irregular migration has become a key policy priority in Europe. The EU Emergency Trust Fund for Africa (EUTF) was launched in 2015 with a budget of 5 billion euros to support projects aiming at deterring irregular migration flows from 26 origin countries. One of these projects is implemented by the Egyptian Micro, Small and Medium Enterprises Development Agency (MSMEDA) and targets unemployed youth in areas with the highest outflows of irregular migrants. We implement two randomized evaluations to assess whether (i) cash-for-work opportunities, and (ii) training and employment support have the intended effects on the direct beneficiaries and their relatives (household decision-maker, other household members, children, and friends). We assess impacts on people?s preferences and attitudes towards migration, irregular migration, as well as changes in their situation, aspirations, and expectations.",
|
207 |
-
"full_text": "",
|
208 |
-
"authors": [],
|
209 |
-
"doi": "10.1257/rct.10604-1.0",
|
210 |
-
"year": null,
|
211 |
-
"item_type": "journalArticle",
|
212 |
-
"url": "https://www.socialscienceregistry.org/trials/10604"
|
213 |
-
},
|
214 |
-
{
|
215 |
-
"key": "BBGCWFN6",
|
216 |
-
"title": "Enhancing Female Entrepreneurship through Cash Grants: Experimental Evidence from Rural Tunisia",
|
217 |
-
"abstract": "This research is a product of the World Bank's Middle East and North Africa Gender Innovation Lab (MNAGIL), which conducts rigorous impact evaluations and inferential \u2026",
|
218 |
-
"full_text": "",
|
219 |
-
"authors": [
|
220 |
-
"Zineb SB"
|
221 |
-
],
|
222 |
-
"doi": "",
|
223 |
-
"year": null,
|
224 |
-
"item_type": "journalArticle",
|
225 |
-
"url": "https://ericmvukiyehe.com/wp-content/uploads/2021/08/3-Enhancing-Female-Entrepreneurship-through-Cash-Grants-Experimental-Evidence-from-Rural-Tunisia-1.pdf"
|
226 |
-
},
|
227 |
-
{
|
228 |
-
"key": "LU7SCHNY",
|
229 |
-
"title": "Estimating the Impacts of Volunteer vs. Paraprofessional Community Worker Interventions among Conditional Cash Transfer Recipients in the Dominican Republic",
|
230 |
-
"abstract": "This project seeks to estimate the impacts of providing social intermediation services to poor recipients of conditional cash transfers (CCT) in the Dominican Republic (DR). Employing a randomized control trial design, the project will randomly assign either i) referred volunteer, ii) publicly-recruited volunteer, or iii) university-recruited paid paraprofessional \"community workers\" to provide monthly visits to newly enrolled and existing CCT beneficiaries. Households in one arm of the study will only receive cash transfers and will not receive home visits by community workers and an additional arm will include households that are pure controls. Key outcomes of interest include beneficiaries' compliance with program conditionalities, household consumption, primary and secondary school attendance, use of health and other local public services, participation in vocational training, labor market participation, and knowledge of the wellness curriculum administered during the monthly household visits. Data on these key outcomes will be collected both administratively by the DR government and through conducting midline and endline household surveys. In addition to estimating impacts on beneficiary households, the project is designed to estimate the impacts of the community worker employment experience on community worker candidates themselves in terms of their own income, political and community engagement, leadership activities, and subjective wellbeing. Specifically, volunteer and paid employment offers will be randomly offered among those community worker candidates screened into the selection process.",
|
231 |
-
"full_text": "",
|
232 |
-
"authors": [],
|
233 |
-
"doi": "10.1257/rct.1778-1.0",
|
234 |
-
"year": null,
|
235 |
-
"item_type": "journalArticle",
|
236 |
-
"url": "https://www.socialscienceregistry.org/trials/1778"
|
237 |
-
},
|
238 |
-
{
|
239 |
-
"key": "CDAYBE26",
|
240 |
-
"title": "Evaluation of a Program for the Professionalization of Artisans (ProfArts) in Ghana",
|
241 |
-
"abstract": "Training and professionalization interventions are an important vehicle for economic support within the development assistance landscape. Yet rigorous quantitative impact evaluations of such programs remain scarce, especially in developing countries. In order to help fill this research gap, we will conduct a rigorous impact evaluation of a program for the Professionalization of Artisans (ProfArts) in Ghana. The program will deliver top-up training, licensing, certification, and related benefits to up to 10,000 artisans drawn from the Ghanaian construction sector, with beneficiaries to be randomly selected from up to 20,000 baseline respondents. In a first step, we examine the effects of randomly assigned recruitment content on application rates, the composition of the applicant pool, and downstream program outcomes. In a second step, we use a randomized controlled trial to estimate effects of the program on four groups of outcomes: (i) employment, measured e.g. in terms of job retention, acquisition and lengths of employment spells, (ii) job quality and quality of life, including e.g. earnings and workplace conditions, (iii) mobility, e.g. migration intentions and behaviors, and (iv) firm-level outcomes, e.g. firm performance and employment.",
|
242 |
-
"full_text": "",
|
243 |
-
"authors": [],
|
244 |
-
"doi": "10.1257/rct.6842-1.0",
|
245 |
-
"year": null,
|
246 |
-
"item_type": "journalArticle",
|
247 |
-
"url": "https://www.socialscienceregistry.org/trials/6842"
|
248 |
-
},
|
249 |
-
{
|
250 |
-
"key": "QMSMF872",
|
251 |
-
"title": "Evaluation of the Network for Enterprise Development Learning through Sewing for Girls (N4G) training program for young women in Ghana",
|
252 |
-
"abstract": "Skills trainings are often a central component of contemporary development assistance strategies, but much of the evidence base for their efficacy comes from high-income countries. RCTs in developing countries are still far less numerous. We contribute to this literature with a rigorous impact evaluation of a program for the empowerment and education of young women in Ghana, called Network for Enterprise Development Learning through Sewing for Girls (N4G). The program will deliver fashion-industry related training and empowerment programs to up to 1,000 underprivileged Ghanaian young women from both urban and rural areas. Beneficiaries are randomly selected from approximately 2,000 baseline respondents. We use a randomized controlled trial to estimate effects of the N4G program on four groups of outcomes: (i) employment, measured for example in terms of employment status, job acquisition, and lengths of employment spells, (ii) job quality, including earnings, having a contract or an oral agreement, job satisfaction, and workplace conditions among others, (iii) quality of life, covering indicators of the current living situation, household assets, and financial dependency, and (iv) mobility, e.g. migration intentions and behaviors.",
|
253 |
-
"full_text": "",
|
254 |
-
"authors": [],
|
255 |
-
"doi": "10.1257/rct.7967-1.0",
|
256 |
-
"year": null,
|
257 |
-
"item_type": "journalArticle",
|
258 |
-
"url": "https://www.socialscienceregistry.org/trials/7967"
|
259 |
-
},
|
260 |
-
{
|
261 |
-
"key": "2WUKVSZA",
|
262 |
-
"title": "The Impact of Tourist Visas on Intercontinental South-South Migration: Ecuador\u2019s Policy of \u201cOpen Doors\u201d as a Quasi-Experiment",
|
263 |
-
"abstract": "Through the implementation of universal visa freedom from 2008 to 2010, Ecuador became one of the most accessible countries in the world. This article employs mixed methods to study the impact of the de facto opening of Ecuador\u2019s borders on intercontinental south-south migration. First, we use a difference-in-difference design to show that Ecuador\u2019s policy of universal visa freedom led to a significant increase of immigration from previously restricted nationalities in Africa, Asia, and the Caribbean. Complementary descriptive statistics and qualitative findings confirm the decisive impact visa freedom had on intercontinental south-south migration and suggest three main motives: taking advantage of Ecuador\u2019s open doors as an exit option from origin countries, settlement in Ecuador based on relatively improved opportunities, and transmigration to third countries. Our findings imply that travel visa policies of southern countries significantly impact which new south-south flows emerge. \u00a9 The Author(s) 2018.",
|
264 |
-
"full_text": "",
|
265 |
-
"authors": [
|
266 |
-
"Freier L F",
|
267 |
-
"Holloway K"
|
268 |
-
],
|
269 |
-
"doi": "10.1177/0197918318801068",
|
270 |
-
"year": null,
|
271 |
-
"item_type": "journalArticle",
|
272 |
-
"url": "https://www.scopus.com/inward/record.uri?eid=2-s2.0-85059900710&doi=10.1177%2f0197918318801068&partnerID=40&md5=60533a0c145229926d2e61b312680c19"
|
273 |
-
},
|
274 |
-
{
|
275 |
-
"key": "YK492G5P",
|
276 |
-
"title": "The REFANI Pakistan study\u2014a cluster randomised controlled trial of the effectiveness and cost-effectiveness of cash-based transfer programmes on child nutrition status: study protocol",
|
277 |
-
"abstract": "Cash-based transfer programmes are an emerging strategy in the prevention of wasting in children, especially targeted at vulnerable households during periods of food insecurity or during emergencies. However, the evidence surrounding the use of either cash or voucher transfer programmes in the humanitarian context and on nutritional outcomes is elusive. More evidence is needed not only to inform the global community of practice on best practices in humanitarian settings, but also to help strengthen national mitigation responses. Methods/Design The Research for Food Assistance on Nutrition Impact Pakistan study (REFANI-P) sets out to evaluate the impact of three cash-based interventions on nutritional outcomes in children aged less than five years from poor and very poor households in Dadu District. This four-arm parallel cluster randomised controlled trial is set among Action Against Hunger (ACF) programme villages in Dadu District, Sindh Province. Mothers are the target recipients of either seasonal unconditional cash transfers or fresh food vouchers. A comparison group receives \u2018standard care\u2019 provided by the ACF programme to which all groups have the same access. The primary outcomes are prevalence of wasting and mean weight-for-height Z-score (WHZ) in children. Impact will be assessed at 6 months and at 1 year from baseline. Using a theory-based approach we will determine \u2018how\u2019 the different interventions work by looking at the processes involved and the impact pathways following the theory of change developed for this context. Quantitative and qualitative data are collected on morbidity, health seeking, hygiene and nutrition behaviours, dietary diversity, haemoglobin concentration, women\u2019s empowerment, household food security and expenditures and social capital. The direct and indirect costs of each intervention borne by the implementing organisation and their partners as well as by beneficiaries and their communities are also assessed. Discussion The results of this trial will provide robust evidence to help increase knowledge about the predictability of how different modalities of cash-based transfer work best to reduce the risk of child wasting during a season where food insecurity is at its highest. Evidence on costing and cost-effectiveness will further aid decisions on choice of modality in terms of effectiveness and sustainability.",
|
278 |
-
"full_text": "",
|
279 |
-
"authors": [
|
280 |
-
"Fenn et al"
|
281 |
-
],
|
282 |
-
"doi": "10.1186/s12889-015-2380-3",
|
283 |
-
"year": null,
|
284 |
-
"item_type": "journalArticle",
|
285 |
-
"url": "https://bmcpublichealth.biomedcentral.com/articles/10.1186/s12889-015-2380-3"
|
286 |
-
},
|
287 |
-
{
|
288 |
-
"key": "4WXF37WF",
|
289 |
-
"title": "How Overseas Opportunities Shape Political Preferences: A Field Experiment on International Migration",
|
290 |
-
"abstract": "This paper demonstrates that access to overseas employment reduces support for taxation and redistribution by bolstering individuals\u2019 economic prospects. We present results from the \ufb01rst randomized controlled trial to result in international migration. Individuals who received the opportunity to migrate from India to the Middle East for work reported signi\ufb01cantly higher wages, greater economic con\ufb01dence, and more \ufb01scally conservative attitudes. Moreover, the program had lasting effects even for those who decided not to migrate, which we link to improved exit options. Our results speak to longstanding debates about the impact of globalization on economic development and welfare state politics.",
|
291 |
-
"full_text": "",
|
292 |
-
"authors": [
|
293 |
-
"Gaikwad N",
|
294 |
-
"Hanson K",
|
295 |
-
"Toth A"
|
296 |
-
],
|
297 |
-
"doi": "",
|
298 |
-
"year": null,
|
299 |
-
"item_type": "journalArticle",
|
300 |
-
"url": "https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3816464"
|
301 |
-
},
|
302 |
-
{
|
303 |
-
"key": "68ATB2KG",
|
304 |
-
"title": "How Migrant Resource Centres affect migration decisions: Quasi-experimental evidence from Afghanistan, Bangladesh, Iraq and Pakistan",
|
305 |
-
"abstract": "Several Migrant Resource Centres (MRCs) have been set up in South Asia jointly by national governments of origin and destination countries. Their objectives include encouragement of potential migrants to seek regular rather than irregular routes and to ensure the safety of those migrating, regardless of status. Of theoretical note, their activities utilise innovative, highly personalised counselling. This article provides quasi-experimental evidence of the effect of four activities - telephone and online counselling, and college outreach and pre-departure sessions - on 2215 randomly allocated users of the MRCs' services across six MRCs in four countries: Afghanistan, Bangladesh, Iraq and Pakistan. The effects are a large reduction in self-reported likelihood of migrating irregularly, and a strong increase in awareness of safe options and who to contact for assistance whilst migrating. The effects are consistent across activity type and MRC location, although magnitudes vary. These findings have implications for our understanding of how the decision to migrate is made, what interventions are effective and why.",
|
306 |
-
"full_text": "",
|
307 |
-
"authors": [
|
308 |
-
"Dennison J"
|
309 |
-
],
|
310 |
-
"doi": "10.1111/imig.13082",
|
311 |
-
"year": null,
|
312 |
-
"item_type": "journalArticle",
|
313 |
-
"url": ""
|
314 |
-
},
|
315 |
-
{
|
316 |
-
"key": "9YRUKMA5",
|
317 |
-
"title": "The Apprenticeship-to-Work Transition : Experimental Evidence from Ghana",
|
318 |
-
"abstract": "This paper examines the effects of a government-sponsored apprenticeship training program designed to address high levels of youth unemployment in Ghana. The study exploits randomized access to the program to examine the short-run effects of apprenticeship training on labor market outcomes. The results show that apprenticeships shift youth out of wage work and into self-employment. However, the loss of wage income is not offset by increases in self-employment profits in the short run. In addition, the study uses the randomized match between apprentices and training providers to examine the causal effect of characteristics of trainers on outcomes for apprentices. Participants who trained with the most experienced trainers or the most profitable ones had higher earnings. These increases more than offset the program's negative treatment effect on earnings. This suggests that training programs can be made more effective through better recruitment of trainers.",
|
319 |
-
"full_text": "",
|
320 |
-
"authors": [
|
321 |
-
"Hardy Morgan L",
|
322 |
-
"Mbiti Isaac Mulangu",
|
323 |
-
"Mccasland Jamie Lee",
|
324 |
-
"Salcher Isabelle"
|
325 |
-
],
|
326 |
-
"doi": "",
|
327 |
-
"year": null,
|
328 |
-
"item_type": "journalArticle",
|
329 |
-
"url": "https://www.proquest.com/working-papers/apprenticeship-work-transition-experimental/docview/2223061072/se-2 http://UnivofPretoria.on.worldcat.org/atoztitles/link?sid=ProQ:&issn=&volume=&issue=&title=IDEAS+Working+Paper+Series+from+RePEc&spage=&date=2019-01-01&atitle=The+Apprenticeship-to-Work+Transition+%3A+Experimental+Evidence+from+Ghana&au=Hardy%2C+Morgan+L%3BMbiti%2C+Isaac+Mulangu%3BMccasland%2C+Jamie+Lee%3BSalcher%2C+Isabelle&id=doi: https://ideas.repec.org/p/wbk/wbrwps/8851.html"
|
330 |
-
},
|
331 |
-
{
|
332 |
-
"key": "2YVH2MHU",
|
333 |
-
"title": "Get Rich or Die Tryin\u2019: Perceived Earnings, Perceived Mortality Rates, and Migration Decisions of Potential Work Migrants from Nepal",
|
334 |
-
"abstract": "This article reports on a randomized field experiment in which potential work migrants from Nepal to Malaysia and the Persian Gulf countries are provided with information on wages and mortality incidences at their intended destinations. It is found that, particularly for the group of potential migrants without prior foreign migration experience, the information changes their expectations of earnings and mortality risks abroad, which further changes their actual migration decisions. Using the exogenous variation in expectations, it is estimated that the elasticity of migration with respect to mortality rate expectation is 0.8, and the elasticity of migration with respect to earnings expectation is 1.1.",
|
335 |
-
"full_text": "",
|
336 |
-
"authors": [],
|
337 |
-
"doi": "",
|
338 |
-
"year": null,
|
339 |
-
"item_type": "journalArticle",
|
340 |
-
"url": ""
|
341 |
-
},
|
342 |
-
{
|
343 |
-
"key": "736V6NV8",
|
344 |
-
"title": "Harnessing the Development Benefits of International Migration: A Randomized Evaluation of Enhanced Pre-Departure Orientation Seminars for Migrants from the Philippines",
|
345 |
-
"abstract": "Pre-departure orientation seminars (PDOS) for migrants have the potential to become a key policy tool for increasing the benefits of migration. PDOS build on the fact that many migrants face important knowledge gaps with respect to various aspects of their destination country upon arrival. These knowledge gaps are particularly large for individuals who move from a developing to a developed country and have to navigate a completely different system. Many migrants may hence not be able to make optimal decisions, or only after costly learning. The principal idea of PDOS is to reduce these knowledge gaps early on and provide migrants with the right information to succeed abroad. There is currently no rigorous evidence on the effects of PDOS and on what kind of training modules matter. Using a randomized control trial, this project evaluates the effects of PDOS on migration outcomes of permanent migrants from the Philippines to the US. Together with the Commission on Filipinos Overseas (CFO), the key government agency tasked to manage permanent migration from the Philippines, we have developed new PDOS modules. The new PDOS aims to foster settlement and labor market integration and increase migrants? wellbeing more generally. It also aims to strengthen migrants? engagement in diaspora activities that contribute to development in the Philippines. We identify the effects of the new PDOS by randomly assigning migrants to different types of PDOS and tracking the impact on 1,273 migrants and their family members remaining in the Philippines over a period of two years after departure.",
|
346 |
-
"full_text": "",
|
347 |
-
"authors": [],
|
348 |
-
"doi": "10.1257/rct.1389-2.1",
|
349 |
-
"year": null,
|
350 |
-
"item_type": "journalArticle",
|
351 |
-
"url": "https://www.socialscienceregistry.org/trials/1389"
|
352 |
-
},
|
353 |
-
{
|
354 |
-
"key": "CNXHNZ6K",
|
355 |
-
"title": "Gender differences in the effects of vocational training: Constraints on women and drop-out behavior",
|
356 |
-
"abstract": "We provide experimental evidence on the effects of vocational and entrepreneurial training for Malawian youth, in an environment where access to schooling and formal sector employment is extremely low. We track a large fraction of program drop-outs \u2013 a common phenomenon in the training evaluation literature \u2013 and this allows us to examine the determinants and consequences of drop-out and how it mediates the effects of such programs. We find that women make decisions in a more constrained environment, and their participation affected by family obligations. Participation is more expensive for them, resulting in worse training experience. The training results in skills development, continued investment in human capital, and improved well-being, with more positive effects for men, but no improvements in labor market outcomes in the short run.",
|
357 |
-
"full_text": "",
|
358 |
-
"authors": [],
|
359 |
-
"doi": "10.1596/1813-9450-6545",
|
360 |
-
"year": null,
|
361 |
-
"item_type": "journalArticle",
|
362 |
-
"url": ""
|
363 |
-
},
|
364 |
-
{
|
365 |
-
"key": "P4QQT3NG",
|
366 |
-
"title": "Impacts of Targeted Covid-19 Cash Transfers in Togo",
|
367 |
-
"abstract": "In response to COVID-19, a third of social protection measures have taken the form of cash transfers reaching more than 1.1 billion people --- a 240% increase in coverage from pre-COVID levels. In the aftermath of the COVID-19 pandemic, direct cash transfers are an effective tool to protect vulnerable households. We conduct a randomized controlled trial (RCT) of a targeted cash transfer program implemented in rural Togo between November 2020 and May 2021. In collaboration with GiveDirectly, the government of Togo secured sufficient funding to provide benefits to roughly 57,000 of the approximately 580,000 citizens living in the poorest 100 cantons. Using mobile phone and satellite data, we identified the poorest cantons and poorest people living in them. We randomized the beneficiaries among the poorest phone owners. After registration, every month and for five months, eligible women receive a cash transfer of 8,620 F CFA ($15.5 US) and eligible men, a transfer of 7,450 F CFA ($13.5 US). We conduct a telephone survey at the end of the intervention to measure a wide range of outcomes, including consumption, food security, labor supply, access to health care, education, psychological well-being, financial inclusion and the perception of poverty. We also have access to administrative data of mobile phone companies in Togo, which will allow us to exploit phone usage behaviors and build other types of outcomes, such as adoption and use of the mobile money services, migration or predicted poverty.",
|
368 |
-
"full_text": "",
|
369 |
-
"authors": [],
|
370 |
-
"doi": "10.1257/rct.7590-1.1",
|
371 |
-
"year": null,
|
372 |
-
"item_type": "journalArticle",
|
373 |
-
"url": "https://www.socialscienceregistry.org/trials/7590"
|
374 |
-
},
|
375 |
-
{
|
376 |
-
"key": "VASWRVLM",
|
377 |
-
"title": "Information campaigns and migration perceptions: Evidence from Senegal",
|
378 |
-
"abstract": "The research studies the effect of information campaigns on irregular immigration on the intentions to migrate irregularly among high school students in Dakar. We analyze which actors and information content are effective the most in shaping students' intention to migrate and migration perceptions.",
|
379 |
-
"full_text": "",
|
380 |
-
"authors": [],
|
381 |
-
"doi": "10.1257/rct.8829-1.2",
|
382 |
-
"year": null,
|
383 |
-
"item_type": "journalArticle",
|
384 |
-
"url": "https://www.socialscienceregistry.org/trials/8829"
|
385 |
-
},
|
386 |
-
{
|
387 |
-
"key": "M9UMATUQ",
|
388 |
-
"title": "Information and Irregular Migration: Evidence from a Field Experiment in Nigeria",
|
389 |
-
"abstract": "Policy projections and recent research suggest that large numbers of irregular migrants from sub-Saharan Africa will continue to attempt to make their way to Europe over the next few decades. In response, European countries have made and continue to make significant investments in information campaigns designed to discourage irregular African migration. These campaigns are frequently accompanied by evaluations of some sort but, to our knowledge, none have involved a well-powered, randomized controlled trial with a representative sample and actual migration as an outcome. This pre-analysis plan describes the design of field experiment that addresses the following core questions: Are beliefs about migration-related risks, interest in attempting irregular migration, and actual migration decisions responsive to information campaigns highlighting the risks of the migration journey? The project takes place in Edo and Delta states, in the South-South region of Nigeria, a major Sub-Saharan African source of irregular migrants to Europe.",
|
390 |
-
"full_text": "",
|
391 |
-
"authors": [],
|
392 |
-
"doi": "10.1257/rct.8718-1.0",
|
393 |
-
"year": null,
|
394 |
-
"item_type": "journalArticle",
|
395 |
-
"url": "https://www.socialscienceregistry.org/trials/8718"
|
396 |
-
},
|
397 |
-
{
|
398 |
-
"key": "YFJ6ZQ94",
|
399 |
-
"title": "Informing Risky Migration: Evidence from a field experiment in Guinea",
|
400 |
-
"abstract": "Migrants from Western Africa go through risky migration routes to reach Europe. In addition, African migration to Europe often results in low economic outcomes. Potential migrants might be poorly informed about benefits and costs of migration. We then propose to use a Randomized Control Trial (RCT) to answer the following questions: (i) Are migrants are about their earning opportunities in Europe and risks connected to the journey? (ii) Can an intervention providing information about earnings and risks changes potential migrants? beliefs and so influences their migration choices?",
|
401 |
-
"full_text": "",
|
402 |
-
"authors": [],
|
403 |
-
"doi": "10.1257/rct.4062-1.1",
|
404 |
-
"year": null,
|
405 |
-
"item_type": "journalArticle",
|
406 |
-
"url": "https://www.socialscienceregistry.org/trials/4062"
|
407 |
-
},
|
408 |
-
{
|
409 |
-
"key": "ED6H9RXQ",
|
410 |
-
"title": "Micro-credit programs and off-farm migration in China",
|
411 |
-
"abstract": "This paper seeks to evaluate effects of micro-credit projects on the poor. We utilize data that we collected in Sichuan Province in 1999 to investigate whether micro-credit projects have targeted the poor and whether participation in the micro-credit project increases the likelihood of migration and switching to off-farm jobs. We find that, although the micro-credit programs did not help increase assets of the participants, it did help to move one or more of their members into an off-farm job. Our findings indicate that there is a great deal of benefit in supporting microcredit programs. \u00a9 2004 Blackwell Publishing Ltd.",
|
412 |
-
"full_text": "",
|
413 |
-
"authors": [
|
414 |
-
"Li H",
|
415 |
-
"Rozelle S",
|
416 |
-
"Zhang L"
|
417 |
-
],
|
418 |
-
"doi": "10.1111/j.1468-0106.2004.00245.x",
|
419 |
-
"year": null,
|
420 |
-
"item_type": "journalArticle",
|
421 |
-
"url": "https://www.scopus.com/inward/record.uri?eid=2-s2.0-9744253083&doi=10.1111%2fj.1468-0106.2004.00245.x&partnerID=40&md5=f2a50ff821db79c4dfabfa1decc3b723"
|
422 |
-
},
|
423 |
-
{
|
424 |
-
"key": "I4MY83RJ",
|
425 |
-
"title": "Experimental long-term effects of early-childhood and school-age exposure to a conditional cash transfer program",
|
426 |
-
"abstract": "Numerous evaluations of conditional cash transfer (CCT) programs show positive short-term impacts, but there is only limited evidence on whether these benefits translate into sustained longer-term gains. This paper uses the municipal-level randomized assignment of a CCT program implemented for five years in Honduras to estimate long-term effects 13 years after the program began. We estimate intent-to-treat effects using individual-level data from the population census, which allows assignment of individuals to their municipality of birth, thereby circumventing migration selection concerns. For the non-indigenous, we find positive and robust impacts on educational outcomes for cohorts of a very wide age range. These include increases of more than 50 percent for secondary school completion rates and the probability of reaching university studies for those exposed at school-going ages. They also include substantive gains for grades attained and current enrollment for others exposed during early childhood, raising the possibility of further gains going forward. Educational gains are, however, more limited for the indigenous. Finally, exposure to the CCT increased the probability of international migration for young men, from 3 to 7 percentage points, also stronger for the non-indigenous. Both early childhood exposure to the nutrition and health components of the CCT as well as exposure during school-going ages to the educational components led to sustained increases in human capital. \u00a9 2019 The Authors",
|
427 |
-
"full_text": "",
|
428 |
-
"authors": [
|
429 |
-
"Molina Mill\u00e1n",
|
430 |
-
"T",
|
431 |
-
"Macours K",
|
432 |
-
"Maluccio J A",
|
433 |
-
"Tejerina L"
|
434 |
-
],
|
435 |
-
"doi": "10.1016/j.jdeveco.2019.102385",
|
436 |
-
"year": null,
|
437 |
-
"item_type": "journalArticle",
|
438 |
-
"url": "https://www.scopus.com/inward/record.uri?eid=2-s2.0-85072577537&doi=10.1016%2fj.jdeveco.2019.102385&partnerID=40&md5=cbacf9b13921db5e8346649371e83718"
|
439 |
-
},
|
440 |
-
{
|
441 |
-
"key": "N6R57IVT",
|
442 |
-
"title": "Bilateral labor agreements and the migration of Filipinos: An instrumental variable approach",
|
443 |
-
"abstract": "Bilateral labor agreements (BLAs) are preferred policy models for regulating migration by many governments around the world. The Philippines has been a leader in both agreement conclusion and exporting labor. A recent Congressional evocation is pushing bureaucrats and academics alike to investigate this policy strategy for outcomes and effectiveness. The following analysis answers the question \"Do BLAs affect the migration outflows of Overseas Filipino Workers (OFWs)?\"using a plausibly exogenous variation to isolate a causal effect. I test for effects of BLAs using two instrumental variables (IVs), such as Bilateral Investment Treaties (BITs) and Formal Alliances, and an original dataset of land-based and sea-based Filipino BLAs and migrant stock in 213 unique areas from 1960 to 2018. I do not find any empirical evidence that these treaties drive migration. However, BLAs have statistically significant effects on gross domestic product (GDP) per capita and exports, suggesting other important channels through which these agreements affect economic outcomes. These null results are critically important for policymakers and diplomats because the resources spent on negotiation are wasted if the primary goal is to increase migration. \u00a9 2021 Brianna O'Steen, published by Sciendo.",
|
444 |
-
"full_text": "",
|
445 |
-
"authors": [
|
446 |
-
"O'Steen B"
|
447 |
-
],
|
448 |
-
"doi": "10.2478/izajodm-2021-0011",
|
449 |
-
"year": null,
|
450 |
-
"item_type": "journalArticle",
|
451 |
-
"url": "https://www.scopus.com/inward/record.uri?eid=2-s2.0-85117392815&doi=10.2478%2fizajodm-2021-0011&partnerID=40&md5=4d168fa69f58fc0804c9b0a8a8fd3172"
|
452 |
-
},
|
453 |
-
{
|
454 |
-
"key": "64F7ET9X",
|
455 |
-
"title": "Children on the Move : Progressive Redistribution of Humanitarian Cash Transfers among Refugees",
|
456 |
-
"abstract": "This paper evaluates the impact of the Emergency Social Safety Net (ESSN) in Turkey, the largest cash transfer program for international refugees in the world. The paper provides prima facie evidence that the program quickly caused substantial changes in household size and composition, with a net movement of primarily school-age children from larger ineligible households to smaller eligible ones. A sharp decline in inequality is observed in the entire study population: the Gini index declined by four percentage points (or 15 percent) within six months of program rollout, and the poverty headcount at the $3.20/day international poverty line declined by more than 50 percent after one year. ESSN caused a moderate increase in the diversity and frequency of food consumption among eligible households, and although there was no statistically significant effect on overall school enrollment, there were meaningful gains among the most vulnerable beneficiary households. To strike the right balance between transfer size and coverage, key parameters in the design of any cash transfer program, policy makers should consider the possibility that refugee populations may respond to their eligibility status by altering their household structure and living arrangements.",
|
457 |
-
"full_text": "",
|
458 |
-
"authors": [
|
459 |
-
"Ozler Berk",
|
460 |
-
"Celik Cigdem",
|
461 |
-
"Cunningham Scott",
|
462 |
-
"Cuevas Pablo Facundo",
|
463 |
-
"Parisotto Luca"
|
464 |
-
],
|
465 |
-
"doi": "",
|
466 |
-
"year": null,
|
467 |
-
"item_type": "journalArticle",
|
468 |
-
"url": "https://search.ebscohost.com/login.aspx?direct=true&db=edsrep&AN=edsrep.p.wbk.wbrwps.9471&site=eds-live"
|
469 |
-
},
|
470 |
-
{
|
471 |
-
"key": "82H99VKZ",
|
472 |
-
"title": "Do higher salaries lower physician migration?",
|
473 |
-
"abstract": "It is believed that low wages are an important reason why doctors and nurses in developing countries migrate, and this has led to a call for higher wages for health professionals in developing countries. In this paper, we provide some of the first estimates of the impact of raising health workers' salaries on migration. Using aggregate panel data on the stock of foreign doctors in 16 Organization for Economic Cooperation and Development countries, we explore the effect of a wage increase programme in Ghana on physician migration. We find evidence that 6 years after the implementation of this programme, the foreign stock of Ghanaian doctors abroad had fallen by approximately 10% relative to the estimated counterfactual. This result should be interpreted with caution, however, given the sensitivity of the results to changes in model specification. \u00a9 2013 The Author.",
|
474 |
-
"full_text": "",
|
475 |
-
"authors": [
|
476 |
-
"Okeke E N"
|
477 |
-
],
|
478 |
-
"doi": "10.1093/heapol/czt046",
|
479 |
-
"year": null,
|
480 |
-
"item_type": "journalArticle",
|
481 |
-
"url": "https://www.scopus.com/inward/record.uri?eid=2-s2.0-84906064721&doi=10.1093%2fheapol%2fczt046&partnerID=40&md5=094f43a6ca58fdbf70d99377b4c2379c"
|
482 |
-
},
|
483 |
-
{
|
484 |
-
"key": "924DRNUJ",
|
485 |
-
"title": "Aid and Migration: An Analysis of the Impact of Progresa on the Timing and Size of Labour Migration",
|
486 |
-
"abstract": "This paper models the short and medium-run impact of aid on migration, considering alternatively the effect of nconditional and conditional cash transfers to financially constrained households. Data from the evaluation of a Mexican development program, Progresa, are used to estimate the effect of the potential grant size on migration. The empirical analysis is consistent with model prediction. It shows that the program is associated with an increase in international migration, which is also a positive function of size of potential transfer. The grant may loosen financial constraints. At the same time, fine-tuned conditional grants targeting prospective migrants (in the form of secondary school subsidies) reduce the short-term migration probability. As regards medium-term migration, secondary school beneficiaries are not more likely to migrate than the control group after they complete the subsidised education cycle.",
|
487 |
-
"full_text": "",
|
488 |
-
"authors": [
|
489 |
-
"Manuela Angelucci"
|
490 |
-
],
|
491 |
-
"doi": "",
|
492 |
-
"year": null,
|
493 |
-
"item_type": "journalArticle",
|
494 |
-
"url": "https://docs.iza.org/dp1187.pdf"
|
495 |
-
},
|
496 |
-
{
|
497 |
-
"key": "UK8I5GM4",
|
498 |
-
"title": "Medical worker migration and origin-country human capital: Evidence from us visa policy",
|
499 |
-
"abstract": "We exploit changes in U.S. visa policies for nurses to measure the origin-country human capital response to international migration opportunities. Combining data on all migrant departures and postsecondary institutions in the Philippines, we show that nursing enrollment and graduation increased substantially in response to greater U.S. demand for nurses. The supply of nursing programs expanded. Nurse quality, measured by licensure exam pass rates, declined. Despite this, for each nurse migrant, 9 additional nurses were licensed. New nurses switched from other degree types, but graduated at higher rates than they would have otherwise, increasing the human capital stock in the Philippines.",
|
500 |
-
"full_text": "",
|
501 |
-
"authors": [],
|
502 |
-
"doi": "10.1162/rest_a_01131",
|
503 |
-
"year": null,
|
504 |
-
"item_type": "journalArticle",
|
505 |
-
"url": ""
|
506 |
-
},
|
507 |
-
{
|
508 |
-
"key": "GIQRAEI7",
|
509 |
-
"title": "Returns to International Migration: Evidence from a Bangladesh-Malaysia Visa Lottery",
|
510 |
-
"abstract": "We follow 3,512 (of 1.4 million) applicants to a government lottery that randomly allocated visas to Bangladeshis for low-skilled, temporary labor contracts in Malaysia. Most lottery winners migrate, and their remittance substantially raises their family's standard of living in Bangladesh. The migrant's absence pauses demographic changes (marriage, childbirth, household formation), and shifts decision-making power towards females. Migration removes enterprising individuals, lowering household entrepreneurship, but does not crowd out other family members' labor supply. One group of applicants were offered deferred migration that never materialized. Improved migration prospects induce pre-migration investments in skills that generate no returns in the domestic market.",
|
511 |
-
"full_text": "",
|
512 |
-
"authors": [
|
513 |
-
"Mobarak Ahmed Mushfiq",
|
514 |
-
"Sharif Iffath",
|
515 |
-
"Shrestha Maheshwor"
|
516 |
-
],
|
517 |
-
"doi": "",
|
518 |
-
"year": null,
|
519 |
-
"item_type": "journalArticle",
|
520 |
-
"url": ""
|
521 |
-
},
|
522 |
-
{
|
523 |
-
"key": "DEFXYBQK",
|
524 |
-
"title": "Role models and migration intentions",
|
525 |
-
"abstract": "Role models\u2014those individuals who resemble us but have achieved more than us\u2014 are thought to impact our aspirations. In this paper, we study the impact of role models on intentions to migrate. Specifically, we implement a randomized controlled trial to show documentaries in rural villages of Mali (Kayes region). These documentaries focus on economic opportunities and show either negative or positive portraits of migrants, or portraits of local people who have successfully set up flourishing businesses without ever considering migration. This paper adds to the larger debate about the efficiency of information provision. We find very few significant impacts, none of which hold when attrition is controlled for using nonparametric Lee bounds. We also implement a treatment heterogeneity analysis using a causal forest algorithm, which aside from confirming our average treatment effects suggests the presence of heterogeneity. It appears that individuals with living conditions that could facilitate migration are less likely to be significantly impacted. The high aspirations to improve living conditions, coupled with a strong feeling of lack of control over the future may help explaining the fact that confrontations with real life experiences do not significantly modify average aspirations to migrate.",
|
526 |
-
"full_text": "",
|
527 |
-
"authors": [
|
528 |
-
"Mespl\u00e9-Somps S",
|
529 |
-
"Nilsson B",
|
530 |
-
"d'Aiglepierre R"
|
531 |
-
],
|
532 |
-
"doi": "",
|
533 |
-
"year": null,
|
534 |
-
"item_type": "journalArticle",
|
535 |
-
"url": "https://www.cairn-int.info/journal-afd-research-papers-2021-200-page-1.htm"
|
536 |
-
},
|
537 |
-
{
|
538 |
-
"key": "RQXKP6NP",
|
539 |
-
"title": "Broken Promises: Evaluating an Incomplete Cash Transfer Program",
|
540 |
-
"abstract": "Interventions in highly insecure and fragile contexts are always confronted with the latent risk of not being able to implement the program as intended. Despite its high policy relevance, little is known about the impacts of program disruption or cancellation on beneficiaries. This study uses the unplanned cancellation of the South Sudan Youth Business Start-Up Grant Program to assess the socioeconomic, behavioral, and psychological consequences of a program that fails to be implemented as intended. Originally planned as a randomized trial, the Youth Startup Business Grant Program consisted of an unconditional cash grant combined with a business and life skills training targeting the youth in South Sudan. Due to the intensification of violence in the country, the disbursement of the grant was terminated in late 2016 before most of the intended beneficiaries had accessed the grant. The study uses survey data from face-to-face interviews and experimental data from lotteries, trust games, and a list experiment to assess the consequences of the cancellation in a comprehensive form. The empirical analysis employs instrumental variable regressions to control for individual characteristics that might have made it more likely to access the grant before disbursement was frozen. The results show that participants who received the originally planned treatment displayed significant improvements in their consumption, savings, and psychological well-being. However, participants who vainly expected to receive the cash grant showed reduced levels of consumption and women among this subgroup also experienced strong reductions in their trust level. In addition, the study finds some evidence that these women were less likely to migrate.",
|
541 |
-
"full_text": "",
|
542 |
-
"authors": [
|
543 |
-
"Muller Angelika",
|
544 |
-
"Pape Utz Johann",
|
545 |
-
"Ralston Laura R"
|
546 |
-
],
|
547 |
-
"doi": "",
|
548 |
-
"year": null,
|
549 |
-
"item_type": "journalArticle",
|
550 |
-
"url": ""
|
551 |
-
},
|
552 |
-
{
|
553 |
-
"key": "G79BE4TK",
|
554 |
-
"title": "The Benefits and Costs of Guest Worker Programs: Experimental Evidence from The India-UAE Migration Corridor",
|
555 |
-
"abstract": "We estimate the returns to temporary migration programs using a randomized control trial with several thousand job seekers in India applying to guest worker jobs in the United Arab \u2026",
|
556 |
-
"full_text": "",
|
557 |
-
"authors": [
|
558 |
-
"Naidu S",
|
559 |
-
"Nyarko Y",
|
560 |
-
"Wang SY"
|
561 |
-
],
|
562 |
-
"doi": "",
|
563 |
-
"year": null,
|
564 |
-
"item_type": "journalArticle",
|
565 |
-
"url": "https://econ.cms.arts.ubc.ca/wp-content/uploads/sites/38/2022/09/20221123_Suresh-Naidu.pdf"
|
566 |
-
},
|
567 |
-
{
|
568 |
-
"key": "5J2Z3L7J",
|
569 |
-
"title": "Do social protection programs foster short-term and long-term migration adaptation strategies?",
|
570 |
-
"abstract": "Abstract We examine how migration is influenced by temperature and precipitation variability, and the extent to which the receipt of a cash transfer affects the use of migration as an adaptation strategy. Climate data is merged with georeferenced panel data (2010\u20132014) on individual migration collected from the Zambian Child Grant Program (CGP) sites. We use the person-year dataset to identify the direct and heterogeneous causal effects of the CGP on mobility. Having access to cash transfers doubles the rate of male, short-distance moves during cool periods, irrespective of wealth. Receipt of cash transfers (among wealthier households) during extreme heat causes an additional retention of males. Cash transfers positively spur long-distance migration under normal climate conditions in the long term. They also facilitate short-distance responses to climate, but not long-distance responses that might be demanded by future climate change.",
|
571 |
-
"full_text": "",
|
572 |
-
"authors": [
|
573 |
-
"Mueller Valerie",
|
574 |
-
"Gray Clark",
|
575 |
-
"Handa Sudhanshu",
|
576 |
-
"Seidenfeld David"
|
577 |
-
],
|
578 |
-
"doi": "10.1017/S1355770X19000214",
|
579 |
-
"year": null,
|
580 |
-
"item_type": "journalArticle",
|
581 |
-
"url": "https://www.cambridge.org/core/product/identifier/S1355770X19000214/type/journal_article https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7062362/pdf/nihms-1558213.pdf"
|
582 |
-
},
|
583 |
-
{
|
584 |
-
"key": "EX4XE7QK",
|
585 |
-
"title": "Labor Productivity, Remittance Use, and the Impact of the Poverty Alleviation Fund (PAF) Program in Nepal",
|
586 |
-
"abstract": "This dissertation presents three studies related to labor productivity, remittances use, and the effect of an anti-poverty program on migration and remittances. Labor is the biggest endowment available to the poor. Understanding labor issues is important in addressing the problems of poverty, inequality, migration, and economic development. In this dissertation, I estimate the labor productivity of agricultural household because most of the agricultural households in developing countries work in their own farms, it is not possible to observe wages. The first chapter estimates the shadow wage (marginal productivity of labor) of the agricultural household in the context of Nepal. How different is marginal productivity of labor for women compared to men in agricultural households? In developing countries, where most of the families work on their farms, wage or labor-related income cannot be observed directly. This paper contributes to the literature on gender wage difference in labor and development economics by developing a new approach to estimate the shadow wage of agricultural households in Nepal. Using a general functional form, we first derive the shadow wage from a theoretical model. Then, a model with ward-level fixed effects is used to estimate the shadow wage by gender for Nepalese agricultural households. We find that the productivity of women is not that different than that of men. Despite the vast difference in observed market wages for women, the distribution of shadow wages of women is not that different from that of men, calling for policies to increase the market wages for women. The second chapter of this dissertation, attempts to understand the use of remittances among the households of Nepal. Remittances are transfers made by migrant workers to their family and relatives in their country of origin. In Nepal, remittances account for 25-30% of the GDP, and the trend of youths seeking work in other countries--mostly in Southeast Asia and the Middle East--has been increasing. Understanding the expenditure pattern of remittances-receiving households compared to non-recipients provides an understanding of the effect of remittances. In this chapter I employ nationally representative data from Nepal to investigate the effect of remittances on household expenditure patterns, and I compare the prevalence of poverty between remittance recipients and non-recipients. The findings that emerge are as follows: households receiving international and both domestic and international remittances have increased expenditure shares on education, suggesting investments in human capital in the household. In contrast I find a decrease in education expenditures for households receiving domestic remittances. Food expenditures share decreases for households receiving all types of remittances. Households receiving remittances increase the expenditure shares on durables and other consumption expenditures. Households receiving remittances have decreased shares in health expenditures. With regards to poverty, the paper shows that receiving remittances reduces the likelihood of being poor. In the third chapter of the dissertation, I evaluate the effects of the Poverty Alleviation Fund program (PAF) on remittances and migration using the data from a quasi-experiment. The PAF is a social fund program that has been providing services to marginalized communities in Nepal through various income-generating activities since 2006. Unlike previous research that has used conditional cash transfer programs (CCTs) to study the role of a development program on migration and remittances, I employ the data from the community-driven anti-poverty program that provides income-generating activities to participants. Using a panel dataset collected by Center for Economic Development and Administration (CEDA) of the Tribhuwan University and the PAF, and taking advantage of a quasi-randomized phase-in experimental design, I estimate the causal effects of a development program on remittances, migration, and welfare measures. I show that policy makers shou d be aware that community-driven development programs have unintended consequences for migration and remittances, which are distinct from the primary goals of the program: alleviating poverty and improving food security. The program results in a decrease of approximately Rs.6000 (approximately six percent of total household consumption) in remittances received, crowding out private transfers in the presence of public transfers. The paper shows an increase in domestic migration, but no change in international migration due to the program.",
|
587 |
-
"full_text": "",
|
588 |
-
"authors": [
|
589 |
-
"Nepal Atul"
|
590 |
-
],
|
591 |
-
"doi": "",
|
592 |
-
"year": null,
|
593 |
-
"item_type": "journalArticle",
|
594 |
-
"url": ""
|
595 |
-
},
|
596 |
-
{
|
597 |
-
"key": "QJH23MCD",
|
598 |
-
"title": "Safe Migration Awareness Campaign In Rural Communities Of Nigeria, The Procedure And Impacts",
|
599 |
-
"abstract": "International migration is undergoing unprecedented changes. The traditional determinants of migration such as poverty, food insecurity and climate change are giving way to new motivations. These new issues, that include but are not limited to ambitions to live a foreign lifestyle, incomplete and asymmetric information are capable of underestimating the risk in irregular migration. As the information about foreign lifestyle flow freely and new opportunities open, it becomes very difficult to manage irregular migration through border control. Within the transitional mode of international migration, the use of awareness campaigns, especially in rural areas of home countries that target the most vulnerable groups, \u2013 school-age youths, could become a veritable means of deterring irregular migration. In 2018, Ricosmigration \u2013 Rural Information Campaign on Safe Migration - received funding from the German Foreign Office to investigate why young people from Nigeria migrate irregularly and implement a safe migration awareness campaign for youth in rural secondary schools. This report is from the result of the project which cut across interviews of Nigerian migrants living in Italy, potential migrants in Nigeria, and the result of the awareness campaigns conducted in 10 secondary schools in Edo, Nigeria. In the report, we explain the profile of a potential migrant from Nigeria. We also explore how reduced capabilities to lead the desired life and how the increasing use of social media internet has greatly raised the likelihood of migration in Nigeria. We equally show in the detail how we implemented a randomized experiment to test the efficiency of the migration awareness campaign. The project provides a new dimension to the discourse of the root cause of migration by introducing the role of limited opportunities and freedom (capabilities), low life satisfaction, and incomplete information through social media. Additionally, it shows the power of light interventions such as awareness campaigns in reducing irregular migration. In particular, the result showed that about 77.2 per cent of Nigerian youths that responded to the interview have the intention to migrate abroad, and 37.2 per cent would migrate if they win a cash lottery that is enough to cover the migration cost. Our randomized experiment showed that migration awareness campaign could reduce the risk of being a victim of human trafficking by more than 50 per cent. It could also reduce the desire to engage in irregular migration by more than 30 per cent and increased the decision to take necessary steps to avoid human traffickers and follow proper procedures for safe migration by more than 50 per cent. The awareness campaign had a wide coverage reaching about 7000 students in rural communities in Edo State, Nigeria. The success factors of our awareness campaign include the utilization of appropriate channels, delivery of an accurate message that was tailored to the group we spoke to, and the use of respected external facilitators.",
|
600 |
-
"full_text": "",
|
601 |
-
"authors": [
|
602 |
-
"Obi Chinedu"
|
603 |
-
],
|
604 |
-
"doi": "",
|
605 |
-
"year": null,
|
606 |
-
"item_type": "journalArticle",
|
607 |
-
"url": "https://search.ebscohost.com/login.aspx?direct=true&db=edsrep&AN=edsrep.p.osf.socarx.v3kn2&site=eds-live"
|
608 |
-
},
|
609 |
-
{
|
610 |
-
"key": "PM9LIPT3",
|
611 |
-
"title": "Labour migration and households: A reconsideration of the effects of the social pension on labour supply in South Africa",
|
612 |
-
"abstract": "This paper re-examines the effect of the South African social pension on the labour supply of working-age adults using data from 1993. We take account of the fact that households may include non-resident members, and therefore the pension may play a role in facilitating migration to work or look for work. We find that rural African women are significantly more likely to be migrant workers when they are members of a household in receipt of a pension, and that it is female pension income that drives this result. We explore a number of possible reasons why pension income might have this effect.",
|
613 |
-
"full_text": "",
|
614 |
-
"authors": [
|
615 |
-
"Posel D",
|
616 |
-
"Fairburn J A",
|
617 |
-
"Lund F"
|
618 |
-
],
|
619 |
-
"doi": "10.1016/j.econmod.2005.10.010",
|
620 |
-
"year": null,
|
621 |
-
"item_type": "journalArticle",
|
622 |
-
"url": ""
|
623 |
-
},
|
624 |
-
{
|
625 |
-
"key": "X835X4JX",
|
626 |
-
"title": "Raising Awareness About the Risk of Irregular Migration: Quasi-Experimental Evidence from Guinea",
|
627 |
-
"abstract": "In response to mounting evidence of harm inflicted on irregular migrants along their journeys from West Africa to Europe, international organizations, civil society organizations, and governments have scaled up campaigns as a tool for raising awareness about the risks of irregular migration. Campaigns aim to counter misinformation by smugglers and facilitate safe migration decisions. Despite the growing number of interventions, there is limited empirical evidence on the impact and effectiveness of such campaigns. Based on a difference-in-difference design, this study investigates the effect of a mobile cinema and community discussion intervention on the perceptions, knowledge, and intentions of potential irregular migrants in Northern Guinea in 2019. The results show that potential migrants who participated in events were significantly more likely to show awareness gains and less likely to report high intentions to migrate irregularly. While the relative importance of risk perceptions and their impact on migration flows remain unclear, the findings provide evidence supporting the assumption that risk awareness can be a relevant factor in the decision-making process of potential irregular migrants. While campaigns may be an effective tool in certain contexts, effect sizes highlight the need for policymakers to keep realistic expectations.",
|
628 |
-
"full_text": "",
|
629 |
-
"authors": [
|
630 |
-
"Tjaden J",
|
631 |
-
"Gninafon H"
|
632 |
-
],
|
633 |
-
"doi": "10.1111/padr.12468",
|
634 |
-
"year": null,
|
635 |
-
"item_type": "journalArticle",
|
636 |
-
"url": ""
|
637 |
-
},
|
638 |
-
{
|
639 |
-
"key": "EZTFJFFS",
|
640 |
-
"title": "Household Structure and Short-Run Economic Change in Nicaragua",
|
641 |
-
"abstract": "During the economic crises Nicaragua suffered between 2000 and 2002, a conditional cash transfer program targeting poor households began operating. Using panel data on 1,397 households from the program's experimentally designed evaluation, we examined the impact of the program on household structure. Our findings suggest that the program enabled households to avoid reagglomeration during the economic crises, with households in control communities growing more than treated households. These changes were driven primarily by shifts in residence of relatively young men and women with close kinship ties to the household head. In contrast, households that received transfers continued to send off young adult members, suggesting that the program provided resources to overcome the short-term economic pressures on household structure.",
|
642 |
-
"full_text": "",
|
643 |
-
"authors": [
|
644 |
-
"Winters P",
|
645 |
-
"Stecklov G",
|
646 |
-
"Todd J"
|
647 |
-
],
|
648 |
-
"doi": "10.1111/j.1741-3737.2009.00628.x",
|
649 |
-
"year": null,
|
650 |
-
"item_type": "journalArticle",
|
651 |
-
"url": ""
|
652 |
-
},
|
653 |
-
{
|
654 |
-
"key": "G9HHCW5Z",
|
655 |
-
"title": "Empowering Indonesian Migrant Workers to Access Quality Overseas Placement Services",
|
656 |
-
"abstract": "Nearly 700,000 Indonesians migrate abroad for work each year. The vast majority do so through recruiters and placement agencies that facilitate temporary employment in countries across Asia and the Middle East. These agencies support migrants starting with pre-departure paperwork and training through repatriation, and are therefore a crucial determinant of a worker\u2019s migration experience. Potential migrants ostensibly have a great deal of choice between agencies \u2013 there are over 1,000 formally registered firms in Indonesia \u2013 and in theory, competition between these firms should drive out poorly performing agencies. Yet anecdotal evidence suggests that agency quality is highly variable, and that many agencies engage in exploitative practices. This could be due to market power at the local level, or informational failures, both of which would hamper competitive pressures.\nOur findings from preliminary research suggest that despite the fact that nearly three-quarters of female migrants believe that there is no relationship between the quality of the agencies and the experience with the employer; there is indeed a robust correlation between the two variables. However, migrants attribute the employer quality to \"nasib\", or fate.\nIn 2015, we ran information campaigns designed to transmit information on agency quality to potential migrants. Surveys will be conducted to evaluate the impact of the information campaigns on migrants\u2019 outcomes.",
|
657 |
-
"full_text": "",
|
658 |
-
"authors": [
|
659 |
-
"Schaner Simone",
|
660 |
-
"Cameron Lisa",
|
661 |
-
"Bazzi Samuel",
|
662 |
-
"Kartaadipoetra Firman Witoelar"
|
663 |
-
],
|
664 |
-
"doi": "",
|
665 |
-
"year": null,
|
666 |
-
"item_type": "journalArticle",
|
667 |
-
"url": "https://www.socialscienceregistry.org/trials/630"
|
668 |
-
},
|
669 |
-
{
|
670 |
-
"key": "SNG5JMCQ",
|
671 |
-
"title": "The impact of providing vocational training to young men on labour outcomes and attitudes towards migration in northern Guinea-Bissau",
|
672 |
-
"abstract": "As in most of Sub-Saharan Africa, the lack of quality employment among the rural youth is threatening economic development and inclusive growth, with employment search arguably working as an important driver for both internal and international migration. Active labour market policies, such as vocational trainings, are frequently chosen by governments, international institutions and NGOs as a potential solution to these labour market frictions. Nevertheless, the causal evidence determining the impact of these programs on the youth of rural areas is scarce in the sub-region, and inexistent in Guinea-Bissau. In this project, we run a randomized controlled trial within the GOT project implemented by the NGO ENGIM. This project provides vocational training courses on professional skills thought to be particularly relevant in the local context, and facilitates traineeships in local businesses for young men in two northern regions of the country, aiming to prevent their engagement in irregular migration practices. Assessing the impact of the GOT project on the employment rates, income and attitudes towards migrations of its trainees should contribute to a better understanding of the impact of active labour market policies in rural areas of low income countries, facilitating a better design, implementation and evaluation of such programmes in Guinea-Bissau and similar contexts.",
|
673 |
-
"full_text": "",
|
674 |
-
"authors": [],
|
675 |
-
"doi": "10.1257/rct.6890-1.2",
|
676 |
-
"year": null,
|
677 |
-
"item_type": "journalArticle",
|
678 |
-
"url": "https://www.socialscienceregistry.org/trials/6890"
|
679 |
-
},
|
680 |
-
{
|
681 |
-
"key": "QYAQM7H9",
|
682 |
-
"title": "Weather Insurance and Investment Choice",
|
683 |
-
"abstract": "Exposure to the risk of extreme weather conditions has been shown to constrain investment\nby subsistence farmers in developing countries and may lead to ine\u00a2cient production choices.\nThis paper evaluates whether insuring farmers against such risks alters resource allocation decisions. In particular I consider the e\u00a7ects of a Mexican government disaster relief program with\ninsurance-like features. The results, based on a regression discontinuity design, indicate that\ninsurance against losses arising from natural disasters changes how rural households invest in\ntheir farms. Insured farmers utilize more expensive capital inputs and adopt di\u00a7erent technologies. Additionally, the insurance changes labor supply patterns. Notably, members of insured\nhouseholds are approximately 10% more likely to migrate internationally. Additional results,\nthat the program matters most when the returns to migration are more unpredictable, are\nconsistent with a model where insurance obviates the need for precautionary savings, allowing\nhouseholds to \u00d6nance international migration.",
|
684 |
-
"full_text": "",
|
685 |
-
"authors": [
|
686 |
-
"Shapiro J"
|
687 |
-
],
|
688 |
-
"doi": "",
|
689 |
-
"year": null,
|
690 |
-
"item_type": "journalArticle",
|
691 |
-
"url": ""
|
692 |
-
},
|
693 |
-
{
|
694 |
-
"key": "8EFH4AP4",
|
695 |
-
"title": "Can Public Transfers Reduce Mexican Migration? A study based on randomized experimental data",
|
696 |
-
"abstract": "Prior research on Mexican migration has shown that social networks and economic incentives play an important role in determining migration outcomes. This study utilizes experimental data on PROGRESA, Mexico's primary poverty reduction program, to evaluate the effects of public cash transfers on migration. Our study complements a growing body of literature aimed at overcoming longstanding hurdles towards the establishment of causal validity in empirical studies of migration. We find that public cash transfers reduce US migration but have little effect on domestic migration. Furthermore, we find that the provision of cash transfers appears to reduce migration partly by reducing the relative deprivation levels of poor households. Finally, we find that the effect of public cash transfers on US migration depend on the size of existing US migration networks. Surprisingly, we see that transfers have larger (more negative) effects on US migration in communities with large existing networks. The results suggest that public transfers may be helpful in managing rural out-migration, particularly to the US. Interestingly, such programs may be most effective if they are targeted towards communities with strong existing migration patterns.",
|
697 |
-
"full_text": "",
|
698 |
-
"authors": [
|
699 |
-
"Stecklov Guy",
|
700 |
-
"Stampini Marco",
|
701 |
-
"Davis Benjamin"
|
702 |
-
],
|
703 |
-
"doi": "",
|
704 |
-
"year": null,
|
705 |
-
"item_type": "journalArticle",
|
706 |
-
"url": ""
|
707 |
-
},
|
708 |
-
{
|
709 |
-
"key": "5M6JE7W5",
|
710 |
-
"title": "Do Conditional Cash Transfers Influence Migration? A Study Using Experimental Data From The Mexican PROGRESA Program",
|
711 |
-
"abstract": "Prior research on Mexican migration has shown that social networks and economic incentives play an important role in determining migration outcomes. We use experimental data from PROGRESA, Mexico's primary poverty-reduction program, to evaluate the effects of conditional cash transfers on migration both domestically and to the United States. Our study complements a growing body of literature aimed at overcoming longstanding hurdles to the establishment of causal validity in empirical studies of migration. Analysis based on the data collected before and after the program 's onset shows that conditional transfers reduce U.S. migration but not domestic migration. The data also enable us to explore the role of existing family and community migration networks. The results show that migration networks strongly influence migration, but that the effect of conditional transfers on migration is apparently not mediated by existing migration network structures. Our results suggest that conditional transfers may be helpful in managing rural out-migration, particularly to the United States.",
|
712 |
-
"full_text": "",
|
713 |
-
"authors": [
|
714 |
-
"Stecklov Guy",
|
715 |
-
"Winters Paul",
|
716 |
-
"Stampini Marco",
|
717 |
-
"Davis Benjamin"
|
718 |
-
],
|
719 |
-
"doi": "",
|
720 |
-
"year": null,
|
721 |
-
"item_type": "journalArticle",
|
722 |
-
"url": "https://www.jstor.org/stable/4147339?seq=1#page_scan_tab_contents"
|
723 |
-
},
|
724 |
-
{
|
725 |
-
"key": "DG5T267N",
|
726 |
-
"title": "Cash transfers and migration: theory and evidence from a randomized controlled trial",
|
727 |
-
"abstract": "Will the fast expansion of cash-based programming in developing countries increase international migration? Theoretically, cash transfers may favor international migration by relaxing liquidity, credit, and risk constraints. But transfers, especially those conditional upon staying at home, may also increase the opportunity cost of migrating abroad. This paper evaluates the impact of a cash-for-work program on migration. Randomly selected households in Comoros were offered up to US$320 in cash in exchange for their participation in public works projects. We find that the program increased migration to Mayotte - the neighboring and richer French Island - by 38 percent, from 7.8% to 10.8%. The increase in migration is explained by the alleviation of liquidity and risk constraints, and by the fact that the program did not increase the opportunity cost of migration for likely migrants.",
|
728 |
-
"full_text": "",
|
729 |
-
"authors": [
|
730 |
-
"Sterck O",
|
731 |
-
"Gazeaud J",
|
732 |
-
"Mvukiyehe E"
|
733 |
-
],
|
734 |
-
"doi": "",
|
735 |
-
"year": null,
|
736 |
-
"item_type": "journalArticle",
|
737 |
-
"url": "https://www.csae.ox.ac.uk/materials/papers/csae-wps-2019-16.pdf"
|
738 |
-
},
|
739 |
-
{
|
740 |
-
"key": "CAJ5PJQW",
|
741 |
-
"title": "The impact of Indian SHGs: a long-run field experiment in Jharkhand",
|
742 |
-
"abstract": "This field experiment randomized access to Self-Help Groups in villages spread over the entire state of Jharkhand and surveyed a sample of 1,080 households three times between 2004 and 2009, in order to evaluate the changes in their living standards. We study impacts on children education and labor, household consumption and risk-coping behavior (including migration), and local credit markets.",
|
743 |
-
"full_text": "",
|
744 |
-
"authors": [],
|
745 |
-
"doi": "10.1257/rct.5570-1.1",
|
746 |
-
"year": null,
|
747 |
-
"item_type": "journalArticle",
|
748 |
-
"url": "https://www.socialscienceregistry.org/trials/5570"
|
749 |
-
},
|
750 |
-
{
|
751 |
-
"key": "MHIY5NJJ",
|
752 |
-
"title": "The value of forecasts: Experimental evidence from developing-country agriculture",
|
753 |
-
"abstract": "Climate risk is a key driver of low agricultural productivity in poor countries. We use a cluster-randomized trial to evaluate a novel risk-mitigation approach: long-range forecasts that provide information about the onset of the Indian summer monsoon well in advance of its arrival. In contrast to traditional approaches that allow farmers to cope with risk ex post, this new ex ante technology provides accurate information at least one month in advance of the monsoon's arrival, enabling farmers to alter cropping choices and other up front input decisions. Moreover, forecasts have the potential to be disseminated cheaply, even at scale. We assign 250 villages to one of three groups: a control group; a group that is given an opportunity to purchase the forecast; and a group that is offered insurance. This design allows us to investigate farmers' willingness-to-pay for forecasts; measure how forecasts affect farmer beliefs, up-front investments, and welfare; and study how these effects compare to the canonical ex post loss mitigation tool: weather-based index insurance.",
|
754 |
-
"full_text": "",
|
755 |
-
"authors": [],
|
756 |
-
"doi": "10.1257/rct.8846-1.0",
|
757 |
-
"year": null,
|
758 |
-
"item_type": "journalArticle",
|
759 |
-
"url": "https://www.socialscienceregistry.org/trials/8846"
|
760 |
-
},
|
761 |
-
{
|
762 |
-
"key": "YYL2HIQB",
|
763 |
-
"title": "Investments in Human Capital: Long-term Effects of Progresa-Oportunidades on Poverty and Migration in Rural Mexico.",
|
764 |
-
"abstract": "This paper evaluates the effects on poverty reduction and migration of a conditional cash transfer program in Mexico named Oportunidades (previously Progresa). This program, the first in Latin America and the most imitated of its kind, was intended to increase human capital, which would eventually translate into poverty reduction. Linear and non-linear panel models are used to explore whether there are any such effects, and the implications for the effectiveness and evaluation strategies of the program. No significant effects of Progresa-Oportunidades in reducing income poverty or affecting international migration were found at the rural level. However, there is a weak effect in the case of domestic migration. As data continues to become available through Mexico's official Secretariat of Social Development, there will be more opportunities for further exploration of the relationship between this program, poverty alleviation, and migration outcomes. Limitations and further recommendations for this study are also discussed.",
|
765 |
-
"full_text": "",
|
766 |
-
"authors": [
|
767 |
-
"TIRADO J ALEJANDRO"
|
768 |
-
],
|
769 |
-
"doi": "",
|
770 |
-
"year": null,
|
771 |
-
"item_type": "journalArticle",
|
772 |
-
"url": "https://search.ebscohost.com/login.aspx?direct=true&profile=ehost&scope=site&authtype=crawler&jrnl=20672640&AN=113660670&h=tw80U6FJzYcJYu3fTX%2BMPrdXbXrYCOOX2ZDxlHcnJdmg5T13YEukzyFOx75iYT%2F%2BuqTBgG5p2dwmyl3bwBylKg%3D%3D&crl=c"
|
773 |
-
},
|
774 |
-
{
|
775 |
-
"key": "X2YYD8XC",
|
776 |
-
"title": "The effect of peer-to-peer risk information on potential migrants ' Evidence from a randomized controlled trial in Senegal",
|
777 |
-
"abstract": "In response to mounting evidence on the dangers of irregular migration from Africa to Europe, the number of information campaigns which aim to raise awareness about the potential risks has rapidly increased. Governments, international organizations and civil society organizations implement a variety of campaigns to counter the spread of misinformation accelerated by smuggling and trafficking networks. The evidence on the effects of such information interventions on potential migrants remains limited and largely anecdotal. More generally, the role of risk perceptions in the decision-making process of potential irregular migrants is rarely explicitly tested, despite the fact that the concept of risk pervades conventional migration models, particularly in the field of economics. We address this gap by assessing the effects of a peer-to-peer information intervention on the perceptions, knowledge and intentions of potential migrants in Dakar, Senegal, using a randomized controlled trial design. The results show that--three months after the intervention--peer-to-peer information events increase potential migrants' subjective information levels, raise risk awareness, and reduce intentions to migrate irregularly. We find no substantial effects on factual migration knowledge. We discuss how the effects may be driven by the trust and identification-enhancing nature of peer-to-peer communication.",
|
778 |
-
"full_text": "",
|
779 |
-
"authors": [
|
780 |
-
"Tjaden Jasper",
|
781 |
-
"Dunsch Felipe Alexander"
|
782 |
-
],
|
783 |
-
"doi": "10.1016/j.worlddev.2021.105488",
|
784 |
-
"year": null,
|
785 |
-
"item_type": "journalArticle",
|
786 |
-
"url": "https://linkinghub.elsevier.com/retrieve/pii/S0305750X21001005"
|
787 |
-
},
|
788 |
-
{
|
789 |
-
"key": "FC8EU2Q3",
|
790 |
-
"title": "Universal Basic Income in Kenya",
|
791 |
-
"abstract": "A universal basic income (UBI) is a recurring, unconditional cash transfer sized to meet basic needs and paid to all members of a society. Proponents argue that a UBI has the potential to eliminate extreme poverty and to counteract the harmful effects of rising inequality in wealthier countries. Interest has surged, with UBI actively debated in countries ranging from Switzerland and Finland to Namibia and India. Yet, while cash transfers in general have a strong evidence base, a full basic income has never been implemented or rigorously evaluated. This study proposes to fill these evidence gaps with an ambitious long-term randomized control trial in Kenya. The core objective is to test the hypothesis that a universal basic income is an effective way to eliminate extreme global poverty. This is a central policy question currently being debated in a number of emerging markets, and is also highly relevant for foreign aid policy given that the global poverty gap has fallen to $80B a year as of 2015, less than half of official development assistance flows. Positive results could shift public spending away from in-kind and means-tested programs, while negative ones could have the opposite effect. As a secondary goal, the study also aims to inform debate on the role of UBI in wealthy countries. While the populations are obviously different from those we will work with in East Africa, many of the core questions about human behavior are the same ? does economic security motivate people to work more or less? To socialize more or less? etc. At a minimum, positive results from a low-cost emerging-market evaluation could be motivator for testing more expensive guarantees in richer countries. Finally, it is worth emphasizing that in the process of producing this evidence the project will also directly benefit some of the poorest people on the planet by delivering cash transfers to them. The broader evidence base on cash transfers suggests that these recipients will reap life-changing benefits from participating in the project.",
|
792 |
-
"full_text": "",
|
793 |
-
"authors": [],
|
794 |
-
"doi": "10.1257/rct.1952-2.1",
|
795 |
-
"year": null,
|
796 |
-
"item_type": "journalArticle",
|
797 |
-
"url": "https://www.socialscienceregistry.org/trials/1952"
|
798 |
-
},
|
799 |
-
{
|
800 |
-
"key": "UX36F5C2",
|
801 |
-
"title": "Liquidity Constraints and Migration: Evidence from Indonesia",
|
802 |
-
"abstract": "Although liquidity constraints have been seen as both a factor limiting individuals from migrating and a motivation for households to send a migrant, the consequences of relaxing liquidity constraints on migration behavior have not been adequately explored due to data limitations. In this study, we take advantage of an unusual policy, Bantuan Langsung Tunai -- a national-level unconditional cash transfer program targeted toward the poorest households in Indonesia -- to empirically assess the impact of increased liquidity on the migration behavior of poor Indonesian households.With a highly mobile population and a long history of circular migration, Indonesia is an ideal space to study migration. Using panel data from the Indonesian Family Life Survey, the results demonstrate that a positive liquidity shock increases the probability of migration among low-asset households, among households with a migration history, and, most significantly, among lowasset households with a migration history. [ABSTRACT FROM AUTHOR] Copyright of International Migration Review is the property of Sage Publications Inc. and its content may not be copied or emailed to multiple sites or posted to a listserv without the copyright holder's express written permission. However, users may print, download, or email articles for individual use. This abstract may be abridged. No warranty is given about the accuracy of the copy. Users should refer to the original published version of the material for the full abstract. (Copyright applies to all Abstracts.)",
|
803 |
-
"full_text": "",
|
804 |
-
"authors": [
|
805 |
-
"Tiwari Smriti",
|
806 |
-
"Winters Paul C"
|
807 |
-
],
|
808 |
-
"doi": "10.1177/0197918318768555",
|
809 |
-
"year": null,
|
810 |
-
"item_type": "journalArticle",
|
811 |
-
"url": "http://journals.sagepub.com/doi/10.1177/0197918318768555"
|
812 |
-
}
|
813 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data/kayongo-papers_zotero_items.json
DELETED
@@ -1,222 +0,0 @@
|
|
1 |
-
[
|
2 |
-
{
|
3 |
-
"key": "UNWR6MI4",
|
4 |
-
"title": "Le\u00e7ons du Rapid Response Service en Ouganda",
|
5 |
-
"abstract": "R\u00e9sum\u00e9 Le Service de r\u00e9ponse rapide (RRS)\u2013en anglais Rapid Reponse Service\u2013est un service d'application de connaissances. Il r\u00e9pond au besoin de donn\u00e9es des d\u00e9cideurs en \u2026",
|
6 |
-
"full_text": "",
|
7 |
-
"authors": [
|
8 |
-
"I Kawooya",
|
9 |
-
"I Ddumba",
|
10 |
-
"E Kayongo",
|
11 |
-
"..."
|
12 |
-
],
|
13 |
-
"doi": "",
|
14 |
-
"year": null,
|
15 |
-
"item_type": "journalArticle",
|
16 |
-
"url": "https://www.cres-sn.org/wp-content/uploads/2022/03/Ebook-Donnees-probantes.pdf#page=241"
|
17 |
-
},
|
18 |
-
{
|
19 |
-
"key": "QEZLUVIL",
|
20 |
-
"title": "Brain Magnetic Resonance Imaging and Angiography Findings in Ugandan Children with Sickle Cell Anemia; A Cross Sectional Study",
|
21 |
-
"abstract": "Abstract Sickle Cell Anemia (SCA) is a leading cause of childhood stroke in sub-Saharan Africa and sickle cell brain vasculopathy manifests either as overt stroke or clinically\" silent \u2026",
|
22 |
-
"full_text": "",
|
23 |
-
"authors": [
|
24 |
-
"R Idro",
|
25 |
-
"NS Green",
|
26 |
-
"D Munube",
|
27 |
-
"LR Buluma",
|
28 |
-
"B Kebirungi",
|
29 |
-
"..."
|
30 |
-
],
|
31 |
-
"doi": "",
|
32 |
-
"year": null,
|
33 |
-
"item_type": "journalArticle",
|
34 |
-
"url": "https://ashpublications.org/blood/article/132/Supplement%201/2376/264336"
|
35 |
-
},
|
36 |
-
{
|
37 |
-
"key": "BN43BLJ5",
|
38 |
-
"title": "Accuracy of the chest x-ray in screening for tuberculosis in Uganda: A cross-sectional study.",
|
39 |
-
"abstract": "Abstract ABSTRACT BACKGROUND: The WHO END TB strategy requires\u2265 90% case detection to combat tuberculosis (TB). Increased TB case detection requires a more \u2026",
|
40 |
-
"full_text": "",
|
41 |
-
"authors": [
|
42 |
-
"J Nalunjogi",
|
43 |
-
"F Mugabe",
|
44 |
-
"I Najjingo",
|
45 |
-
"P Lusiba",
|
46 |
-
"F Olweny",
|
47 |
-
"..."
|
48 |
-
],
|
49 |
-
"doi": "",
|
50 |
-
"year": null,
|
51 |
-
"item_type": "journalArticle",
|
52 |
-
"url": "https://www.researchsquare.com/article/rs-37900/latest.pdf"
|
53 |
-
},
|
54 |
-
{
|
55 |
-
"key": "PF63FYYY",
|
56 |
-
"title": "Rapidly responding to policy queries with evidence: Learning from rapid response services in Uganda",
|
57 |
-
"abstract": "Summary The Rapid Response Service (RRS) is a knowledge translation service in Uganda that responds to a decision maker's needs for evidence with synthesised relevant evidence \u2026",
|
58 |
-
"full_text": "",
|
59 |
-
"authors": [
|
60 |
-
"I Kawooya",
|
61 |
-
"I Ddumba",
|
62 |
-
"E Kayongo",
|
63 |
-
"..."
|
64 |
-
],
|
65 |
-
"doi": "",
|
66 |
-
"year": null,
|
67 |
-
"item_type": "journalArticle",
|
68 |
-
"url": "https://library.oapen.org/bitstream/handle/20.500.12657/39511/9780367440121_text.pdf?sequence=1#page=159"
|
69 |
-
},
|
70 |
-
{
|
71 |
-
"key": "VXFKNQIN",
|
72 |
-
"title": "Pre-diagnostic drop out of presumptive TB patients and its associated factors at Bugembe Health Centre IV in Jinja, Uganda",
|
73 |
-
"abstract": "Background: Drop out of presumptive TB individuals before making a final diagnosis poses a danger to the individual and their community. We aimed to determine the proportion of \u2026",
|
74 |
-
"full_text": "",
|
75 |
-
"authors": [
|
76 |
-
"G Ekuka",
|
77 |
-
"I Kawooya",
|
78 |
-
"E Kayongo",
|
79 |
-
"R Ssenyonga",
|
80 |
-
"..."
|
81 |
-
],
|
82 |
-
"doi": "",
|
83 |
-
"year": null,
|
84 |
-
"item_type": "journalArticle",
|
85 |
-
"url": "https://www.ajol.info/index.php/ahs/article/view/197831"
|
86 |
-
},
|
87 |
-
{
|
88 |
-
"key": "KQWSK82P",
|
89 |
-
"title": "Point\u2010of\u2010care diagnostic tests for sickle cell disease",
|
90 |
-
"abstract": "Objectives This is a protocol for a Cochrane Review (diagnostic). The objectives are as follows: To determine the accuracy of point\u2010of\u2010care tests (POCT) to screen sickle cell \u2026",
|
91 |
-
"full_text": "",
|
92 |
-
"authors": [
|
93 |
-
"I Kawooya",
|
94 |
-
"E Kayongo",
|
95 |
-
"D Munube",
|
96 |
-
"..."
|
97 |
-
],
|
98 |
-
"doi": "10.1002/14651858.CD014584",
|
99 |
-
"year": null,
|
100 |
-
"item_type": "journalArticle",
|
101 |
-
"url": "https://www.cochranelibrary.com/cdsr/doi/10.1002/14651858.CD014584/abstract"
|
102 |
-
},
|
103 |
-
{
|
104 |
-
"key": "8PMU8JR9",
|
105 |
-
"title": "of nodding syndrome",
|
106 |
-
"abstract": "Aims. Nodding syndrome is a poorly understood acquired disorder affecting children in sub-Saharan Africa. The aetiology and pathogenesis are unknown, and no specific treatment is \u2026",
|
107 |
-
"full_text": "",
|
108 |
-
"authors": [
|
109 |
-
"E Kayongo",
|
110 |
-
"N Gumisiriza",
|
111 |
-
"A Lanyero",
|
112 |
-
"..."
|
113 |
-
],
|
114 |
-
"doi": "",
|
115 |
-
"year": null,
|
116 |
-
"item_type": "journalArticle",
|
117 |
-
"url": "https://pdfs.semanticscholar.org/a0a3/7f6c382fe555492d8640855e31bf233881c0.pdf"
|
118 |
-
},
|
119 |
-
{
|
120 |
-
"key": "AN26LWTD",
|
121 |
-
"title": "Accuracy and incremental yield of the chest X-ray in screening for tuberculosis in Uganda: a cross-sectional study",
|
122 |
-
"abstract": "The WHO END TB strategy requires\u2265 90% case detection to combat tuberculosis (TB). Increased TB case detection requires a more sensitive and specific screening tool \u2026",
|
123 |
-
"full_text": "",
|
124 |
-
"authors": [
|
125 |
-
"J Nalunjogi",
|
126 |
-
"F Mugabe",
|
127 |
-
"I Najjingo",
|
128 |
-
"P Lusiba",
|
129 |
-
"..."
|
130 |
-
],
|
131 |
-
"doi": "",
|
132 |
-
"year": null,
|
133 |
-
"item_type": "journalArticle",
|
134 |
-
"url": "https://www.hindawi.com/journals/trt/2021/6622809/"
|
135 |
-
},
|
136 |
-
{
|
137 |
-
"key": "MAYC8H5C",
|
138 |
-
"title": "Vulnerability of Populations to Malaria after Indoor Residual Spraying is Withdrawn from Areas where its Use has Previously Been Sustained. Protocol for a Systematic \u2026",
|
139 |
-
"abstract": "Background: With its proven effectiveness, indoor residual spraying (IRS) as a malaria vector control strategy forms one of the reliable vector control strategies, especially when at \u2026",
|
140 |
-
"full_text": "",
|
141 |
-
"authors": [
|
142 |
-
"P Orishaba",
|
143 |
-
"E Kayongo",
|
144 |
-
"P Lusiba",
|
145 |
-
"C Nakalema",
|
146 |
-
"..."
|
147 |
-
],
|
148 |
-
"doi": "10.1101/2022.05.24.22275507.abstract",
|
149 |
-
"year": null,
|
150 |
-
"item_type": "journalArticle",
|
151 |
-
"url": "https://www.medrxiv.org/content/10.1101/2022.05.24.22275507.abstract"
|
152 |
-
},
|
153 |
-
{
|
154 |
-
"key": "S2FGVY8R",
|
155 |
-
"title": "Asymptomatic malaria parasitaemia and seizure control in children with nodding syndrome; a cross-sectional study",
|
156 |
-
"abstract": "Objective Plasmodium falciparum is epileptogenic and in malaria endemic areas, is a leading cause of acute seizures. In these areas, asymptomatic infections are common but \u2026",
|
157 |
-
"full_text": "",
|
158 |
-
"authors": [
|
159 |
-
"R Ogwang",
|
160 |
-
"R Anguzu",
|
161 |
-
"P Akun",
|
162 |
-
"A Ningwa",
|
163 |
-
"E Kayongo",
|
164 |
-
"..."
|
165 |
-
],
|
166 |
-
"doi": "",
|
167 |
-
"year": null,
|
168 |
-
"item_type": "journalArticle",
|
169 |
-
"url": "https://bmjopen.bmj.com/content/8/10/e023624.abstract"
|
170 |
-
},
|
171 |
-
{
|
172 |
-
"key": "6KALDEWN",
|
173 |
-
"title": "Adherence to the MDR-TB intensive phase treatment protocol amongst individuals followed up at central and peripheral health care facilities in Uganda-a descriptive \u2026",
|
174 |
-
"abstract": "Background: Following initiation of MDR-TB treatment, patients have a choice to receive follow up DOT supervision at either the central initiating facility or at a peripheral facility \u2026",
|
175 |
-
"full_text": "",
|
176 |
-
"authors": [
|
177 |
-
"J Mukasa",
|
178 |
-
"E Kayongo",
|
179 |
-
"I Kawooya",
|
180 |
-
"D Lukoye",
|
181 |
-
"..."
|
182 |
-
],
|
183 |
-
"doi": "",
|
184 |
-
"year": null,
|
185 |
-
"item_type": "journalArticle",
|
186 |
-
"url": "https://www.ajol.info/index.php/ahs/article/view/197828"
|
187 |
-
},
|
188 |
-
{
|
189 |
-
"key": "76FY87Z6",
|
190 |
-
"title": "The natural history of nodding syndrome",
|
191 |
-
"abstract": "Aims. Nodding syndrome is a poorly understood acquired disorder affecting children in sub\u2010Saharan Africa. The aetiology and pathogenesis are unknown, and no specific treatment is \u2026",
|
192 |
-
"full_text": "",
|
193 |
-
"authors": [
|
194 |
-
"R Idro",
|
195 |
-
"R Ogwang",
|
196 |
-
"E Kayongo",
|
197 |
-
"N Gumisiriza",
|
198 |
-
"..."
|
199 |
-
],
|
200 |
-
"doi": "10.1684/epd.2018.1012",
|
201 |
-
"year": null,
|
202 |
-
"item_type": "journalArticle",
|
203 |
-
"url": "https://onlinelibrary.wiley.com/doi/abs/10.1684/epd.2018.1012"
|
204 |
-
},
|
205 |
-
{
|
206 |
-
"key": "TQQ2BYRK",
|
207 |
-
"title": "Paper 1: Demand-driven rapid reviews for health policy and systems decision-making: lessons from Lebanon, Ethiopia, and South Africa on researchers and \u2026",
|
208 |
-
"abstract": "Rapid reviews have emerged as an approach to provide contextualized evidence in a timely and efficient manner. Three rapid review centers were established in Ethiopia, Lebanon \u2026",
|
209 |
-
"full_text": "",
|
210 |
-
"authors": [
|
211 |
-
"RM Mijumbi-Deve",
|
212 |
-
"I Kawooya",
|
213 |
-
"E Kayongo",
|
214 |
-
"R Izizinga",
|
215 |
-
"..."
|
216 |
-
],
|
217 |
-
"doi": "10.1186/s13643-022-02021-3",
|
218 |
-
"year": null,
|
219 |
-
"item_type": "journalArticle",
|
220 |
-
"url": "https://link.springer.com/article/10.1186/s13643-022-02021-3"
|
221 |
-
}
|
222 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface.py
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
"""
|
2 |
-
Gradio interface module for ACRES RAG Platform.
|
3 |
-
Defines the UI components and layout.
|
4 |
-
"""
|
5 |
-
|
6 |
-
# interface.py
|
7 |
-
import gradio as gr
|
8 |
-
|
9 |
-
|
10 |
-
def create_chat_interface() -> gr.Blocks:
|
11 |
-
"""Create the chat interface component."""
|
12 |
-
with gr.Blocks() as chat_interface:
|
13 |
-
with gr.Row():
|
14 |
-
with gr.Column(scale=7):
|
15 |
-
chat_history = gr.Chatbot(
|
16 |
-
value=[], elem_id="chatbot", height=600, show_label=False
|
17 |
-
)
|
18 |
-
with gr.Column(scale=3):
|
19 |
-
pdf_preview = gr.Image(label="Source Page", height=600)
|
20 |
-
|
21 |
-
with gr.Row():
|
22 |
-
with gr.Column(scale=8):
|
23 |
-
query_input = gr.Textbox(
|
24 |
-
show_label=False,
|
25 |
-
placeholder="Ask a question about your documents...",
|
26 |
-
container=False,
|
27 |
-
)
|
28 |
-
with gr.Column(scale=2):
|
29 |
-
submit_btn = gr.Button("Send", variant="primary")
|
30 |
-
|
31 |
-
with gr.Row():
|
32 |
-
pdf_files = gr.File(
|
33 |
-
file_count="multiple", file_types=[".pdf"], label="Upload PDF Files"
|
34 |
-
)
|
35 |
-
collection_name = gr.Textbox(
|
36 |
-
label="Collection Name", placeholder="Name this collection of PDFs..."
|
37 |
-
)
|
38 |
-
|
39 |
-
return (
|
40 |
-
chat_interface,
|
41 |
-
chat_history,
|
42 |
-
pdf_preview,
|
43 |
-
query_input,
|
44 |
-
submit_btn,
|
45 |
-
pdf_files,
|
46 |
-
collection_name,
|
47 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rag/rag_pipeline.py
CHANGED
@@ -1,159 +1,70 @@
|
|
1 |
-
# rag/rag_pipeline.py
|
2 |
import json
|
3 |
-
import
|
4 |
-
from typing import Dict, Any, List
|
5 |
-
|
6 |
from llama_index.core import Document, VectorStoreIndex
|
7 |
from llama_index.core.node_parser import SentenceWindowNodeParser, SentenceSplitter
|
8 |
from llama_index.core import PromptTemplate
|
|
|
9 |
from llama_index.embeddings.openai import OpenAIEmbedding
|
10 |
from llama_index.llms.openai import OpenAI
|
11 |
-
from llama_index.vector_stores.chroma import ChromaVectorStore
|
12 |
-
import chromadb
|
13 |
-
from typing import Dict, Any, List, Tuple, Optional
|
14 |
-
import re
|
15 |
-
import logging
|
16 |
-
|
17 |
-
|
18 |
-
logging.basicConfig(level=logging.INFO)
|
19 |
-
logger = logging.getLogger(__name__)
|
20 |
|
21 |
|
22 |
class RAGPipeline:
|
23 |
-
def __init__(
|
24 |
-
self,
|
25 |
-
study_json,
|
26 |
-
collection_name="study_files_rag_collection",
|
27 |
-
use_semantic_splitter=False,
|
28 |
-
):
|
29 |
self.study_json = study_json
|
30 |
-
self.collection_name = collection_name
|
31 |
self.use_semantic_splitter = use_semantic_splitter
|
32 |
self.documents = None
|
33 |
-
self.
|
34 |
-
self.collection = self.client.get_or_create_collection(self.collection_name)
|
35 |
-
self.embedding_model = OpenAIEmbedding(model_name="text-embedding-ada-002")
|
36 |
-
self.is_pdf = self._check_if_pdf_collection()
|
37 |
self.load_documents()
|
38 |
self.build_index()
|
39 |
|
40 |
-
def _check_if_pdf_collection(self) -> bool:
|
41 |
-
"""Check if this is a PDF collection based on the JSON structure."""
|
42 |
-
try:
|
43 |
-
with open(self.study_json, "r") as f:
|
44 |
-
data = json.load(f)
|
45 |
-
# Check first document for PDF-specific fields
|
46 |
-
if data and isinstance(data, list) and len(data) > 0:
|
47 |
-
return "pages" in data[0] and "source_file" in data[0]
|
48 |
-
return False
|
49 |
-
except Exception as e:
|
50 |
-
logger.error(f"Error checking collection type: {str(e)}")
|
51 |
-
return False
|
52 |
-
|
53 |
-
def extract_page_number_from_query(self, query: str) -> int:
|
54 |
-
"""Extract page number from query text."""
|
55 |
-
# Look for patterns like "page 3", "p3", "p. 3", etc.
|
56 |
-
patterns = [
|
57 |
-
r"page\s*(\d+)",
|
58 |
-
r"p\.\s*(\d+)",
|
59 |
-
r"p\s*(\d+)",
|
60 |
-
r"pg\.\s*(\d+)",
|
61 |
-
r"pg\s*(\d+)",
|
62 |
-
]
|
63 |
-
|
64 |
-
for pattern in patterns:
|
65 |
-
match = re.search(pattern, query.lower())
|
66 |
-
if match:
|
67 |
-
return int(match.group(1))
|
68 |
-
return None
|
69 |
-
|
70 |
def load_documents(self):
|
71 |
if self.documents is None:
|
72 |
with open(self.study_json, "r") as f:
|
73 |
self.data = json.load(f)
|
74 |
|
75 |
self.documents = []
|
76 |
-
if self.is_pdf:
|
77 |
-
# Handle PDF documents
|
78 |
-
for index, doc_data in enumerate(self.data):
|
79 |
-
pages = doc_data.get("pages", {})
|
80 |
-
for page_num, page_content in pages.items():
|
81 |
-
if isinstance(page_content, dict):
|
82 |
-
content = page_content.get("text", "")
|
83 |
-
else:
|
84 |
-
content = page_content
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
"title": doc_data.get("title"),
|
94 |
-
"authors": ", ".join(doc_data.get("authors", [])),
|
95 |
-
"year": doc_data.get("date"),
|
96 |
-
"source_file": doc_data.get("source_file"),
|
97 |
-
"page_number": int(page_num),
|
98 |
-
"total_pages": doc_data.get("page_count"),
|
99 |
-
}
|
100 |
-
|
101 |
-
self.documents.append(
|
102 |
-
Document(
|
103 |
-
text=doc_content,
|
104 |
-
id_=f"doc_{index}_page_{page_num}",
|
105 |
-
metadata=metadata,
|
106 |
-
)
|
107 |
-
)
|
108 |
-
else:
|
109 |
-
# Handle Zotero documents
|
110 |
-
for index, doc_data in enumerate(self.data):
|
111 |
-
doc_content = (
|
112 |
-
f"Title: {doc_data.get('title', '')}\n"
|
113 |
-
f"Abstract: {doc_data.get('abstract', '')}\n"
|
114 |
-
f"Authors: {', '.join(doc_data.get('authors', []))}\n"
|
115 |
-
)
|
116 |
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
)
|
128 |
-
)
|
129 |
|
130 |
def build_index(self):
|
131 |
-
|
|
|
132 |
|
133 |
-
|
134 |
-
|
135 |
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
# Parse documents into nodes for embedding
|
144 |
-
nodes = node_parser.get_nodes_from_documents(self.documents)
|
145 |
-
|
146 |
-
# Initialize ChromaVectorStore with the existing collection
|
147 |
-
vector_store = ChromaVectorStore(chroma_collection=self.collection)
|
148 |
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
|
154 |
def query(
|
155 |
self, context: str, prompt_template: PromptTemplate = None
|
156 |
-
) ->
|
157 |
if prompt_template is None:
|
158 |
prompt_template = PromptTemplate(
|
159 |
"Context information is below.\n"
|
@@ -161,48 +72,22 @@ class RAGPipeline:
|
|
161 |
"{context_str}\n"
|
162 |
"---------------------\n"
|
163 |
"Given this information, please answer the question: {query_str}\n"
|
164 |
-
"Provide
|
165 |
-
"If the question asks about specific page content, make sure to include that information. "
|
166 |
"Cite sources using square brackets for EVERY piece of information, e.g. [1], [2], etc. "
|
167 |
-
"
|
|
|
|
|
168 |
)
|
169 |
|
170 |
-
# Extract page number for PDF documents
|
171 |
-
requested_page = (
|
172 |
-
self.extract_page_number_from_query(context) if self.is_pdf else None
|
173 |
-
)
|
174 |
-
|
175 |
-
|
176 |
# This is a hack to index all the documents in the store :)
|
177 |
n_documents = len(self.index.docstore.docs)
|
178 |
-
print(f"n_documents: {n_documents}")
|
179 |
query_engine = self.index.as_query_engine(
|
180 |
text_qa_template=prompt_template,
|
181 |
-
similarity_top_k=n_documents
|
182 |
response_mode="tree_summarize",
|
183 |
llm=OpenAI(model="gpt-4o-mini"),
|
184 |
)
|
185 |
|
186 |
response = query_engine.query(context)
|
187 |
|
188 |
-
|
189 |
-
source_info = None
|
190 |
-
if hasattr(response, "source_nodes") and response.source_nodes:
|
191 |
-
source_node = response.source_nodes[0]
|
192 |
-
metadata = source_node.metadata
|
193 |
-
|
194 |
-
if self.is_pdf:
|
195 |
-
page_number = (
|
196 |
-
requested_page
|
197 |
-
if requested_page is not None
|
198 |
-
else metadata.get("page_number", 0)
|
199 |
-
)
|
200 |
-
source_info = {
|
201 |
-
"source_file": metadata.get("source_file"),
|
202 |
-
"page_number": page_number,
|
203 |
-
"title": metadata.get("title"),
|
204 |
-
"authors": metadata.get("authors"),
|
205 |
-
"content": source_node.text,
|
206 |
-
}
|
207 |
-
|
208 |
-
return response.response, source_info
|
|
|
|
|
1 |
import json
|
2 |
+
from typing import Dict, Any
|
|
|
|
|
3 |
from llama_index.core import Document, VectorStoreIndex
|
4 |
from llama_index.core.node_parser import SentenceWindowNodeParser, SentenceSplitter
|
5 |
from llama_index.core import PromptTemplate
|
6 |
+
from typing import List
|
7 |
from llama_index.embeddings.openai import OpenAIEmbedding
|
8 |
from llama_index.llms.openai import OpenAI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
|
11 |
class RAGPipeline:
|
12 |
+
def __init__(self, study_json, use_semantic_splitter=False):
|
|
|
|
|
|
|
|
|
|
|
13 |
self.study_json = study_json
|
|
|
14 |
self.use_semantic_splitter = use_semantic_splitter
|
15 |
self.documents = None
|
16 |
+
self.index = None
|
|
|
|
|
|
|
17 |
self.load_documents()
|
18 |
self.build_index()
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
def load_documents(self):
|
21 |
if self.documents is None:
|
22 |
with open(self.study_json, "r") as f:
|
23 |
self.data = json.load(f)
|
24 |
|
25 |
self.documents = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
+
for index, doc_data in enumerate(self.data):
|
28 |
+
doc_content = (
|
29 |
+
f"Title: {doc_data['title']}\n"
|
30 |
+
f"Abstract: {doc_data['abstract']}\n"
|
31 |
+
f"Authors: {', '.join(doc_data['authors'])}\n"
|
32 |
+
# f"full_text: {doc_data['full_text']}"
|
33 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
+
metadata = {
|
36 |
+
"title": doc_data.get("title"),
|
37 |
+
"authors": doc_data.get("authors", []),
|
38 |
+
"year": doc_data.get("date"),
|
39 |
+
"doi": doc_data.get("doi"),
|
40 |
+
}
|
41 |
|
42 |
+
self.documents.append(
|
43 |
+
Document(text=doc_content, id_=f"doc_{index}", metadata=metadata)
|
44 |
+
)
|
|
|
|
|
45 |
|
46 |
def build_index(self):
|
47 |
+
if self.index is None:
|
48 |
+
sentence_splitter = SentenceSplitter(chunk_size=2048, chunk_overlap=20)
|
49 |
|
50 |
+
def _split(text: str) -> List[str]:
|
51 |
+
return sentence_splitter.split_text(text)
|
52 |
|
53 |
+
node_parser = SentenceWindowNodeParser.from_defaults(
|
54 |
+
sentence_splitter=_split,
|
55 |
+
window_size=5,
|
56 |
+
window_metadata_key="window",
|
57 |
+
original_text_metadata_key="original_text",
|
58 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
+
nodes = node_parser.get_nodes_from_documents(self.documents)
|
61 |
+
self.index = VectorStoreIndex(
|
62 |
+
nodes, embed_model=OpenAIEmbedding(model_name="text-embedding-3-large")
|
63 |
+
)
|
64 |
|
65 |
def query(
|
66 |
self, context: str, prompt_template: PromptTemplate = None
|
67 |
+
) -> Dict[str, Any]:
|
68 |
if prompt_template is None:
|
69 |
prompt_template = PromptTemplate(
|
70 |
"Context information is below.\n"
|
|
|
72 |
"{context_str}\n"
|
73 |
"---------------------\n"
|
74 |
"Given this information, please answer the question: {query_str}\n"
|
75 |
+
"Provide an answer to the question using evidence from the context above. "
|
|
|
76 |
"Cite sources using square brackets for EVERY piece of information, e.g. [1], [2], etc. "
|
77 |
+
"Even if there's only one source, still include the citation. "
|
78 |
+
"If you're unsure about a source, use [?]. "
|
79 |
+
"Ensure that EVERY statement from the context is properly cited."
|
80 |
)
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
# This is a hack to index all the documents in the store :)
|
83 |
n_documents = len(self.index.docstore.docs)
|
|
|
84 |
query_engine = self.index.as_query_engine(
|
85 |
text_qa_template=prompt_template,
|
86 |
+
similarity_top_k=n_documents,
|
87 |
response_mode="tree_summarize",
|
88 |
llm=OpenAI(model="gpt-4o-mini"),
|
89 |
)
|
90 |
|
91 |
response = query_engine.query(context)
|
92 |
|
93 |
+
return response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rag/rag_pipeline_backup.py
DELETED
@@ -1,94 +0,0 @@
|
|
1 |
-
import json
|
2 |
-
from typing import Dict, Any
|
3 |
-
from llama_index.core import Document, VectorStoreIndex
|
4 |
-
from llama_index.core.node_parser import SentenceWindowNodeParser, SentenceSplitter
|
5 |
-
from llama_index.core import PromptTemplate
|
6 |
-
from typing import List
|
7 |
-
from llama_index.embeddings.openai import OpenAIEmbedding
|
8 |
-
from llama_index.llms.openai import OpenAI
|
9 |
-
|
10 |
-
|
11 |
-
class RAGPipeline:
|
12 |
-
def __init__(self, study_json, use_semantic_splitter=False):
|
13 |
-
self.study_json = study_json
|
14 |
-
self.use_semantic_splitter = use_semantic_splitter
|
15 |
-
self.documents = None
|
16 |
-
self.index = None
|
17 |
-
self.load_documents()
|
18 |
-
self.build_index()
|
19 |
-
|
20 |
-
def load_documents(self):
|
21 |
-
if self.documents is None:
|
22 |
-
with open(self.study_json, "r") as f:
|
23 |
-
self.data = json.load(f)
|
24 |
-
|
25 |
-
self.documents = []
|
26 |
-
|
27 |
-
for index, doc_data in enumerate(self.data):
|
28 |
-
doc_content = (
|
29 |
-
f"Title: {doc_data['title']}\n"
|
30 |
-
f"Abstract: {doc_data['abstract']}\n"
|
31 |
-
f"Authors: {', '.join(doc_data['authors'])}\n"
|
32 |
-
# f"full_text: {doc_data['full_text']}"
|
33 |
-
)
|
34 |
-
|
35 |
-
metadata = {
|
36 |
-
"title": doc_data.get("title"),
|
37 |
-
"authors": doc_data.get("authors", []),
|
38 |
-
"year": doc_data.get("date"),
|
39 |
-
"doi": doc_data.get("doi"),
|
40 |
-
}
|
41 |
-
|
42 |
-
self.documents.append(
|
43 |
-
Document(text=doc_content, id_=f"doc_{index}", metadata=metadata)
|
44 |
-
)
|
45 |
-
|
46 |
-
def build_index(self):
|
47 |
-
if self.index is None:
|
48 |
-
sentence_splitter = SentenceSplitter(chunk_size=2048, chunk_overlap=20)
|
49 |
-
|
50 |
-
def _split(text: str) -> List[str]:
|
51 |
-
return sentence_splitter.split_text(text)
|
52 |
-
|
53 |
-
node_parser = SentenceWindowNodeParser.from_defaults(
|
54 |
-
sentence_splitter=_split,
|
55 |
-
window_size=5,
|
56 |
-
window_metadata_key="window",
|
57 |
-
original_text_metadata_key="original_text",
|
58 |
-
)
|
59 |
-
|
60 |
-
nodes = node_parser.get_nodes_from_documents(self.documents)
|
61 |
-
self.index = VectorStoreIndex(
|
62 |
-
nodes, embed_model=OpenAIEmbedding(model_name="text-embedding-3-large")
|
63 |
-
)
|
64 |
-
|
65 |
-
def query(
|
66 |
-
self, context: str, prompt_template: PromptTemplate = None
|
67 |
-
) -> Dict[str, Any]:
|
68 |
-
if prompt_template is None:
|
69 |
-
prompt_template = PromptTemplate(
|
70 |
-
"Context information is below.\n"
|
71 |
-
"---------------------\n"
|
72 |
-
"{context_str}\n"
|
73 |
-
"---------------------\n"
|
74 |
-
"Given this information, please answer the question: {query_str}\n"
|
75 |
-
"Provide an answer to the question using evidence from the context above. "
|
76 |
-
"Cite sources using square brackets for EVERY piece of information, e.g. [1], [2], etc. "
|
77 |
-
"Even if there's only one source, still include the citation. "
|
78 |
-
"If you're unsure about a source, use [?]. "
|
79 |
-
"Ensure that EVERY statement from the context is properly cited."
|
80 |
-
)
|
81 |
-
|
82 |
-
# This is a hack to index all the documents in the store :)
|
83 |
-
n_documents = len(self.index.docstore.docs)
|
84 |
-
print(f"n_documents: {n_documents}")
|
85 |
-
query_engine = self.index.as_query_engine(
|
86 |
-
text_qa_template=prompt_template,
|
87 |
-
similarity_top_k=n_documents if n_documents <= 17 else 15,
|
88 |
-
response_mode="tree_summarize",
|
89 |
-
llm=OpenAI(model="gpt-4o-mini"),
|
90 |
-
)
|
91 |
-
|
92 |
-
response = query_engine.query(context)
|
93 |
-
|
94 |
-
return response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
@@ -2,13 +2,10 @@ chromadb==0.5.5
|
|
2 |
fastapi==0.112.2
|
3 |
gradio
|
4 |
llama-index
|
5 |
-
llama-index-vector-stores-chroma
|
6 |
nest-asyncio==1.6.0
|
7 |
openai
|
8 |
pandas
|
9 |
pydantic
|
10 |
python-dotenv
|
11 |
pyzotero
|
12 |
-
python-slugify
|
13 |
-
PyMuPDF==1.23.8
|
14 |
-
Pillow==10.2.0
|
|
|
2 |
fastapi==0.112.2
|
3 |
gradio
|
4 |
llama-index
|
|
|
5 |
nest-asyncio==1.6.0
|
6 |
openai
|
7 |
pandas
|
8 |
pydantic
|
9 |
python-dotenv
|
10 |
pyzotero
|
11 |
+
python-slugify
|
|
|
|
study_files.json
CHANGED
@@ -2,7 +2,5 @@
|
|
2 |
"Vaccine coverage": "data/vaccine_coverage_zotero_items.json",
|
3 |
"Ebola Virus": "data/ebola_virus_zotero_items.json",
|
4 |
"GeneXpert": "data/gene_xpert_zotero_items.json",
|
5 |
-
"Zotero Collection Pastan": "data/zotero-collection-pastan_zotero_items.json"
|
6 |
-
"EBSCOhost": "data/ebscohost_zotero_items.json",
|
7 |
-
"ExportedRis_file_1_of_1 (1)": "data/exportedris-file-1-of-1-1_zotero_items.json"
|
8 |
}
|
|
|
2 |
"Vaccine coverage": "data/vaccine_coverage_zotero_items.json",
|
3 |
"Ebola Virus": "data/ebola_virus_zotero_items.json",
|
4 |
"GeneXpert": "data/gene_xpert_zotero_items.json",
|
5 |
+
"Zotero Collection Pastan": "data/zotero-collection-pastan_zotero_items.json"
|
|
|
|
|
6 |
}
|
study_files_backup.json
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"Vaccine coverage": "data/vaccine_coverage_zotero_items.json",
|
3 |
-
"Ebola Virus": "data/ebola_virus_zotero_items.json",
|
4 |
-
"GeneXpert": "data/gene_xpert_zotero_items.json",
|
5 |
-
"Zotero Collection Pastan": "data/zotero-collection-pastan_zotero_items.json",
|
6 |
-
"EBSCOhost": "data/ebscohost_zotero_items.json",
|
7 |
-
"ref BMGF": "data/ref-bmgf_zotero_items.json",
|
8 |
-
"scholar (29)": "data/scholar-29_zotero_items.json",
|
9 |
-
"iom": "data/iom_zotero_items.json",
|
10 |
-
"ExportedRis_file_1_of_1 (1)": "data/exportedris-file-1-of-1-1_zotero_items.json",
|
11 |
-
"wb_1813-9450-6689": "data/wb-1813-9450-6689_zotero_items.json",
|
12 |
-
"kayongo papers": "data/kayongo-papers_zotero_items.json"
|
13 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
utils/helpers.py
CHANGED
@@ -1,5 +1,3 @@
|
|
1 |
-
# utils/helpers.py
|
2 |
-
|
3 |
from typing import Dict, Any
|
4 |
from llama_index.core import Response
|
5 |
from typing import List
|
@@ -10,13 +8,6 @@ from utils.prompts import (
|
|
10 |
StudyCharacteristics,
|
11 |
)
|
12 |
import json
|
13 |
-
import json
|
14 |
-
import chromadb
|
15 |
-
from chromadb.api.types import Document
|
16 |
-
|
17 |
-
# Initialize ChromaDB client
|
18 |
-
chromadb_client = chromadb.Client()
|
19 |
-
|
20 |
|
21 |
def read_study_files(file_path):
|
22 |
"""
|
@@ -31,7 +22,7 @@ def read_study_files(file_path):
|
|
31 |
Raises:
|
32 |
FileNotFoundError: If the file is not found at the provided path.
|
33 |
json.JSONDecodeError: If the file contents are not valid JSON.
|
34 |
-
|
35 |
Example:
|
36 |
Given a JSON file 'study_files.json' with content like:
|
37 |
{
|
@@ -48,15 +39,13 @@ def read_study_files(file_path):
|
|
48 |
}
|
49 |
"""
|
50 |
try:
|
51 |
-
with open(file_path,
|
52 |
data = json.load(file)
|
53 |
return data
|
54 |
except FileNotFoundError as e:
|
55 |
raise FileNotFoundError(f"The file at path {file_path} was not found.") from e
|
56 |
except json.JSONDecodeError as e:
|
57 |
-
raise ValueError(
|
58 |
-
f"The file at path {file_path} does not contain valid JSON."
|
59 |
-
) from e
|
60 |
|
61 |
|
62 |
def append_to_study_files(file_path, new_key, new_value):
|
@@ -90,22 +79,20 @@ def append_to_study_files(file_path, new_key, new_value):
|
|
90 |
"""
|
91 |
try:
|
92 |
# Read the existing data from the file
|
93 |
-
with open(file_path,
|
94 |
data = json.load(file)
|
95 |
-
|
96 |
# Append the new key-value pair to the dictionary
|
97 |
data[new_key] = new_value
|
98 |
|
99 |
# Write the updated data back to the file
|
100 |
-
with open(file_path,
|
101 |
json.dump(data, file, indent=4) # indent for pretty printing
|
102 |
|
103 |
except FileNotFoundError as e:
|
104 |
raise FileNotFoundError(f"The file at path {file_path} was not found.") from e
|
105 |
except json.JSONDecodeError as e:
|
106 |
-
raise ValueError(
|
107 |
-
f"The file at path {file_path} does not contain valid JSON."
|
108 |
-
) from e
|
109 |
except IOError as e:
|
110 |
raise IOError(f"Failed to write to the file at {file_path}.") from e
|
111 |
|
@@ -178,43 +165,3 @@ def generate_follow_up_questions(
|
|
178 |
if cleaned_q:
|
179 |
cleaned_questions.append(f"✨ {cleaned_q}")
|
180 |
return cleaned_questions[:3]
|
181 |
-
|
182 |
-
|
183 |
-
def add_study_files_to_chromadb(file_path: str, collection_name: str):
|
184 |
-
"""
|
185 |
-
Reads the study files data from a JSON file and adds it to the specified ChromaDB collection.
|
186 |
-
|
187 |
-
:param file_path: Path to the JSON file containing study files data.
|
188 |
-
:param collection_name: Name of the ChromaDB collection to store the data.
|
189 |
-
"""
|
190 |
-
# Load study files data from JSON file
|
191 |
-
try:
|
192 |
-
with open(file_path, "r") as f:
|
193 |
-
study_files_data = json.load(f)
|
194 |
-
except FileNotFoundError:
|
195 |
-
print(f"File '{file_path}' not found.")
|
196 |
-
return
|
197 |
-
|
198 |
-
# Get or create the collection in ChromaDB
|
199 |
-
collection = chromadb_client.get_or_create_collection(collection_name)
|
200 |
-
|
201 |
-
# Prepare lists for ids, texts, and metadata to batch insert
|
202 |
-
ids = []
|
203 |
-
documents = []
|
204 |
-
metadatas = []
|
205 |
-
|
206 |
-
# Populate lists with data from the JSON file
|
207 |
-
for name, file_path in study_files_data.items():
|
208 |
-
ids.append(name) # Document ID
|
209 |
-
documents.append("") # Optional text, can be left empty if not used
|
210 |
-
metadatas.append({"file_path": file_path}) # Metadata with file path
|
211 |
-
|
212 |
-
# Add documents to the collection in batch
|
213 |
-
collection.add(ids=ids, documents=documents, metadatas=metadatas)
|
214 |
-
|
215 |
-
print("All study files have been successfully added to ChromaDB.")
|
216 |
-
|
217 |
-
|
218 |
-
if __name__ == "__main__":
|
219 |
-
# Usage example
|
220 |
-
add_study_files_to_chromadb("study_files.json", "study_files_collection")
|
|
|
|
|
|
|
1 |
from typing import Dict, Any
|
2 |
from llama_index.core import Response
|
3 |
from typing import List
|
|
|
8 |
StudyCharacteristics,
|
9 |
)
|
10 |
import json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
def read_study_files(file_path):
|
13 |
"""
|
|
|
22 |
Raises:
|
23 |
FileNotFoundError: If the file is not found at the provided path.
|
24 |
json.JSONDecodeError: If the file contents are not valid JSON.
|
25 |
+
|
26 |
Example:
|
27 |
Given a JSON file 'study_files.json' with content like:
|
28 |
{
|
|
|
39 |
}
|
40 |
"""
|
41 |
try:
|
42 |
+
with open(file_path, 'r') as file:
|
43 |
data = json.load(file)
|
44 |
return data
|
45 |
except FileNotFoundError as e:
|
46 |
raise FileNotFoundError(f"The file at path {file_path} was not found.") from e
|
47 |
except json.JSONDecodeError as e:
|
48 |
+
raise ValueError(f"The file at path {file_path} does not contain valid JSON.") from e
|
|
|
|
|
49 |
|
50 |
|
51 |
def append_to_study_files(file_path, new_key, new_value):
|
|
|
79 |
"""
|
80 |
try:
|
81 |
# Read the existing data from the file
|
82 |
+
with open(file_path, 'r') as file:
|
83 |
data = json.load(file)
|
84 |
+
|
85 |
# Append the new key-value pair to the dictionary
|
86 |
data[new_key] = new_value
|
87 |
|
88 |
# Write the updated data back to the file
|
89 |
+
with open(file_path, 'w') as file:
|
90 |
json.dump(data, file, indent=4) # indent for pretty printing
|
91 |
|
92 |
except FileNotFoundError as e:
|
93 |
raise FileNotFoundError(f"The file at path {file_path} was not found.") from e
|
94 |
except json.JSONDecodeError as e:
|
95 |
+
raise ValueError(f"The file at path {file_path} does not contain valid JSON.") from e
|
|
|
|
|
96 |
except IOError as e:
|
97 |
raise IOError(f"Failed to write to the file at {file_path}.") from e
|
98 |
|
|
|
165 |
if cleaned_q:
|
166 |
cleaned_questions.append(f"✨ {cleaned_q}")
|
167 |
return cleaned_questions[:3]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
utils/pdf_processor.py
DELETED
@@ -1,193 +0,0 @@
|
|
1 |
-
"""
|
2 |
-
PDF processing module for ACRES RAG Platform.
|
3 |
-
Handles PDF file processing, text extraction, and page rendering.
|
4 |
-
"""
|
5 |
-
|
6 |
-
# utils/pdf_processor.py
|
7 |
-
import os
|
8 |
-
import fitz
|
9 |
-
import logging
|
10 |
-
from typing import Dict, List, Optional
|
11 |
-
import datetime
|
12 |
-
from slugify import slugify
|
13 |
-
import json
|
14 |
-
from PIL import Image
|
15 |
-
import re
|
16 |
-
|
17 |
-
|
18 |
-
logger = logging.getLogger(__name__)
|
19 |
-
|
20 |
-
|
21 |
-
class PDFProcessor:
|
22 |
-
def __init__(self, upload_dir: str = "data/uploads"):
|
23 |
-
"""Initialize PDFProcessor with upload directory."""
|
24 |
-
self.upload_dir = upload_dir
|
25 |
-
os.makedirs(upload_dir, exist_ok=True)
|
26 |
-
self.current_page = 0
|
27 |
-
|
28 |
-
def render_page(self, file_path: str, page_num: int) -> Optional[Image.Image]:
|
29 |
-
"""Render a specific page from a PDF as an image."""
|
30 |
-
try:
|
31 |
-
logger.info(f"Attempting to render page {page_num} from {file_path}")
|
32 |
-
doc = fitz.open(file_path)
|
33 |
-
|
34 |
-
# Ensure page number is valid
|
35 |
-
if page_num < 0 or page_num >= len(doc):
|
36 |
-
logger.error(
|
37 |
-
f"Invalid page number {page_num} for document with {len(doc)} pages"
|
38 |
-
)
|
39 |
-
return None
|
40 |
-
|
41 |
-
page = doc[page_num]
|
42 |
-
# Increase resolution for better quality
|
43 |
-
pix = page.get_pixmap(matrix=fitz.Matrix(300 / 72, 300 / 72))
|
44 |
-
image = Image.frombytes("RGB", [pix.width, pix.height], pix.samples)
|
45 |
-
doc.close()
|
46 |
-
logger.info(f"Successfully rendered page {page_num}")
|
47 |
-
return image
|
48 |
-
except Exception as e:
|
49 |
-
logger.error(f"Error rendering page {page_num} from {file_path}: {str(e)}")
|
50 |
-
return None
|
51 |
-
|
52 |
-
def is_references_page(self, text: str) -> bool:
|
53 |
-
"""
|
54 |
-
Check if the page appears to be a references/bibliography page.
|
55 |
-
"""
|
56 |
-
# Common section headers for references
|
57 |
-
ref_headers = [
|
58 |
-
r"^references\s*$",
|
59 |
-
r"^bibliography\s*$",
|
60 |
-
r"^works cited\s*$",
|
61 |
-
r"^citations\s*$",
|
62 |
-
r"^cited literature\s*$",
|
63 |
-
]
|
64 |
-
|
65 |
-
# Check first few lines of the page
|
66 |
-
first_lines = text.lower().split("\n")[:3]
|
67 |
-
first_block = " ".join(first_lines)
|
68 |
-
|
69 |
-
# Check for reference headers
|
70 |
-
for header in ref_headers:
|
71 |
-
if re.search(header, first_block, re.IGNORECASE):
|
72 |
-
return True
|
73 |
-
|
74 |
-
# Check for reference-like patterns (e.g., [1] Author, et al.)
|
75 |
-
ref_patterns = [
|
76 |
-
r"^\[\d+\]", # [1] style
|
77 |
-
r"^\d+\.", # 1. style
|
78 |
-
r"^[A-Z][a-z]+,\s+[A-Z]\.", # Author, I. style
|
79 |
-
]
|
80 |
-
|
81 |
-
ref_pattern_count = 0
|
82 |
-
lines = text.split("\n")[:10] # Check first 10 lines
|
83 |
-
for line in lines:
|
84 |
-
line = line.strip()
|
85 |
-
if any(re.match(pattern, line) for pattern in ref_patterns):
|
86 |
-
ref_pattern_count += 1
|
87 |
-
|
88 |
-
# If multiple reference-like patterns are found, likely a references page
|
89 |
-
return ref_pattern_count >= 3
|
90 |
-
|
91 |
-
def detect_references_start(self, doc: fitz.Document) -> Optional[int]:
|
92 |
-
"""
|
93 |
-
Detect the page where references section starts.
|
94 |
-
Returns the page number or None if not found.
|
95 |
-
"""
|
96 |
-
for page_num in range(len(doc)):
|
97 |
-
page = doc[page_num]
|
98 |
-
text = page.get_text()
|
99 |
-
if self.is_references_page(text):
|
100 |
-
logger.info(f"Detected references section starting at page {page_num}")
|
101 |
-
return page_num
|
102 |
-
return None
|
103 |
-
|
104 |
-
def process_pdfs(self, file_paths: List[str], collection_name: str) -> str:
|
105 |
-
"""Process multiple PDF files and store their content."""
|
106 |
-
processed_docs = []
|
107 |
-
|
108 |
-
for file_path in file_paths:
|
109 |
-
try:
|
110 |
-
doc_data = self.extract_text_from_pdf(file_path)
|
111 |
-
processed_docs.append(doc_data)
|
112 |
-
logger.info(
|
113 |
-
f"Successfully processed {file_path} ({doc_data['content_pages']} content pages)"
|
114 |
-
)
|
115 |
-
except Exception as e:
|
116 |
-
logger.error(f"Error processing {file_path}: {str(e)}")
|
117 |
-
continue
|
118 |
-
|
119 |
-
if not processed_docs:
|
120 |
-
raise ValueError("No documents were successfully processed")
|
121 |
-
|
122 |
-
# Save to JSON file
|
123 |
-
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
124 |
-
output_filename = f"{slugify(collection_name)}_{timestamp}_documents.json"
|
125 |
-
output_path = os.path.join("data", output_filename)
|
126 |
-
|
127 |
-
# Ensure the data directory exists
|
128 |
-
os.makedirs("data", exist_ok=True)
|
129 |
-
|
130 |
-
with open(output_path, "w", encoding="utf-8") as f:
|
131 |
-
json.dump(processed_docs, f, indent=2, ensure_ascii=False)
|
132 |
-
|
133 |
-
logger.info(f"Saved processed documents to {output_path}")
|
134 |
-
return output_path
|
135 |
-
|
136 |
-
def extract_text_from_pdf(self, file_path: str) -> Dict:
|
137 |
-
"""Extract text and metadata from a PDF file."""
|
138 |
-
try:
|
139 |
-
doc = fitz.open(file_path)
|
140 |
-
|
141 |
-
# Find references section start
|
142 |
-
refs_start = self.detect_references_start(doc)
|
143 |
-
|
144 |
-
# Extract text from all pages with page tracking
|
145 |
-
text = ""
|
146 |
-
pages = {}
|
147 |
-
for page_num in range(len(doc)):
|
148 |
-
# Skip if this is after references section starts
|
149 |
-
if refs_start is not None and page_num >= refs_start:
|
150 |
-
logger.info(
|
151 |
-
f"Skipping page {page_num} as it appears to be part of references"
|
152 |
-
)
|
153 |
-
continue
|
154 |
-
|
155 |
-
page_text = doc[page_num].get_text()
|
156 |
-
|
157 |
-
# Extra check to catch references if they weren't caught by the initial scan
|
158 |
-
if page_num > 0 and self.is_references_page(page_text):
|
159 |
-
logger.info(
|
160 |
-
f"Detected references content on page {page_num}, skipping"
|
161 |
-
)
|
162 |
-
continue
|
163 |
-
|
164 |
-
pages[str(page_num)] = page_text
|
165 |
-
text += page_text + "\n"
|
166 |
-
|
167 |
-
# Extract metadata
|
168 |
-
metadata = doc.metadata
|
169 |
-
if not metadata.get("title"):
|
170 |
-
metadata["title"] = os.path.basename(file_path)
|
171 |
-
|
172 |
-
# Create structured document
|
173 |
-
document = {
|
174 |
-
"title": metadata.get("title", ""),
|
175 |
-
"authors": (
|
176 |
-
metadata.get("author", "").split(";")
|
177 |
-
if metadata.get("author")
|
178 |
-
else []
|
179 |
-
),
|
180 |
-
"date": metadata.get("creationDate", ""),
|
181 |
-
"abstract": text[:500] + "..." if len(text) > 500 else text,
|
182 |
-
"full_text": text,
|
183 |
-
"source_file": file_path,
|
184 |
-
"pages": pages,
|
185 |
-
"page_count": len(doc),
|
186 |
-
"content_pages": len(pages), # Number of pages excluding references
|
187 |
-
}
|
188 |
-
|
189 |
-
doc.close()
|
190 |
-
return document
|
191 |
-
except Exception as e:
|
192 |
-
logger.error(f"Error processing PDF {file_path}: {str(e)}")
|
193 |
-
raise
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
utils/prompts.py
CHANGED
@@ -1,5 +1,3 @@
|
|
1 |
-
# utils/prompts.py
|
2 |
-
|
3 |
from llama_index.core import PromptTemplate
|
4 |
from typing import Optional, List
|
5 |
from pydantic import BaseModel, Field
|
|
|
|
|
|
|
1 |
from llama_index.core import PromptTemplate
|
2 |
from typing import Optional, List
|
3 |
from pydantic import BaseModel, Field
|
utils/zotero_manager.py
CHANGED
@@ -1,5 +1,3 @@
|
|
1 |
-
# utils/zotero_manager.py
|
2 |
-
|
3 |
import json
|
4 |
import os
|
5 |
from typing import Any, Dict, List, Optional
|
@@ -643,4 +641,4 @@ if __name__ == "__main__":
|
|
643 |
## Save to disc
|
644 |
zotero_manager.write_zotero_items_to_json_file(
|
645 |
ebora_virus_zotero_items_json, "zotero_data/ebora_virus_zotero_items.json"
|
646 |
-
)
|
|
|
|
|
|
|
1 |
import json
|
2 |
import os
|
3 |
from typing import Any, Dict, List, Optional
|
|
|
641 |
## Save to disc
|
642 |
zotero_manager.write_zotero_items_to_json_file(
|
643 |
ebora_virus_zotero_items_json, "zotero_data/ebora_virus_zotero_items.json"
|
644 |
+
)
|