Skip to content

Commit 767a7de

Browse files
disable acled data
1 parent 7b162a3 commit 767a7de

File tree

4 files changed

+62
-38
lines changed

4 files changed

+62
-38
lines changed

backend-python/src/media_impact_monitor/data_loaders/protest/acled/acled.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def get_acled_events(
4949
5050
API documentation: https://acleddata.com/api-documentation/acled-endpoint
5151
"""
52+
raise Exception("ACLED data is currently unavailable.")
5253
assert start_date >= date(2020, 1, 1), "Start date must be after 2020-01-01."
5354
assert verify_dates(start_date, end_date)
5455

frontend-nextjs/src/components/EventsTimeline/EventsTimeline.tsx

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -172,23 +172,37 @@ function EventsTimelineWithData({ reset }: { reset?: () => void }) {
172172
}
173173
export default function EventsTimelineWithErrorBoundary() {
174174
return (
175-
<InViewContainer fallback={<LoadingEventsTimeline />}>
176-
<QueryErrorResetBoundary>
177-
{({ reset }) => (
178-
<ErrorBoundary
179-
errorComponent={({ error }) => (
180-
<ErrorEventsTimeline
181-
{...parseErrorMessage(error)}
182-
reset={reset}
183-
/>
184-
)}
185-
>
186-
<Suspense fallback={<LoadingEventsTimeline />}>
187-
<EventsTimelineWithData reset={reset} />
188-
</Suspense>
189-
</ErrorBoundary>
190-
)}
191-
</QueryErrorResetBoundary>
192-
</InViewContainer>
175+
// <InViewContainer fallback={<LoadingEventsTimeline />}>
176+
// <QueryErrorResetBoundary>
177+
// {({ reset }) => (
178+
// <ErrorBoundary
179+
// errorComponent={({ error }) => (
180+
// <ErrorEventsTimeline
181+
// {...parseErrorMessage(error)}
182+
// reset={reset}
183+
// />
184+
// )}
185+
// >
186+
// <Suspense fallback={<LoadingEventsTimeline />}>
187+
// <EventsTimelineWithData reset={reset} />
188+
// </Suspense>
189+
// </ErrorBoundary>
190+
// )}
191+
// </QueryErrorResetBoundary>
192+
// </InViewContainer>
193+
<EventsTimelineWrapper>
194+
<EventsTimelineChartWrapper>
195+
<div
196+
className={cn(
197+
'w-full h-[var(--protest-timeline-height)]',
198+
'flex flex-col justify-center items-center gap-2',
199+
'bg-grayUltraLight border border-grayLight text-grayDark',
200+
)}
201+
>
202+
<span className="text-lg font-medium">Protest data temporarily unavailable</span>
203+
<span className="text-sm opacity-70">We are working on resolving data source issues.</span>
204+
</div>
205+
</EventsTimelineChartWrapper>
206+
</EventsTimelineWrapper>
193207
)
194208
}

frontend-nextjs/src/utility/textUtil.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,6 @@ const textsEnGB = {
439439
'See protests over time for all selected organisations.',
440440
'Hover or click on the bubbles for more information on individual protest events.',
441441
'Currently, we cover climate protests and Gaza crisis protests in Germany since 2020.',
442-
'⚠️ Protest data is currently unavailable for the last 365 days.'
443442
],
444443
data_credit: [
445444
{

frontend-nextjs/src/utility/useEvents.ts

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,40 @@ export type UseEventsReturnType = Omit<
3131
}
3232

3333
export function useAllEvents() {
34-
const queryClient = useQueryClient()
35-
const { today } = useToday()
36-
const topic = useFiltersStore(({ topic }) => topic)
34+
// const queryClient = useQueryClient()
35+
// const { today } = useToday()
36+
// const topic = useFiltersStore(({ topic }) => topic)
3737

38-
const query = useQuery({
39-
queryKey: ['allEvents', topic],
40-
queryFn: async () => await getEventsData({ topic }, today),
41-
staleTime: getStaleTime(today),
42-
})
43-
const { data, error } = query
38+
// const query = useQuery({
39+
// queryKey: ['allEvents', topic],
40+
// queryFn: async () => await getEventsData({ topic }, today),
41+
// staleTime: getStaleTime(today),
42+
// })
43+
// const { data, error } = query
4444

45-
useQueryErrorToast('protests', error)
45+
// useQueryErrorToast('protests', error)
4646

47-
useEffect(() => {
48-
if (!data || data.length === 0) return
49-
for (const event of data) {
50-
queryClient.setQueryData(['events', event.event_id], event)
51-
}
52-
// eslint-disable-next-line react-hooks/exhaustive-deps
53-
}, [data])
47+
// useEffect(() => {
48+
// if (!data || data.length === 0) return
49+
// for (const event of data) {
50+
// queryClient.setQueryData(['events', event.event_id], event)
51+
// }
52+
// // eslint-disable-next-line react-hooks/exhaustive-deps
53+
// }, [data])
5454

55+
// return {
56+
// ...query,
57+
// allEvents: data ?? [],
58+
// }
59+
// Protest data temporarily disabled
5560
return {
56-
...query,
57-
allEvents: data ?? [],
61+
allEvents: [] as ParsedEventType[],
62+
data: [] as ParsedEventType[],
63+
isLoading: false,
64+
isFetching: false,
65+
isPending: false,
66+
isError: false,
67+
error: null,
5868
}
5969
}
6070

0 commit comments

Comments
 (0)