forked from Bugs-Bunny53/Resume-Analyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-data.js
More file actions
87 lines (75 loc) · 3.03 KB
/
check-data.js
File metadata and controls
87 lines (75 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import { initializeApp } from 'firebase/app';
import { getFirestore, collection, getDocs, query, where, limit, orderBy } from 'firebase/firestore';
const firebaseConfig = {
apiKey: "AIzaSyD8S9Y0GlNZ0yJCzGpVdxVzJXVEP6HFT_k",
authDomain: "resume-analyzer-4d622.firebaseapp.com",
projectId: "resume-analyzer-4d622",
storageBucket: "resume-analyzer-4d622.firebasestorage.app",
messagingSenderId: "802176798472",
appId: "1:802176798472:web:dfe8c95e5e2cae7b6e652f"
};
const app = initializeApp(firebaseConfig);
const db = getFirestore(app);
async function checkData() {
console.log('=== Checking Occupations Data ===\n');
// 1. Check a few sample occupations
console.log('Sample occupations:');
const sampleQuery = query(collection(db, 'occupations'), limit(3));
const sampleSnapshot = await getDocs(sampleQuery);
sampleSnapshot.forEach(doc => {
const data = doc.data();
console.log(`${doc.id}: ${data.title}`);
console.log(` bright_outlook: ${data.bright_outlook}`);
console.log(` rapid_growth: ${data.rapid_growth}`);
console.log(` numerous_openings: ${data.numerous_openings}`);
});
// 2. Check bright_outlook occupations
console.log('\n=== Occupations with bright_outlook = true ===');
const brightQuery = query(
collection(db, 'occupations'),
where('bright_outlook', '==', true),
orderBy('title'),
limit(10)
);
try {
const brightSnapshot = await getDocs(brightQuery);
console.log(`Found ${brightSnapshot.size} occupations with bright_outlook = true`);
brightSnapshot.forEach(doc => {
const data = doc.data();
console.log(`- ${data.title} (${doc.id})`);
});
} catch (error) {
console.error('Error querying bright_outlook:', error.message);
console.log('This might mean the index is not set up or the field doesn\'t exist');
}
// 3. Search for "law" occupations
console.log('\n=== Searching for "law" (checking first 100) ===');
const allQuery = query(collection(db, 'occupations'), orderBy('title'), limit(100));
const allSnapshot = await getDocs(allQuery);
const lawMatches = [];
allSnapshot.forEach(doc => {
const data = doc.data();
if (data.title?.toLowerCase().includes('law') ||
data.description?.toLowerCase().includes('law')) {
lawMatches.push(`${data.title} (${doc.id})`);
}
});
console.log(`Found ${lawMatches.length} matches for "law" in first 100:`);
lawMatches.forEach(match => console.log(`- ${match}`));
// 4. Count bright_outlook occupations
const brightCountQuery = query(
collection(db, 'occupations'),
where('bright_outlook', '==', true)
);
const brightCountSnapshot = await getDocs(brightCountQuery);
console.log(`\nOccupations with bright_outlook = true: ${brightCountSnapshot.size}`);
// 5. Check total count
const totalSnapshot = await getDocs(collection(db, 'occupations'));
console.log(`Total occupations in database: ${totalSnapshot.size}`);
}
checkData()
.then(() => process.exit(0))
.catch(error => {
console.error('Error:', error);
process.exit(1);
});