These guides provide step-by-step instructions for integrating MindPeeker into various platforms and applications. Each guide includes code examples, best practices, and common pitfalls to avoid.
1. Authentication Setup
import mindpeeker
from mindpeeker.exceptions import MindPeekerError
client = mindpeeker.Client(
api_key="your_enterprise_api_key",
api_url="https://enterprise-api.mindpeeker.com/v1",
environment="classified"
)
2. Case Integration
class PoliceCaseIntegration:
def __init__(self, case_management_api, mindpeeker_client):
self.case_api = case_management_api
self.mp_client = mindpeeker_client
def create_psychic_investigation(self, case_number, investigation_type):
"""Create psychic investigation for police case"""
# Get case details
case = self.case_api.get_case(case_number)
# Create remote viewing session
session = self.mp_client.sessions.create(
type="remote_viewing",
target=f"Case {case_number}: {case.summary}",
modality="visual",
duration_minutes=45,
privacy_level="classified",
metadata={
"case_number": case_number,
"department": case.department,
"investigation_type": investigation_type,
"legal_authorization": case.warrant_number
}
)
# Link session to case
self.case_api.add_investigation(case_number, {
"type": "psychic_intelligence",
"session_id": session.session_id,
"analyst_assigned": "mindpeeker_analyst",
"created_at": session.created_at
})
return session
def process_investigation_results(self, session_id, case_number):
"""Process and integrate psychic investigation results"""
results = self.mp_client.sessions.get_results(session_id)
if results.status == "completed":
# Extract actionable intelligence
intelligence = self.extract_intelligence(results)
# Update case with findings
self.case_api.update_case(case_number, {
"psychic_intelligence": intelligence,
"confidence_score": results.confidence_score,
"recommendations": intelligence.recommendations,
"status": "psychic_intelligence_received"
})
# Notify investigators
if intelligence.urgency_level == "high":
self.send_urgent_notification(case_number, intelligence)
return results
def extract_intelligence(self, results):
"""Extract structured intelligence from psychic results"""
intelligence = {
"locations": [],
"persons": [],
"objects": [],
"timeline": [],
"confidence_score": results.confidence_score,
"urgency_level": self.calculate_urgency(results),
"recommendations": []
}
# Process coordinates
if results.results.coordinates:
intelligence.locations.append({
"type": "coordinates",
"latitude": results.results.coordinates.latitude,
"longitude": results.results.coordinates.longitude,
"accuracy": results.results.coordinates.accuracy_meters,
"description": "Psychic-derived location"
})
# Process descriptors
for descriptor in results.results.descriptors:
if self.is_location_descriptor(descriptor):
intelligence.locations.append({
"type": "descriptor",
"description": descriptor,
"confidence": 0.7
})
elif self.is_person_descriptor(descriptor):
intelligence.persons.append({
"description": descriptor,
"confidence": 0.6
})
return intelligence
3. Real-time Notifications
from mindpeeker.webhooks import WebhookHandler
webhook_handler = WebhookHandler('your_webhook_secret')
@webhook_handler.on('session.completed')
def handle_investigation_completed(event):
"""Handle completed psychic investigation"""
session_id = event.data.session_id
confidence_score = event.data.confidence_score
# Get linked case
case = get_case_by_session(session_id)
if confidence_score > 0.8:
# High confidence - immediate notification
send_priority_alert(case.case_number, event.data)
else:
# Standard confidence - regular notification
send_standard_notification(case.case_number, event.data)
4. Dashboard Integration
// React component for psychic intelligence dashboard
import React, { useState, useEffect } from 'react';
import { MindPeekerClient } from '@mindpeeker/javascript';
const PsychicIntelligenceDashboard = ({ caseNumber }) => {
const [investigations, setInvestigations] = useState([]);
const [loading, setLoading] = useState(false);
const client = new MindPeekerClient({
apiKey: process.env.REACT_APP_MINDPEEKER_API_KEY
});
useEffect(() => {
loadInvestigations();
}, [caseNumber]);
const loadInvestigations = async () => {
setLoading(true);
try {
const sessions = await client.sessions.list({
metadata: { case_number: caseNumber },
limit: 10
});
const investigationsWithResults = await Promise.all(
sessions.map(async (session) => {
const results = await client.sessions.getResults(session.sessionId);
return { ...session, results };
})
);
setInvestigations(investigationsWithResults);
} catch (error) {
console.error('Error loading investigations:', error);
} finally {
setLoading(false);
}
};
const createInvestigation = async () => {
try {
const session = await client.sessions.create({
type: 'remote_viewing',
target: `Case ${caseNumber}: Missing person investigation`,
modality: 'visual',
privacyLevel: 'classified'
});
await loadInvestigations();
} catch (error) {
console.error('Error creating investigation:', error);
}
};
return (
<div className="psychic-intelligence-dashboard">
<h3>Psychic Intelligence - Case {caseNumber}</h3>
<button onClick={createInvestigation}>
Start New Investigation
</button>
{loading ? (
<div>Loading investigations...</div>
) : (
<div className="investigations-list">
{investigations.map((investigation) => (
<InvestigationCard
key={investigation.sessionId}
investigation={investigation}
/>
))}
</div>
)}
</div>
);
};
class BusinessIntelligenceIntegration:
def __init__(self, bi_platform, mindpeeker_client):
self.bi_platform = bi_platform
self.mp_client = mindpeeker_client
def market_analysis_request(self, company_name, analysis_scope):
"""Request psychic market analysis"""
# Create comprehensive analysis
analysis = self.mp_client.analysis.submit_target(
target_type="business",
reference_material={
"company_name": company_name,
"analysis_scope": analysis_scope,
"timeframe": "next_12_months"
},
analysis_type="comprehensive",
priority="high"
)
return analysis
def competitive_intelligence(self, companies_list):
"""Analyze competitive landscape psychically"""
analyses = []
for company in companies_list:
analysis = self.mp_client.analysis.submit_target(
target_type="business",
reference_material={
"company_name": company,
"analysis_type": "competitive_positioning"
},
analysis_type="focused"
)
analyses.append(analysis)
return analyses
def investment_opportunity_scan(self, sector, region):
"""Scan for investment opportunities using psychic intelligence"""
dowsing_queries = [
{
"query_type": "information",
"question": f"High-growth investment opportunities in {sector} sector in {region}",
"context": {
"timeframe": "next_6_months",
"investment_size": "medium_to_large"
}
},
{
"query_type": "location",
"question": f"Optimal locations for {sector} business expansion in {region}",
"context": {
"timeframe": "next_12_months",
"criteria": ["market_potential", "regulatory_favorable", "talent_available"]
}
}
]
results = []
for query in dowsing_queries:
result = self.mp_client.dowsing.query(**query)
results.append(result)
return self.synthesize_investment_insights(results)
def synthesize_investment_insights(self, dowsing_results):
"""Synthesize multiple dowsing results into actionable insights"""
insights = {
"opportunities": [],
"locations": [],
"timeline": [],
"confidence_score": 0,
"risk_factors": []
}
for result in dowsing_results:
if result.result.coordinates:
insights.locations.append({
"latitude": result.result.coordinates.latitude,
"longitude": result.result.coordinates.longitude,
"confidence": result.confidence,
"insights": result.result.additional_insights
})
if result.result.answer != "neutral":
insights.opportunities.append({
"description": result.result.answer,
"confidence": result.confidence,
"type": result.query_type
})
# Calculate overall confidence
if insights.opportunities:
insights.confidence_score = sum(
opp["confidence"] for opp in insights.opportunities
) / len(insights.opportunities)
return insights
// Node.js service for real-time market monitoring
const MindPeekerClient = require('@mindpeeker/javascript');
const EventEmitter = require('events');
class MarketMonitor extends EventEmitter {
constructor(apiKey) {
super();
this.client = new MindPeekerClient({ apiKey });
this.monitoringIntervals = new Map();
}
startMonitoring(sector, region, intervalMinutes = 60) {
const monitorId = `${sector}_${region}`;
if (this.monitoringIntervals.has(monitorId)) {
console.log(`Already monitoring ${monitorId}`);
return;
}
const interval = setInterval(async () => {
try {
const insights = await this.getMarketInsights(sector, region);
this.emit('marketUpdate', { sector, region, insights });
// Alert on significant changes
if (insights.confidence_score > 0.8) {
this.emit('highConfidenceAlert', { sector, region, insights });
}
} catch (error) {
console.error(`Error monitoring ${monitorId}:`, error);
this.emit('monitoringError', { sector, region, error });
}
}, intervalMinutes * 60 * 1000);
this.monitoringIntervals.set(monitorId, interval);
console.log(`Started monitoring ${monitorId}`);
}
async getMarketInsights(sector, region) {
const queries = [
{
query_type: 'information',
question: `Current market conditions for ${sector} in ${region}`,
context: { timeframe: 'present' }
},
{
query_type: 'information',
question: `Future market trends for ${sector} in ${region}`,
context: { timeframe: 'next_3_months' }
}
];
const results = await Promise.all(
queries.map(query => this.client.dowsing.query(query))
);
return this.synthesizeResults(results);
}
stopMonitoring(sector, region) {
const monitorId = `${sector}_${region}`;
const interval = this.monitoringIntervals.get(monitorId);
if (interval) {
clearInterval(interval);
this.monitoringIntervals.delete(monitorId);
console.log(`Stopped monitoring ${monitorId}`);
}
}
}
// Usage
const monitor = new MarketMonitor(process.env.MINDPEEKER_API_KEY);
monitor.on('marketUpdate', (data) => {
console.log(`Market update for ${data.sector} in ${data.region}:`, data.insights);
// Update dashboard, send notifications, etc.
});
monitor.on('highConfidenceAlert', (data) => {
console.log(`HIGH CONFIDENCE ALERT for ${data.sector}:`, data.insights);
// Send urgent notifications to decision makers
});
monitor.startMonitoring('technology', 'silicon_valley', 30);
import React, { useState, useEffect } from 'react';
import { View, Text, Button, ActivityIndicator } from 'react-native';
import MindPeekerClient from '@mindpeeker/javascript';
const PsychicInsightScreen = () => {
const [client] = useState(() =>
new MindPeekerClient({
apiKey: process.env.MINDPEEKER_API_KEY,
api_url: 'https://api.mindpeeker.com/v1'
})
);
const [session, setSession] = useState(null);
const [results, setResults] = useState(null);
const [loading, setLoading] = useState(false);
const startPsychicReading = async () => {
setLoading(true);
try {
const newSession = await client.sessions.create({
type: 'dowsing',
target: 'Personal guidance request',
modality: 'kinesthetic',
duration_minutes: 15
});
setSession(newSession);
// Poll for results
const pollInterval = setInterval(async () => {
try {
const sessionResults = await client.sessions.getResults(newSession.session_id);
if (sessionResults.status === 'completed') {
setResults(sessionResults);
setLoading(false);
clearInterval(pollInterval);
} else if (sessionResults.status === 'failed') {
setLoading(false);
clearInterval(pollInterval);
alert('Session failed. Please try again.');
}
} catch (error) {
console.error('Error polling results:', error);
}
}, 5000);
} catch (error) {
console.error('Error starting session:', error);
setLoading(false);
alert('Error starting psychic reading');
}
};
return (
<View style={{ padding: 20 }}>
<Text style={{ fontSize: 24, marginBottom: 20 }}>
Psychic Insights
</Text>
{!session && !loading && (
<Button
title="Start Psychic Reading"
onPress={startPsychicReading}
/>
)}
{loading && (
<View style={{ alignItems: 'center' }}>
<ActivityIndicator size="large" />
<Text style={{ marginTop: 10 }}>
Connecting to psychic network...
</Text>
</View>
)}
{results && (
<View style={{ marginTop: 20 }}>
<Text style={{ fontSize: 18, fontWeight: 'bold' }}>
Your Psychic Insights
</Text>
<Text style={{ marginTop: 10 }}>
Confidence: {(results.confidence_score * 100).toFixed(1)}%
</Text>
{results.results.descriptors && (
<View style={{ marginTop: 10 }}>
<Text style={{ fontWeight: 'bold' }}>Insights:</Text>
{results.results.descriptors.map((descriptor, index) => (
<Text key={index}>• {descriptor}</Text>
))}
</View>
)}
<Button
title="New Reading"
onPress={() => {
setSession(null);
setResults(null);
}}
style={{ marginTop: 20 }}
/>
</View>
)}
</View>
);
};
export default PsychicInsightScreen;
<template>
<div class="psychic-analysis">
<div class="header">
<h2>Psychic Business Analysis</h2>
<p>Get psychic insights for your business decisions</p>
</div>
<div class="input-section">
<div class="form-group">
<label>Company Name:</label>
<input v-model="companyName" type="text" placeholder="Enter company name" />
</div>
<div class="form-group">
<label>Analysis Type:</label>
<select v-model="analysisType">
<option value="market_position">Market Position</option>
<option value="growth_potential">Growth Potential</option>
<option value="competitive_threats">Competitive Threats</option>
<option value="investment_opportunity">Investment Opportunity</option>
</select>
</div>
<button
@click="startAnalysis"
:disabled="loading || !companyName"
class="analyze-btn"
>
{{ loading ? 'Analyzing...' : 'Start Analysis' }}
</button>
</div>
<div v-if="loading" class="loading">
<div class="spinner"></div>
<p>Connecting to psychic intelligence network...</p>
</div>
<div v-if="results" class="results">
<h3>Analysis Results</h3>
<div class="confidence-meter">
<span>Confidence:</span>
<div class="meter">
<div
class="meter-fill"
:style="{ width: (results.confidence_score * 100) + '%' }"
></div>
</div>
<span>{{ (results.confidence_score * 100).toFixed(1) }}%</span>
</div>
<div class="insights">
<h4>Key Insights:</h4>
<ul>
<li v-for="insight in results.results.key_findings" :key="insight">
{{ insight }}
</li>
</ul>
</div>
<div v-if="results.results.recommendations" class="recommendations">
<h4>Recommendations:</h4>
<ul>
<li v-for="rec in results.results.recommendations" :key="rec">
{{ rec }}
</li>
</ul>
</div>
<button @click="resetAnalysis" class="new-analysis-btn">
New Analysis
</button>
</div>
</div>
</template>
<script>
import { MindPeekerClient } from '@mindpeeker/javascript';
export default {
name: 'PsychicAnalysis',
data() {
return {
client: null,
companyName: '',
analysisType: 'market_position',
loading: false,
results: null
};
},
mounted() {
this.client = new MindPeekerClient({
apiKey: process.env.VUE_APP_MINDPEEKER_API_KEY
});
},
methods: {
async startAnalysis() {
this.loading = true;
try {
const analysis = await this.client.analysis.submit_target({
target_type: 'business',
reference_material: {
company_name: this.companyName,
analysis_type: this.analysisType
},
analysis_type: 'comprehensive'
});
// Poll for results
const pollResults = async () => {
const results = await this.client.analysis.get_results(analysis.analysis_id);
if (results.status === 'completed') {
this.results = results;
this.loading = false;
} else if (results.status === 'failed') {
this.loading = false;
alert('Analysis failed. Please try again.');
} else {
setTimeout(pollResults, 3000);
}
};
pollResults();
} catch (error) {
console.error('Error starting analysis:', error);
this.loading = false;
alert('Error starting analysis');
}
},
resetAnalysis() {
this.companyName = '';
this.analysisType = 'market_position';
this.results = null;
}
}
};
</script>
<style scoped>
.psychic-analysis {
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
.header {
text-align: center;
margin-bottom: 30px;
}
.input-section {
background: #f5f5f5;
padding: 20px;
border-radius: 8px;
margin-bottom: 20px;
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
.form-group input,
.form-group select {
width: 100%;
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
}
.analyze-btn {
background: #007bff;
color: white;
border: none;
padding: 12px 24px;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
.analyze-btn:disabled {
background: #ccc;
cursor: not-allowed;
}
.loading {
text-align: center;
padding: 40px;
}
.spinner {
border: 4px solid #f3f3f3;
border-top: 4px solid #3498db;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
margin: 0 auto 20px;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.results {
background: #e8f5e8;
padding: 20px;
border-radius: 8px;
margin-top: 20px;
}
.confidence-meter {
display: flex;
align-items: center;
margin: 20px 0;
}
.meter {
flex: 1;
height: 20px;
background: #ddd;
border-radius: 10px;
margin: 0 10px;
overflow: hidden;
}
.meter-fill {
height: 100%;
background: linear-gradient(90deg, #ff6b6b, #ffd93d, #6bcf7f);
transition: width 0.3s ease;
}
.insights, .recommendations {
margin: 20px 0;
}
.insights h4, .recommendations h4 {
margin-bottom: 10px;
color: #333;
}
.insights ul, .recommendations ul {
margin: 0;
padding-left: 20px;
}
.insights li, .recommendations li {
margin-bottom: 8px;
}
.new-analysis-btn {
background: #28a745;
color: white;
border: none;
padding: 10px 20px;
border-radius: 4px;
cursor: pointer;
}
</style>
import unittest
from unittest.mock import Mock, patch
from mindpeeker.testing import MockClient
class TestLawEnforcementIntegration(unittest.TestCase):
def setUp(self):
self.mock_mp_client = MockClient()
self.mock_case_api = Mock()
self.integration = PoliceCaseIntegration(
self.mock_case_api,
self.mock_mp_client
)
def test_create_psychic_investigation(self):
# Setup
case_data = {
"case_number": "CASE-2025-001",
"summary": "Missing person investigation",
"department": "Homicide Division",
"warrant_number": "WARRANT-001"
}
self.mock_case_api.get_case.return_value = case_data
expected_session = Mock()
expected_session.session_id = "sess_123"
expected_session.created_at = "2025-01-15T10:30:00Z"
self.mock_mp_client.sessions.create.return_value = expected_session
# Execute
result = self.integration.create_psychic_investigation(
"CASE-2025-001",
"missing_person"
)
# Verify
self.assertEqual(result.session_id, "sess_123")
self.mock_mp_client.sessions.create.assert_called_once_with(
type="remote_viewing",
target="Case CASE-2025-001: Missing person investigation",
modality="visual",
duration_minutes=45,
privacy_level="classified",
metadata={
"case_number": "CASE-2025-001",
"department": "Homicide Division",
"investigation_type": "missing_person",
"legal_authorization": "WARRANT-001"
}
)
self.mock_case_api.add_investigation.assert_called_once()
def test_high_confidence_notification(self):
# Setup
high_confidence_results = Mock()
high_confidence_results.confidence_score = 0.92
high_confidence_results.status = "completed"
self.mock_mp_client.sessions.get_results.return_value = high_confidence_results
case_data = {"case_number": "CASE-2025-001"}
self.mock_case_api.get_case_by_session.return_value = case_data
# Execute
with patch.object(self.integration, 'send_priority_notification') as mock_notify:
self.integration.process_investigation_results("sess_123", "CASE-2025-001")
# Verify
mock_notify.assert_called_once()