Phase 1: Cultural Sensitivity Detection Layer - Detects Western-centric framing (democracy, individual rights, freedom) - Detects Indigenous exclusion (missing Te Tiriti, CARE principles) - FLAGS for human review, never auto-blocks (preserves human agency) Implementation: - PluralisticDeliberationOrchestrator.assessCulturalSensitivity() - Pattern-based detection (Western-centric governance, Indigenous exclusion) - Risk levels: LOW, MEDIUM, HIGH - Recommended actions: APPROVE, SUGGEST_ADAPTATION, HUMAN_REVIEW - High-risk audiences: Non-Western countries (CN, RU, SA, IR, VN, TH, ID, MY, PH), Indigenous communities - Audit logging to MongoDB - media.controller.js respondToInquiry() - Cultural check after ContentGovernanceChecker passes - Stores cultural_sensitivity in response metadata - Returns flag if HIGH risk (doesn't block, flags for review) - blog.controller.js publishPost() - Cultural check after framework governance check - Stores cultural_sensitivity in moderation.cultural_sensitivity - Returns flag if HIGH risk (doesn't block, flags for review) - MediaInquiry.model.js - Added country, cultural_context fields to contact - respond() method supports cultural_sensitivity in response metadata Framework Integration: - Dual-layer governance: Universal rules (ContentGovernanceChecker) + Cultural sensitivity (PluralisticDeliberationOrchestrator) - inst_081 pluralism: Different value frameworks equally legitimate - Human-in-the-loop: AI detects/suggests, human decides Next: Phase 2 (UI/workflow), Phase 3 (learning/refinement) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
177 lines
4.6 KiB
JavaScript
177 lines
4.6 KiB
JavaScript
/**
|
|
* MediaInquiry Model
|
|
* Press/media inquiries with AI triage
|
|
*/
|
|
|
|
const { ObjectId } = require('mongodb');
|
|
const { getCollection } = require('../utils/db.util');
|
|
|
|
class MediaInquiry {
|
|
/**
|
|
* Create a new media inquiry
|
|
*/
|
|
static async create(data) {
|
|
const collection = await getCollection('media_inquiries');
|
|
|
|
const inquiry = {
|
|
contact: {
|
|
name: data.contact.name,
|
|
email: data.contact.email,
|
|
outlet: data.contact.outlet,
|
|
phone: data.contact.phone,
|
|
country: data.contact.country, // ISO country code for cultural sensitivity
|
|
cultural_context: data.contact.cultural_context // e.g., 'indigenous', 'non-western'
|
|
},
|
|
inquiry: {
|
|
subject: data.inquiry.subject,
|
|
message: data.inquiry.message,
|
|
deadline: data.inquiry.deadline ? new Date(data.inquiry.deadline) : null,
|
|
topic_areas: data.inquiry.topic_areas || []
|
|
},
|
|
ai_triage: {
|
|
urgency: data.ai_triage?.urgency, // high/medium/low
|
|
topic_sensitivity: data.ai_triage?.topic_sensitivity,
|
|
suggested_response_time: data.ai_triage?.suggested_response_time,
|
|
involves_values: data.ai_triage?.involves_values || false,
|
|
claude_summary: data.ai_triage?.claude_summary,
|
|
suggested_talking_points: data.ai_triage?.suggested_talking_points || []
|
|
},
|
|
status: data.status || 'new', // new/triaged/responded/closed
|
|
assigned_to: data.assigned_to,
|
|
response: {
|
|
sent_at: data.response?.sent_at,
|
|
content: data.response?.content,
|
|
responder: data.response?.responder
|
|
},
|
|
created_at: new Date()
|
|
};
|
|
|
|
const result = await collection.insertOne(inquiry);
|
|
return { ...inquiry, _id: result.insertedId };
|
|
}
|
|
|
|
/**
|
|
* Find inquiry by ID
|
|
*/
|
|
static async findById(id) {
|
|
const collection = await getCollection('media_inquiries');
|
|
return await collection.findOne({ _id: new ObjectId(id) });
|
|
}
|
|
|
|
/**
|
|
* Find inquiries by status
|
|
*/
|
|
static async findByStatus(status, options = {}) {
|
|
const collection = await getCollection('media_inquiries');
|
|
const { limit = 20, skip = 0 } = options;
|
|
|
|
return await collection
|
|
.find({ status })
|
|
.sort({ created_at: -1 })
|
|
.skip(skip)
|
|
.limit(limit)
|
|
.toArray();
|
|
}
|
|
|
|
/**
|
|
* Find high urgency inquiries
|
|
*/
|
|
static async findUrgent(options = {}) {
|
|
const collection = await getCollection('media_inquiries');
|
|
const { limit = 10 } = options;
|
|
|
|
return await collection
|
|
.find({
|
|
'ai_triage.urgency': 'high',
|
|
status: { $in: ['new', 'triaged'] }
|
|
})
|
|
.sort({ created_at: -1 })
|
|
.limit(limit)
|
|
.toArray();
|
|
}
|
|
|
|
/**
|
|
* Update inquiry
|
|
*/
|
|
static async update(id, updates) {
|
|
const collection = await getCollection('media_inquiries');
|
|
|
|
const result = await collection.updateOne(
|
|
{ _id: new ObjectId(id) },
|
|
{ $set: updates }
|
|
);
|
|
|
|
return result.modifiedCount > 0;
|
|
}
|
|
|
|
/**
|
|
* Assign inquiry to user
|
|
*/
|
|
static async assign(id, userId) {
|
|
const collection = await getCollection('media_inquiries');
|
|
|
|
const result = await collection.updateOne(
|
|
{ _id: new ObjectId(id) },
|
|
{
|
|
$set: {
|
|
assigned_to: new ObjectId(userId),
|
|
status: 'triaged'
|
|
}
|
|
}
|
|
);
|
|
|
|
return result.modifiedCount > 0;
|
|
}
|
|
|
|
/**
|
|
* Mark as responded
|
|
*/
|
|
static async respond(id, responseData) {
|
|
const collection = await getCollection('media_inquiries');
|
|
|
|
const updateDoc = {
|
|
$set: {
|
|
status: 'responded',
|
|
'response.sent_at': new Date(),
|
|
'response.content': responseData.content,
|
|
'response.responder': responseData.responder
|
|
}
|
|
};
|
|
|
|
// Add governance check results if provided
|
|
if (responseData.governance_check) {
|
|
updateDoc.$set['response.governance_check'] = responseData.governance_check;
|
|
}
|
|
|
|
// Add cultural sensitivity check results if provided
|
|
if (responseData.cultural_sensitivity) {
|
|
updateDoc.$set['response.cultural_sensitivity'] = responseData.cultural_sensitivity;
|
|
}
|
|
|
|
const result = await collection.updateOne(
|
|
{ _id: new ObjectId(id) },
|
|
updateDoc
|
|
);
|
|
|
|
return result.modifiedCount > 0;
|
|
}
|
|
|
|
/**
|
|
* Count by status
|
|
*/
|
|
static async countByStatus(status) {
|
|
const collection = await getCollection('media_inquiries');
|
|
return await collection.countDocuments({ status });
|
|
}
|
|
|
|
/**
|
|
* Delete inquiry
|
|
*/
|
|
static async delete(id) {
|
|
const collection = await getCollection('media_inquiries');
|
|
const result = await collection.deleteOne({ _id: new ObjectId(id) });
|
|
return result.deletedCount > 0;
|
|
}
|
|
}
|
|
|
|
module.exports = MediaInquiry;
|