Streamlining User Onboarding with Background CV Processing
In the devlog-ist/landing project, which focuses on creating engaging landing page experiences, a new feature was implemented to streamline user onboarding. This feature requires users to upload their CV after connecting their LinkedIn profile, before they can access the admin dashboard.
The Challenge
Requiring a CV upload as part of onboarding enriches user profiles, but the CV processing could potentially block the user experience. A direct, synchronous processing flow would lead to unacceptable delays.
The Solution
To address this, the CV upload process was designed to be asynchronous. The user uploads their CV, and the file is stored on a private disk. A background job, ProcessCvUploadJob, is then triggered to extract profile data from the CV using AI. This design ensures a smooth, non-blocking user experience.
Implementation Details
The core of this feature involves:
- CV Upload Requirement: Users are prompted to upload their CV (or skip the step) after connecting their LinkedIn profile.
- Asynchronous Processing: The
ProcessCvUploadJobhandles the extraction of profile data from the uploaded CV in the background. - Data Extraction: AI is used to automatically extract relevant information from the CV.
- Code Reusability: Shared field-mapping logic was extracted into
CvProfileAutoFillService::getFieldMap()to ensure DRY (Don't Repeat Yourself) principles are followed.
Here's a simplified example of how the background job might be triggered in Go:
// Assuming a queueing system is set up
func handleCvUpload(userID int, cvFilePath string) {
// Enqueue the background job
enqueueJob("ProcessCvUploadJob", map[string]interface{}{
"userID": userID,
"cvFilePath": cvFilePath,
})
}
// Hypothetical function to enqueue a job
func enqueueJob(jobName string, payload map[string]interface{}) {
// Implementation to enqueue the job for background processing
// e.g., using a message queue like RabbitMQ or Kafka
}
Benefits
- Improved user experience due to non-blocking CV processing.
- Enriched user profiles with automatically extracted data.
- Maintainable and reusable code through the extraction of shared logic.
Actionable Takeaway
When dealing with potentially time-consuming tasks in user onboarding flows, consider using asynchronous processing with background jobs. This keeps the user interface responsive and provides a better overall experience.