Week 5 of building a Collaborative Conservation Platform: User Profile and Data Acquisition Update
Photo by Szabo Viktor on Unsplash
Hi everyone,
Welcome back to week 5 of my ongoing project – a collaborative elephant data visualization platform! This week was a productive one, focusing on both user experience improvements and securing the data that will fuel the visualizations. Let's explore what's been happening!
Building the Profile Page
This week, I developed the profile page where the users could manage their information within the platform. In the future, this page will also provide insights into user sightings and notes contributions. Since this data isn't available yet, I focused on implementing the routes for the profile page with just the user information. A GET API route retrieves user profile data which is then displayed in a user-friendly form for editing. A POST API route handles any profile updates, ensuring the displayed information stays current.
Behind the Scenes: Handling APIs and Avoiding a URL Hiccup!
While building the profile page functionality, I encountered an interesting challenge related to fetching data using Next.js API routes within a server component. Initially, I used a relative URL in the fetch request, which resulted in an "invalid url" error. This is because server components don't have access to the client-side document object, which usually helps determine the base URL. To resolve this, I updated the fetch request to include the full URL with the domain name information. This ensures the GET API route is accessed correctly on the server-side. Additionally, I implemented the revalidateTag
function to revalidate the GET request after a profile update, keeping the displayed information fresh on the user's profile page.
Security and Enhancements on the Horizon:
The profile functionality is still under development. Next steps include implementing security measures to prevent unauthorized access to the API by unauthenticated users. Client-side notifications will also be incorporated to inform users about successful form submissions. Finally, the profile page will be enhanced to display sightings and notes metrics once that data becomes available.
Data Acquisition Update: A Message Sent, Hopeful Anticipation!
Following up on the alternative data resources from the IUCN, I reached out to the first group, the Asian Elephant Specialist Group (AsESG). Their focus aligns well with the initial goal of visualizing elephant populations. I'm awaiting their response and feeling optimistic about acquiring the data needed to bring these visualizations to life. If the news is positive, I'll follow up with the group specializing in African elephant data to potentially broaden the scope of the project.
Next Week: Taking Notes for Future Collaboration!
While I wait for data acquisition updates, development continues! Next week, I'll be focusing on building the user interface (UI) for the notes feature. This feature would allow users to record observations and insights directly within the platform. Imagine working alongside others to add notes to specific elephant sightings. This collaborative effort would enrich the data available for visualization, ultimately leading to a deeper understanding of elephant conservation efforts.
Feel free to leave a comment below and share your thoughts on user profile management or the importance of data in conservation efforts!