Page MenuHomePhabricator

Get more clarity on Message / wmf_contribution_extra fields
Closed, ResolvedPublic2 Estimated Story PointsSpike

Description

Just creating this for notes on the analysis I'm doing to figure out which fields / keys are unused - especially since chat gpt is writing me great queries I want to store somewhere :-)

Event Timeline

Query to find which fields are used - took 14 mins

SELECT
  MAX(CASE WHEN e.settlement_date IS NOT NULL THEN c.receive_date ELSE NULL END) AS settlement_date_used,
  MAX(CASE WHEN e.no_thank_you IS NOT NULL AND e.no_thank_you != '' THEN c.receive_date ELSE NULL END) AS no_thank_you_used,
  MAX(CASE WHEN e.total_usd IS NOT NULL AND e.total_usd > 0 THEN c.receive_date ELSE NULL END) AS total_usd_used,
  MAX(CASE WHEN e.gateway_account IS NOT NULL AND e.gateway_account != '' THEN c.receive_date ELSE NULL END) AS gateway_account_used,
  MAX(CASE WHEN e.gateway IS NOT NULL AND e.gateway != '' THEN c.receive_date ELSE NULL END) AS gateway_used,
  MAX(CASE WHEN e.backend_processor IS NOT NULL AND e.backend_processor != '' THEN c.receive_date ELSE NULL END) AS backend_processor_used,
  MAX(CASE WHEN e.gateway_txn_id IS NOT NULL AND e.gateway_txn_id != '' THEN c.receive_date ELSE NULL END) AS gateway_txn_id_used,
  MAX(CASE WHEN e.backend_processor_txn_id IS NOT NULL AND e.backend_processor_txn_id != '' THEN c.receive_date ELSE NULL END) AS backend_processor_txn_id_used,
  MAX(CASE WHEN e.payment_orchestrator_reconciliation_id IS NOT NULL AND e.payment_orchestrator_reconciliation_id != '' THEN c.receive_date ELSE NULL END) AS payment_orchestrator_reconciliation_id_used,
  MAX(CASE WHEN e.gateway_status_raw IS NOT NULL AND e.gateway_status_raw != '' THEN c.receive_date ELSE NULL END) AS gateway_status_raw_used,
  MAX(CASE WHEN e.gateway_date IS NOT NULL THEN c.receive_date ELSE NULL END) AS gateway_date_used,
  MAX(CASE WHEN e.original_amount IS NOT NULL AND e.original_amount > 0 THEN c.receive_date ELSE NULL END) AS original_amount_used,
  MAX(CASE WHEN e.original_currency IS NOT NULL AND e.original_currency != '' THEN c.receive_date ELSE NULL END) AS original_currency_used,
  MAX(CASE WHEN e.settlement_usd IS NOT NULL AND e.settlement_usd > 0 THEN c.receive_date ELSE NULL END) AS settlement_usd_used,
  MAX(CASE WHEN e.settlement_currency IS NOT NULL AND e.settlement_currency != '' THEN c.receive_date ELSE NULL END) AS settlement_currency_used,
  MAX(CASE WHEN e.settlement_batch_number IS NOT NULL AND e.settlement_batch_number != '' THEN c.receive_date ELSE NULL END) AS settlement_batch_number_used,
  MAX(CASE WHEN e.deposit_date IS NOT NULL THEN c.receive_date ELSE NULL END) AS deposit_date_used,
  MAX(CASE WHEN e.deposit_usd IS NOT NULL AND e.deposit_usd > 0 THEN c.receive_date ELSE NULL END) AS deposit_usd_used,
  MAX(CASE WHEN e.deposit_currency IS NOT NULL AND e.deposit_currency != '' THEN c.receive_date ELSE NULL END) AS deposit_currency_used,
  MAX(CASE WHEN e.parent_contribution_id IS NOT NULL THEN c.receive_date ELSE NULL END) AS parent_contribution_id_used,
  MAX(CASE WHEN e.finance_only = 1 THEN c.receive_date ELSE NULL END) AS finance_only_used,
  MAX(CASE WHEN e.markup_fee IS NOT NULL AND e.markup_fee > 0 THEN c.receive_date ELSE NULL END) AS markup_fee_used,
  MAX(CASE WHEN e.interchange_fee IS NOT NULL AND e.interchange_fee > 0 THEN c.receive_date ELSE NULL END) AS interchange_fee_used,
  MAX(CASE WHEN e.scheme_fee IS NOT NULL AND e.scheme_fee > 0 THEN c.receive_date ELSE NULL END) AS scheme_fee_used,
  MAX(CASE WHEN e.source_name IS NOT NULL AND e.source_name != '' THEN c.receive_date ELSE NULL END) AS source_name_used,
  MAX(CASE WHEN e.source_type IS NOT NULL AND e.source_type != '' THEN c.receive_date ELSE NULL END) AS source_type_used,
  MAX(CASE WHEN e.source_host IS NOT NULL AND e.source_host != '' THEN c.receive_date ELSE NULL END) AS source_host_used,
  MAX(CASE WHEN e.source_run_id IS NOT NULL AND e.source_run_id != '' THEN c.receive_date ELSE NULL END) AS source_run_id_used,
  MAX(CASE WHEN e.source_version IS NOT NULL AND e.source_version != '' THEN c.receive_date ELSE NULL END) AS source_version_used,
  MAX(CASE WHEN e.source_enqueued_time IS NOT NULL THEN c.receive_date ELSE NULL END) AS source_enqueued_time_used,
  MAX(CASE WHEN e.postmark_date IS NOT NULL THEN c.receive_date ELSE NULL END) AS postmark_date_used
FROM wmf_contribution_extra e
JOIN civicrm_contribution c ON c.id = e.entity_id;
Eileenmcnaughton moved this task from Doing to Done on the Fundraising Sprint: Vixen board.

I did a bit of work on this & think it can be closed out - perhaps we can do more but https://civicrm.wikimedia.org/civicrm/admin/wmf-message-fields at least starts to declare them

XenoRyet set Final Story Points to 4.