| | | 1 | | namespace RoleRadar.Application.Tracking.Import; |
| | | 2 | | |
| | 22458 | 3 | | public sealed record SourceFieldDefinition(string File, string Field, string Handling); |
| | | 4 | | |
| | | 5 | | public static class SourceFieldCatalog |
| | | 6 | | { |
| | | 7 | | public static readonly IReadOnlyList<SourceFieldDefinition> AllFields = new SourceFieldDefinition[] |
| | | 8 | | { |
| | | 9 | | // appendix-rows.csv |
| | | 10 | | new("appendix-rows.csv", "source", "stored in Posting.SourceKind"), |
| | | 11 | | new("appendix-rows.csv", "proposed_disposition", "stored in Posting.Disposition"), |
| | | 12 | | new("appendix-rows.csv", "company", "stored in Company.Name"), |
| | | 13 | | new("appendix-rows.csv", "title", "stored in Posting.Title"), |
| | | 14 | | new("appendix-rows.csv", "req", "stored in Posting.RequisitionId"), |
| | | 15 | | new("appendix-rows.csv", "comp_detected", "stored in Posting.Compensation"), |
| | | 16 | | new("appendix-rows.csv", "comp_is_estimate", "merged into Posting.Compensation"), |
| | | 17 | | new("appendix-rows.csv", "remote_mentioned", "dropped by design"), |
| | | 18 | | new("appendix-rows.csv", "details_raw", "merged into Posting.DispositionReason"), |
| | | 19 | | new("appendix-rows.csv", "added_md", "stored in Posting.CreatedAtUtc"), |
| | | 20 | | new("appendix-rows.csv", "reason_primary", "stored in Posting.DispositionCriterionId"), |
| | | 21 | | new("appendix-rows.csv", "reason_all", "merged into Posting.DispositionReason"), |
| | | 22 | | new("appendix-rows.csv", "proposed_resurface", "stored in Posting.ResurfacePolicy"), |
| | | 23 | | new("appendix-rows.csv", "company_also_in_db", "dropped by design"), |
| | | 24 | | new("appendix-rows.csv", "review_flags", "dropped by design"), |
| | | 25 | | new("appendix-rows.csv", "reason_text", "stored in Posting.DispositionReason"), |
| | | 26 | | new("appendix-rows.csv", "decision", "dropped by design"), |
| | | 27 | | new("appendix-rows.csv", "corrected_notes", "dropped by design"), |
| | | 28 | | |
| | | 29 | | // applications.csv |
| | | 30 | | new("applications.csv", "kind", "stored in application routing"), |
| | | 31 | | new("applications.csv", "company", "stored in Company.Name / Posting.CompanyId"), |
| | | 32 | | new("applications.csv", "title", "stored in Posting.Title / Note.Title"), |
| | | 33 | | new("applications.csv", "req", "stored in Posting.RequisitionId"), |
| | | 34 | | new("applications.csv", "applied_on", "stored in Application.SubmittedDate"), |
| | | 35 | | new("applications.csv", "rejected", "stored in Application.Outcome / Posting.Disposition"), |
| | | 36 | | new("applications.csv", "rejected_date_md", "stored in ApplicationEvent.EventDate"), |
| | | 37 | | new("applications.csv", "desired_salary", "stored in Application.DesiredSalary"), |
| | | 38 | | new("applications.csv", "referral", "merged into ApplicationEvent.Notes"), |
| | | 39 | | new("applications.csv", "fit", "merged into ApplicationEvent.Notes / Posting.Score"), |
| | | 40 | | new("applications.csv", "resume_variant", "stored in Application.ResumeVariant"), |
| | | 41 | | new("applications.csv", "people_detected", "dropped by design"), |
| | | 42 | | new("applications.csv", "review_flags", "dropped by design"), |
| | | 43 | | new("applications.csv", "raw", "merged into ApplicationEvent.Notes / Note.Body"), |
| | | 44 | | new("applications.csv", "decision", "dropped by design"), |
| | | 45 | | new("applications.csv", "corrected_notes", "dropped by design"), |
| | | 46 | | |
| | | 47 | | // watchlist-companies.csv |
| | | 48 | | new("watchlist-companies.csv", "company", "stored in Company.Name"), |
| | | 49 | | new("watchlist-companies.csv", "proposed_status", "stored in Company.Status"), |
| | | 50 | | new("watchlist-companies.csv", "text", "stored in Company.Description"), |
| | | 51 | | new("watchlist-companies.csv", "decision", "dropped by design"), |
| | | 52 | | new("watchlist-companies.csv", "corrected_notes", "dropped by design"), |
| | | 53 | | |
| | | 54 | | // company-aliases.csv |
| | | 55 | | new("company-aliases.csv", "alias", "stored in CompanyAlias.Alias"), |
| | | 56 | | new("company-aliases.csv", "canonical", "stored in CompanyAlias.Canonical"), |
| | | 57 | | |
| | | 58 | | // postings.json |
| | | 59 | | new("postings.json", "added", "stored in Posting.CreatedAtUtc"), |
| | | 60 | | new("postings.json", "appliedLabel", "dropped by design"), |
| | | 61 | | new("postings.json", "comp", "stored in Posting.Compensation"), |
| | | 62 | | new("postings.json", "compHigh", "stored in Posting.CompHighPriority"), |
| | | 63 | | new("postings.json", "company", "stored in Company.Name / Posting.CompanyId"), |
| | | 64 | | new("postings.json", "culture", "stored in Posting.CultureSummary"), |
| | | 65 | | new("postings.json", "cultureLevel", "stored in Posting.CultureLevel"), |
| | | 66 | | new("postings.json", "first", "stored in Posting.CreatedAtUtc"), |
| | | 67 | | new("postings.json", "ghost", "stored in PostingSignals"), |
| | | 68 | | new("postings.json", "href", "stored in Posting.OriginalUrl"), |
| | | 69 | | new("postings.json", "loc", "stored in Posting.Location"), |
| | | 70 | | new("postings.json", "note", "stored in Note.Body / Posting.ScreeningNoteId"), |
| | | 71 | | new("postings.json", "order", "dropped by design"), |
| | | 72 | | new("postings.json", "parent", "stored in Company.Description"), |
| | | 73 | | new("postings.json", "posted", "stored in Posting.PostedAt"), |
| | | 74 | | new("postings.json", "score", "stored in Posting.Score"), |
| | | 75 | | new("postings.json", "status", "stored in Posting.Disposition"), |
| | | 76 | | new("postings.json", "tier", "dropped by design"), |
| | | 77 | | new("postings.json", "title", "stored in Posting.Title"), |
| | | 78 | | }; |
| | | 79 | | |
| | | 80 | | public static readonly ILookup<string, SourceFieldDefinition> ByFile = |
| | | 81 | | AllFields.ToLookup(f => f.File, StringComparer.OrdinalIgnoreCase); |
| | | 82 | | |
| | | 83 | | public static string GetHandling(string file, string field) |
| | | 84 | | { |
| | | 85 | | var found = AllFields.FirstOrDefault(f => |
| | | 86 | | string.Equals(f.File, file, StringComparison.OrdinalIgnoreCase) && |
| | | 87 | | string.Equals(f.Field, field, StringComparison.OrdinalIgnoreCase)); |
| | | 88 | | |
| | | 89 | | return found?.Handling ?? throw new KeyNotFoundException($"No source field mapping found for {file}:{field}"); |
| | | 90 | | } |
| | | 91 | | } |