@1aboveio/skills 1.0.21 → 1.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/.codex-plugin/plugin.json +1 -1
  2. package/.codex-plugin/resources.json +175 -153
  3. package/package.json +4 -4
  4. package/skills/app-dev/airflow/SKILL.md +1 -1
  5. package/skills/app-dev/android-development/SKILL.md +1 -1
  6. package/skills/app-dev/app-debug/SKILL.md +1 -1
  7. package/skills/app-dev/better-auth/SKILL.md +1 -1
  8. package/skills/app-dev/data-catalog/SKILL.md +1 -1
  9. package/skills/app-dev/data-quality/SKILL.md +1 -1
  10. package/skills/app-dev/ios-foundation/SKILL.md +1 -1
  11. package/skills/app-dev/maestro/SKILL.md +1 -1
  12. package/skills/app-dev/monorepo/SKILL.md +1 -1
  13. package/skills/app-dev/nextjs-fullstack/SKILL.md +1 -1
  14. package/skills/app-dev/prisma-setup/SKILL.md +1 -1
  15. package/skills/app-dev/pyspark/SKILL.md +1 -1
  16. package/skills/app-dev/python-backend/SKILL.md +1 -1
  17. package/skills/app-dev/shadcn/SKILL.md +1 -1
  18. package/skills/app-dev/zod-v4/SKILL.md +1 -1
  19. package/skills/cicd/cloud-build/SKILL.md +1 -1
  20. package/skills/cicd/cloud-debug/SKILL.md +1 -1
  21. package/skills/cicd/cloud-deploy/SKILL.md +1 -1
  22. package/skills/cicd/docker/SKILL.md +1 -1
  23. package/skills/cicd/github-actions/SKILL.md +4 -2
  24. package/skills/cicd/github-actions/references/debugging.md +21 -0
  25. package/skills/cicd/github-actions/references/post-deploy-and-publishing.md +7 -0
  26. package/skills/cicd/github-actions/scripts/watch-run.mjs +511 -0
  27. package/skills/cicd/github-flow/SKILL.md +35 -9
  28. package/skills/cicd/github-flow/scripts/watch-checks.mjs +561 -0
  29. package/skills/cicd/google-cloud/SKILL.md +1 -1
  30. package/skills/cicd/mergify/SKILL.md +2 -2
  31. package/skills/cicd/mergify/references/diagnosis.md +6 -1
  32. package/skills/cicd/mergify/references/watch-contract.md +10 -7
  33. package/skills/cicd/mergify/scripts/watch-pr-delivery-core.mjs +15 -30
  34. package/skills/cicd/podman/SKILL.md +1 -1
  35. package/skills/content/article-review/SKILL.md +1 -1
  36. package/skills/content/article-to-image/SKILL.md +1 -1
  37. package/skills/content/flowchart-svg/SKILL.md +1 -1
  38. package/skills/content/image-gen/SKILL.md +1 -1
  39. package/skills/content/mermaid/SKILL.md +1 -1
  40. package/skills/content/wechat-article-writer/SKILL.md +1 -1
  41. package/skills/content/wechat-publisher/SKILL.md +1 -1
  42. package/skills/content/wechat-search/SKILL.md +1 -1
  43. package/skills/content/xai-search/SKILL.md +1 -1
  44. package/skills/core/distill-writing/SKILL.md +1 -1
  45. package/skills/core/doc-to-md/SKILL.md +1 -1
  46. package/skills/core/editorial-review/SKILL.md +1 -1
  47. package/skills/core/house-style/SKILL.md +1 -1
  48. package/skills/core/plain-language/SKILL.md +1 -1
  49. package/skills/core/polish-cn/SKILL.md +1 -1
  50. package/skills/core/reg-parser/SKILL.md +1 -1
  51. package/skills/core/terminology/SKILL.md +1 -1
  52. package/skills/core/write-doc/SKILL.md +1 -1
  53. package/skills/core/write-report/SKILL.md +1 -1
  54. package/skills/engineering/better-review/SKILL.md +1 -1
  55. package/skills/engineering/e2e-test/SKILL.md +1 -1
  56. package/skills/engineering/engineering/SKILL.md +1 -1
  57. package/skills/engineering/engineering-runtime/SKILL.md +1 -1
  58. package/skills/engineering/engineering-runtime/coherence/workflow.json +13 -13
  59. package/skills/engineering/ensure-coverage/SKILL.md +1 -1
  60. package/skills/engineering/golden-path/SKILL.md +1 -1
  61. package/skills/engineering/harness-runtime/SKILL.md +2 -1
  62. package/skills/engineering/harness-runtime/contracts.md +2 -0
  63. package/skills/engineering/harness-runtime/references/subagent-sessions.md +75 -0
  64. package/skills/engineering/resolve-issues/SKILL.md +2 -2
  65. package/skills/engineering/resolve-issues/references/ci.md +2 -4
  66. package/skills/engineering/resolve-issues/references/delivery-progress.md +1 -1
  67. package/skills/engineering/resolve-issues/references/done.md +3 -6
  68. package/skills/engineering/resolve-issues/references/expire.md +2 -2
  69. package/skills/engineering/resolve-issues/references/implementation.md +52 -41
  70. package/skills/engineering/resolve-issues/references/review.md +18 -19
  71. package/skills/engineering/resolve-issues/references/shared-modules.md +7 -1
  72. package/skills/engineering/resolve-issues/references/task-plan.md +18 -10
  73. package/skills/engineering/resolve-issues/scripts/next-actions.mjs +42 -32
  74. package/skills/engineering/resolve-release/SKILL.md +1 -1
  75. package/skills/engineering/resolve-release/references/publish.md +12 -4
  76. package/skills/engineering/resolve-release/references/workspace-npm.md +6 -4
  77. package/skills/engineering/rush-issues/SKILL.md +1 -1
  78. package/skills/engineering/rush-release/SKILL.md +1 -1
  79. package/skills/engineering/test-quality/SKILL.md +1 -1
  80. package/skills/risk-compliance/compliance-audit/SKILL.md +1 -1
  81. package/skills/risk-compliance/contract-compare/SKILL.md +1 -1
  82. package/skills/risk-compliance/contract-review/SKILL.md +1 -1
  83. package/skills/risk-compliance/doc-authenticity/SKILL.md +1 -1
  84. package/skills/risk-compliance/fraud-detection/SKILL.md +1 -1
  85. package/skills/risk-compliance/payment-analysis/SKILL.md +1 -1
  86. package/skills/risk-compliance/portfolio-payment-analysis/SKILL.md +76 -156
  87. package/skills/risk-compliance/portfolio-payment-analysis/references/metrics-and-reporting.md +37 -170
  88. package/skills/risk-compliance/portfolio-payment-analysis/references/risk-history.md +32 -15
  89. package/skills/risk-compliance/portfolio-payment-analysis/references/workflow-and-contracts.md +71 -0
  90. package/skills/risk-compliance/portfolio-payment-analysis/scripts/analyze.py +10 -1
  91. package/skills/risk-compliance/portfolio-payment-analysis/scripts/assets/charts.css +1 -0
  92. package/skills/risk-compliance/portfolio-payment-analysis/scripts/assets/charts.js +60 -0
  93. package/skills/risk-compliance/portfolio-payment-analysis/scripts/assets/tabs.js +2 -0
  94. package/skills/risk-compliance/portfolio-payment-analysis/scripts/build_report.py +28 -137
  95. package/skills/risk-compliance/portfolio-payment-analysis/scripts/echarts_report.py +43 -0
  96. package/skills/risk-compliance/portfolio-payment-analysis/scripts/interactive_report.py +3 -0
  97. package/skills/risk-compliance/portfolio-payment-analysis/scripts/issuer_data.py +52 -0
  98. package/skills/risk-compliance/portfolio-payment-analysis/scripts/payment_amounts.py +20 -0
  99. package/skills/risk-compliance/portfolio-payment-analysis/scripts/render.py +6 -157
  100. package/skills/risk-compliance/portfolio-payment-analysis/scripts/render_base.py +164 -0
  101. package/skills/risk-compliance/portfolio-payment-analysis/scripts/render_custom.py +30 -0
  102. package/skills/risk-compliance/portfolio-payment-analysis/scripts/report_data.py +39 -0
  103. package/skills/risk-compliance/portfolio-payment-analysis/scripts/report_model.py +45 -0
  104. package/skills/risk-compliance/portfolio-payment-analysis/scripts/risk_dual.py +54 -0
  105. package/skills/risk-compliance/portfolio-payment-analysis/scripts/vamp_detail.py +27 -0
  106. package/skills/risk-compliance/portfolio-payment-analysis/scripts/vamp_opened_disputes.py +30 -0
  107. package/skills/risk-compliance/portfolio-payment-analysis/scripts/vendor/LICENSE +222 -0
  108. package/skills/risk-compliance/portfolio-payment-analysis/scripts/vendor/NOTICE +5 -0
  109. package/skills/risk-compliance/portfolio-payment-analysis/scripts/vendor/echarts-provenance.json +6 -0
  110. package/skills/risk-compliance/portfolio-payment-analysis/scripts/vendor/echarts.min.js +45 -0
  111. package/skills/risk-compliance/similar-domain/SKILL.md +1 -1
  112. package/skills/risk-compliance/tld-detection/SKILL.md +1 -1
@@ -1,170 +1,90 @@
1
1
  ---
2
2
  name: portfolio-payment-analysis
3
- description: >
4
- Analyze submerchants in Helipay/Worldpay aggregator exports: compare merchants
5
- and investigate selected merchants' authorization, settlement and disputes,
6
- including descriptor mapping and overlapping exports. Portfolio-level payment
7
- overviews belong to payment-analysis; fraud rule discovery belongs to fraud-detection.
8
- release-version: 0.50.1
3
+ description: Analyze Helipay/Worldpay submerchants from authorization, settlement, dispute and DART-340 exports; compare merchants and produce an offline interactive Chinese merchant report. Use for aggregator merchant comparisons, merchant authorization performance, issuer drilldown, merchant fraud/dispute histories and VAMP extract estimates. Portfolio-wide overviews belong to payment-analysis; fraud rule discovery belongs to fraud-detection.
4
+ release-version: 0.50.3
9
5
  ---
10
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
11
7
  # Portfolio payment analysis
12
8
 
13
- Before report drafting or substantive review, read
14
- `{house-style baseDir}/references/analytical-reporting.md` and its
15
- required writing-pattern and definition references. Use `write-report` for the report stage
16
- with this skill's merchant template, not `write-doc` or the portfolio report layout. Give
17
- delegated writers and reviewers the same resolved reference paths and require the reads;
18
- keep merchant metrics, confidentiality and specialist checks unchanged. Individual native
19
- selections also need `write-report` and its required `terminology` dependency; installation
20
- metadata does not load instructions. Missing required resources leave the report stage incomplete.
9
+ Analyze attributed payment portfolios and produce an internal Chinese merchant report
10
+ by default. Worldpay CSV and DART-340 are the bundled adapters; other sources need
11
+ verified field and identity mappings. Keep private extracts local and synthetic
12
+ fixtures in the repository.
21
13
 
22
- Produce an internal submerchant report in Chinese by default, with merchant comparisons
23
- and detail for merchants the user selects. Treat the extracts as confidential; do not
24
- publish them or include cardholder data in the report. Use the installed
25
- `payment-analysis` skill as the base: read its `SKILL.md` and relevant references for
26
- periods, event layers, metrics, daily USD FX, disputes, visualization and editorial
27
- checks. This skill owns the aggregator report structure in
28
- [metrics and reporting](references/metrics-and-reporting.md); that template replaces
29
- the base report's chapter order and mandatory Sankey. Inherit the base's metric,
30
- FX, dispute, terminology and fact-preservation rules. Pass the aggregator template
31
- to editorial review. Scope any payment-stage evidence to a merchant; do not include a
32
- portfolio funnel or Sankey.
33
-
34
- For a clean individual native installation, select `portfolio-payment-analysis`,
35
- `payment-analysis`, `write-report`, `editorial-review`, `polish-cn`, `terminology`, and `house-style`; the native
36
- picker does not install dependencies automatically. The generated Payment install
37
- group recipe includes the dependency closure.
14
+ Start with [workflow and module contracts](references/workflow-and-contracts.md), then
15
+ apply the [report structure](references/metrics-and-reporting.md). Follow the stages
16
+ below in order; scripts implement these contracts rather than define business scope.
38
17
 
39
18
  ## Workflow
40
19
 
41
- 1. Inventory authorized Helipay/Worldpay inputs, source coverage, event dates,
42
- timezone, currencies, identifiers, field dictionaries and reporting periods.
43
- Record missing and partial layers. Use the requested period and merchant selection;
44
- otherwise apply the base skill's period-selection rule, then pass both required
45
- CLI dates explicitly. Identify an unsupported or unresolved period
46
- rather than inventing one.
47
- 2. Read [identity and reconciliation](references/identity-and-reconciliation.md)
48
- before deduplication or joining. Build the mapping and reconciliation evidence;
49
- scope every join to the same verified merchant and source namespace. Unknown or
50
- conflicting identities are not reassigned by descriptor or order similarity.
51
- 3. Read [metrics and reporting](references/metrics-and-reporting.md). Compute
52
- merchant rates with merchant-specific denominators and disclose sample counts.
53
- Include week-by-week comparisons for every submerchant within the report period,
54
- using Monday–Sunday weeks and explicit partial-week labels. Compare other periods
55
- for individual merchants when explicitly requested and supported.
56
- Read [risk history](references/risk-history.md) for 340FRD, dispute histories
57
- and VAMP. Use the base skill's FX and dispute rules; leave unsupported figures
58
- unresolved, not zero.
59
- 4. Present merchant findings, comparison, selected merchant detail and merchant-specific
60
- investigation actions. Explain missing data, conflicts, unmatched records, rate
61
- denominators and attribution limits. Keep totals only as internal reconciliation
62
- evidence; do not report portfolio summaries, trends, decomposition, funnels or
63
- overall dispute chapters.
64
- Follow the base skill's editorial review, Chinese polish and fact-preservation
65
- checks when producing a complete report.
66
-
67
- ## CLI and scope
68
-
69
- The bundled workflow uses Python 3 standard-library scripts and local Worldpay CSV
70
- exports. It makes no network calls. Authorization data is required; settlement and
71
- dispute files are used when supplied. Run all three commands:
20
+ 1. Read the installed `payment-analysis/SKILL.md` and its event-layer, metric, FX,
21
+ dispute and terminology references. Inventory authorized inputs, source dictionaries,
22
+ merchant/provider identifiers, coverage, timezone and currencies. Fix explicit main
23
+ dates using the user's period or the base period-selection question. The common cutoff
24
+ is the earliest supplied layer's last event date for the main table and risk history.
25
+ Authorization charts use the earlier of requested end and last authorization date,
26
+ independently of settlement coverage; disclose both cutoffs and partial periods.
27
+ 2. Before deduplication or joins, read [identity and reconciliation](references/identity-and-reconciliation.md).
28
+ Scope identity and joins to the verified merchant/provider namespace. Descriptor,
29
+ Gateway MID and MID are not interchangeable submerchant keys. Conflicting auth or
30
+ settlement identities stop generation; retain unresolved attribution explicitly.
31
+ 3. Read [metrics and reporting](references/metrics-and-reporting.md) and
32
+ [risk history](references/risk-history.md). Use the bundled calculator and builder
33
+ for merchant-specific denominators, two-period detail, current-week issuer top five,
34
+ eight-week amount/count trends and risk count/rate histories. Unknown amounts or
35
+ missing daily USD FX leave affected sums unavailable, not mixed-currency totals.
36
+ 4. Use `write-report` for the report stage with this skill's template. Read
37
+ `house-style/references/analytical-reporting.md`, `analytical-writing-patterns.md`
38
+ and `definitions-and-metrics.md`; load required `terminology`, `editorial-review`
39
+ and domain-required `polish-cn`. Pass the same references and merchant template to
40
+ any authorized writer/reviewer. Missing dependencies leave report review incomplete.
41
+ Review `presentation.json`, apply narrative edits there and rerender both outputs.
42
+ 5. Verify arithmetic, chart values, current-week issuer selection, null/zero semantics,
43
+ tabs, tooltips, drilldown and offline printing. Open the saved HTML in a local browser;
44
+ rendering instructions alone are not visual verification. Retain check evidence outside
45
+ the business report and state any unverified rendering or missing data.
46
+
47
+ ## Local CLI
48
+
49
+ The calculator uses Python standard-library CSV exports. ECharts is pinned and bundled;
50
+ report generation and viewing make no network calls.
72
51
 
73
52
  ```sh
74
- python3 {portfolio-payment-analysis baseDir}/scripts/analyze.py --input PATH --output OUTPUT --main-start YYYY-MM-DD --main-end YYYY-MM-DD
75
- python3 {portfolio-payment-analysis baseDir}/scripts/build_report.py --facts OUTPUT/facts.json --output OUTPUT
76
- # After editing or polishing presentation.json, rerender without rebuilding its narrative:
77
- python3 {portfolio-payment-analysis baseDir}/scripts/render.py --model OUTPUT/presentation.json --output OUTPUT
53
+ python3 {skill-dir}/scripts/analyze.py --input PATH --output OUTPUT --main-start YYYY-MM-DD --main-end YYYY-MM-DD
54
+ python3 {skill-dir}/scripts/build_report.py --facts OUTPUT/facts.json --output OUTPUT
55
+ python3 {skill-dir}/scripts/render.py --model OUTPUT/presentation.json --output OUTPUT
78
56
  ```
79
57
 
80
- The calculator caps the requested end at the earliest last event date among supplied
81
- layers. It reports the effective cutoff and compares the corresponding prior-month
82
- dates. Source event ranges alone do not establish continuous coverage. Check period lengths
83
- and source coverage before interpreting a comparison.
84
-
85
- The report outputs are `overview.zh.html` and `overview.zh.md`, backed by the reviewed
86
- `presentation.json`. Supporting internal files are `facts.json`, `merchant-metrics.csv`,
87
- `merchant-mapping.csv`, `merchant-weekly.csv`, `merchant-segments.csv`,
88
- `merchant-detail-comparison.csv`, `merchant-risk-history.csv`, and
89
- `coverage-and-reconciliation.json`; legacy aggregate fields
90
- in these files are not report deliverables. The HTML is self-contained, supports
91
- merchant filtering and printing, and sends no data to external services. Use
92
- `--detail-merchant ID` on `build_report.py` (repeat it for several IDs) when the user
93
- names merchants. Otherwise expand the largest merchant by attempts and the lowest-rate
94
- merchant with at least 30 attempts, while keeping every other merchant available in
95
- collapsed detail sections. This is a navigation rule, not a significance test.
96
- Section 2 retains full weekly history. Section 3 uses charts to compare only this week
97
- with last week, matching weekdays when the current week is partial. Every merchant
98
- has BIN-country, card-product (payment method × card type), fixed USD amount-bucket,
99
- authentication and unsuccessful-response charts. Country and card-product charts use
100
- compact paired bars. Amount buckets use side-by-side histograms, unsuccessful responses
101
- use side-by-side bars, and authentication uses paired pies for counts and USD amounts,
102
- not rates. Each pair compares aligned weeks. Use the shared `comparison_charts.py` for
103
- all report charts. Section 3 omits settlement sales/refunds. Include merchant risk
104
- history charts as specified in the risk reference. Treat 340FRD file generation date
105
- as its report date, retaining the earliest date for exact repeats. Monthly dispute
106
- and fraud charts offer counts and network-style rate estimates with numerator and
107
- denominator details; weekly charts retain counts. Visa uses same-month sales,
108
- Mastercard ECP uses prior-month sales, and EFM uses fraud chargebacks divided by
109
- prior-month e-commerce sales, not all 340FRD Mastercard reports. Fix groups across the union of the
110
- two comparison periods, and display
111
- only those two ranges in chart legends and expandable metric-row tables. Follow the
112
- segment and denominator contract in the reporting reference.
113
- Include merchant-specific historical refund and dispute follow-ups in the action table
114
- when supported, without adding portfolio history chapters. If the user says a merchant is
115
- historical and out of this report, pass `--exclude-merchant ID` (repeat it for several IDs).
116
- That removes the merchant from comparison, weekly tables, detail, the action list, and every
117
- linked merchant CSV. State the exclusion once: it is not a closure finding and not missing data.
118
- Do not lead the report with an excluded merchant. A later rebuild without the flag puts the
119
- merchant back.
120
-
121
- The generated lowest-authorization-rate sentence only chooses an authorization review. It is
122
- not the investigation order. If fraud or predispute history would change who a reader checks
123
- first, put that merchant and month in the opening, and say whether the month is inside the
124
- report window. Do not title a real extract 样本报告; 样本 is only for a small attempt count.
125
-
126
- A packed week cell that includes dollars must say 授权成功 USD. The rule against repeating a
127
- metric label applies only when the column header already names that measure. When the sales
128
- column contains both 0.00 and blank, say which merchants have an observed zero and which have
129
- no settlement layer. An invalid or post-cutoff 340FRD file must state the effect on counts, not
130
- only the date. Unmatched fraud records must state the count and amount excluded from merchant
131
- figures.
132
-
133
- The report includes per-submerchant weekly counts, rates, successful authorization
134
- amount USD, settled sales, refunds and dispute observations. Each merchant's breakdown
135
- uses date/week columns and metric rows; successful authorization amount has its own
136
- row and never substitutes settled sales. Only adjacent full calendar weeks with available observations and valid
137
- denominators receive week-over-week changes; partial weeks retain their metrics but
138
- have no week-over-week change. Read the weekly contract in the reporting reference.
139
-
140
- The optional `--fx-rates` accepts caller-supplied daily USD rates. The CLI does not
141
- verify their provenance; obtain and preserve Forex Service evidence as specified by
142
- the base FX contract before relying on converted amounts. Without a required rate,
143
- the affected amount is unavailable while count metrics remain available. Render unavailable
144
- cells blank, not N/A; show only `USD 33...` in a USD value cell, without repeating its
145
- metric label. Remove extra explanatory prose while retaining necessary coverage limits.
146
-
147
- Source fields remain unchanged in JSON. CSV exports prefix spreadsheet-sensitive
148
- text with an apostrophe so opening a report does not execute merchant names or
149
- labels as formulas; numeric metrics remain numeric.
150
-
151
- Treat internal authorization counters together with `layer_observed.auth`: a zero
152
- observation count with that flag false is not confirmed zero business activity.
153
- The report and business CSV cells remain blank in that case. Distinguish observed
154
- dispute snapshots from deduplicated case-stage counts and verified opening counts;
155
- they answer different questions and need not match. Formatting-only aliases of a
156
- verified provider are duplicates, not new snapshots. Sales or refunds without
157
- stable event identity remain observations, not confirmed monetary totals.
158
-
159
- The report is an extract-based operational view. The v1 CLI refuses generation if
160
- any authorization or settlement identity has conflicting values; resolve those
161
- sources before rerunning. This conservative refusal can block clean periods too.
162
- It never substitutes totals from an unlabeled clean subset. An absent layer or a
163
- window without observed settlement/dispute rows produces unavailable metrics, not
164
- confirmed zero activity. Dispute rows remain observed
165
- snapshots until opening semantics are verified. The CLI computes supported
166
- network-style extract estimates, not official network assessments; unsupported rate
167
- cells stay blank. Merchant-scoped settlement and join evidence must not imply that all
168
- current-period sales descend from current-period approvals. Review the saved
169
- `presentation.json` as the narrative source, then rerender both formats. Preserve
170
- raw customer data in the input project; use synthetic fixtures for repository tests.
58
+ Outputs: `overview.zh.html`, `overview.zh.md`, reviewed `presentation.json`, `facts.json`
59
+ and merchant CSV/JSON reconciliation evidence. HTML embeds ECharts, all aggregate data
60
+ and third-party notices; it works offline without React or a CDN. Calculations stay in
61
+ facts, presentation owns narrative, rendering does not recompute payments.
62
+
63
+ `--detail-merchant ID` selects the initial merchant tab; all merchants remain accessible.
64
+ `--exclude-merchant ID` removes an explicitly excluded historical merchant from report and
65
+ business exports; repeat either flag as needed. State an exclusion once, not as a closure
66
+ finding. `--fx-rates` accepts daily USD rates only with preserved Forex Service provenance;
67
+ the CLI cannot certify caller-supplied provenance.
68
+
69
+ For selected Parquet snapshots, retain their source-selection accounting. Recover missing
70
+ source fields only through verified file hashes and source row references, with row-count
71
+ reconciliation. Do not rerun raw overlapping exports as a second payment population or
72
+ infer merchant identity from descriptors. The CSV CLI does not directly read Parquet.
73
+
74
+ ## Presentation contract
75
+
76
+ Use only `1. 子商户对比` and `3. 重点子商户详情`, with merchant findings above them.
77
+ The first table includes daily authorization-attempt count sparklines and actual approved
78
+ authorization USD amounts, not sales. Every merchant gets a tab; the tab starts with up
79
+ to eight observed calendar weeks of amount bars and count lines. Country and card-product
80
+ charts show approval rate plus approvals/attempts only. Country drilldown selects its
81
+ Top 5 banks using positive **current-period** attempts, keeps prior-period values for
82
+ those same banks and retains undefined rates as gaps. Other comparison dimensions keep
83
+ the paired-chart layouts in the reporting reference.
84
+
85
+ All five risk histories show count bars and rate lines simultaneously. VAMP is an explicitly
86
+ labeled extract estimate from Visa TC40 plus already-opened formal disputes over same-month
87
+ merchant Visa sales; pending/response/loss/reversal status does not remove a formal case.
88
+ Official network assessment remains distinct. No portfolio funnel, totals chapter, weekly
89
+ summary chapter, action chapter, coverage chapter, chart detail expansion or VAMP component
90
+ table is rendered; supporting evidence remains available in files.
@@ -1,170 +1,37 @@
1
- # Metrics and report
2
-
3
- ## Calculation and coverage
4
-
5
- Use the installed `payment-analysis` references for formulas, FX, disputes and
6
- terminology. For each merchant rate, show the merchant-specific numerator,
7
- denominator, population and dates. A zero denominator is undefined. A known zero
8
- requires coverage of the relevant period and population; missing layers, unverified
9
- identity, conflicts and missing historical coverage are not zeros. Show small samples
10
- with raw counts and a caveat. Do not rank unavailable rates.
11
-
12
- Keep authorization, settlement, refund and dispute measures separate. Approval is
13
- not settlement. Scope countries, decline reasons, authentication, settlement and
14
- disputes to the merchant and the relevant event population. Do not imply that all
15
- sales in a period descend from approvals in that period. Dispute snapshots are not
16
- necessarily new openings; apply the base dispute rules and disclose unverified stage,
17
- opening and coverage. Missing FX leaves affected USD amounts unresolved rather than
18
- creating mixed-currency totals. Apply the verified 340FRD and dispute history contract
19
- in [risk history](risk-history.md); do not use those observations as VAMP inputs.
20
-
21
- For an explicitly requested merchant-specific period comparison, state each date
22
- range, actual duration, cutoff and coverage. Prior-month endpoints may clamp to the
23
- month's last day, changing duration. Do not infer a merchant's onboarding or departure
24
- from observation in only one period. An extract-based comparison is not proof of
25
- complete coverage or causation. Portfolio totals may support internal reconciliation,
26
- including the unknown bucket, but are not report content.
27
-
28
- ## Weekly submerchant comparison
29
-
30
- Include every Monday–Sunday calendar week intersecting the effective report period
31
- for every submerchant, including weeks with no observed events. Preserve the full
32
- calendar boundaries and the included date range. Mark edge weeks shorter than seven
33
- days as partial; never silently compare a partial week with a full week.
34
-
35
- Show per-merchant weekly attempts, approvals, approval rate, successful authorization
36
- amount USD, sales USD, refunds and observed dispute records. Successful authorization
37
- amount sums `Transaction amount` only where `Response type` is approval, using the
38
- authorization date and daily USD rates from the base FX contract. Never substitute
39
- settlement amount. Missing approved amounts, currencies or rates make the affected
40
- sum unavailable; no auth observations also yield an unavailable sum. Observed auths with no approvals have
41
- an observed approved amount of zero. Keep the merchant's numerator and denominator together.
42
- Use authorization time, settlement date and dispute date consistently with the base
43
- metrics. Missing layer observations or FX make affected measures unavailable, not
44
- zero growth or confirmed zero activity.
45
-
46
- Week-over-week changes use only the immediately preceding calendar week. Both weeks
47
- must be full seven-day bins. Compare only measures whose layer has observations in
48
- both weeks; relative changes additionally require a positive previous denominator.
49
- Attempt and sales changes are `(current / previous) - 1`; approval-rate changes are
50
- `100 * (current rate - previous rate)` percentage points. Do not average merchants,
51
- bridge a missing week, infer onboarding from a first observation, or report portfolio
52
- trends. A full calendar week does not prove continuous export coverage: all changes
53
- remain descriptive comparisons of the supplied observations.
54
-
55
- ## Merchant detail breakdowns
56
-
57
- Section 3 provides the same breakdown suite for every merchant, comparing only this
58
- week with last week. This week is the Monday-based week containing the effective
59
- cutoff; compare the included weekdays with the same weekdays seven days earlier.
60
- For example, a Friday cutoff compares Monday–Friday with the preceding Monday–Friday,
61
- not a five-day period with a seven-day period. Restrict both populations to the
62
- requested main-period source scope and disclose unavailable earlier observations.
63
- Show the exact two date ranges in every chart legend and supporting table. Section 2
64
- continues to own the full weekly history; no main-period-total or older-week columns
65
- belong in section 3.
66
-
67
- Charts are the primary presentation, with these fixed layouts:
68
-
69
- - BIN country and card product: compact paired bar charts; two differently colored
70
- bars per category compare the weeks for every metric, including rates.
71
- - Amount buckets: two histograms side by side, one color per week, using the same
72
- six bins and y-axis scale. Default to count; counts and USD weights can be selected,
73
- but not approval-rate/share metrics. The unequal/open-ended amount bands are shown
74
- as equal-width categories, explicitly labeled as binned values rather than density.
75
- Unknown amounts are listed separately, never drawn as a numeric interval.
76
- - Unsuccessful response reasons: two bar charts side by side, one color per week,
77
- with identical category order and scale. Do not re-rank or rescale each week.
78
- - Authentication: paired pies for the aligned weeks, with count and USD selectors
79
- only. If any category value is unavailable or negative, do not draw that period's
80
- pie from an incomplete sum. Keep the supporting cells blank.
81
-
82
- Do not include settlement sales/refund charts in section 3. Sections 1 and 2 still
83
- retain their settlement metrics. A metric selector switches supported measures,
84
- including successful authorization amount USD where applicable. Render unavailable cells
85
- blank and chart values as gaps, not zeros. Do not repeat a metric label in a cell whose
86
- column header already names that measure: use `USD 33...`, not `授权成功金额 USD 33...`.
87
- A packed week cell that also shows attempts and a rate must say `授权成功 USD`, because the
88
- report also shows settled sales. Use the shared
89
- `comparison_charts.py` for all report charts. Expandable supporting tables keep metrics as rows and the two periods
90
- as columns. HTML is self-contained with no external chart service; Markdown retains
91
- the supporting values.
92
- Derive groupings only from the merchant's authorized attempts in those two periods;
93
- do not join settlement amounts into authorization groups.
94
-
95
- - BIN country: `Issuing bank country`; keep the merchant's top ten by attempts across
96
- the two comparison periods, `Other` for the rest, and a separate unknown group.
97
- - Card product: `Payment method` × `Card type`, following payment-analysis. Preserve
98
- every observed combination and unknown components.
99
- - Amount bucket: use each attempt's `Transaction amount` converted to USD by its
100
- authorization date. Fixed half-open ranges are `[0,25)`, `[25,50)`, `[50,100)`,
101
- `[100,200)`, `[200,500)`, `[500,+inf)`. Missing, nonfinite, negative or unconvertible
102
- amounts belong to unknown; never silently put them into the zero bucket.
103
- - Authentication: every observed `Authentication method` value, with unknown separate.
104
- - Unsuccessful response: code × message among non-approvals only. Keep the merchant's
105
- top ten reasons across the two comparison periods, Other and unknown. The share denominator is
106
- that merchant's non-approvals, not all attempts. Unknown responses are not confirmed
107
- issuer declines or fraud.
108
-
109
- Freeze group membership from the union of the two comparison periods before calculating each.
110
- Never re-rank each period independently. Synthetic Other/unknown have distinct keys and display
111
- labels from literal source strings with those names. For all-attempt groups show
112
- count, share of merchant attempts, approvals, rate, attempt amount USD and approved
113
- amount USD. For non-approval reasons show count, share of merchant non-approvals and
114
- unsuccessful amount USD. Group counts and amounts reconcile to the corresponding
115
- merchant population; a zero denominator is unavailable, not zero percent.
116
-
117
- Missing merchant-week observations remain blank. A group absent from an observed
118
- merchant-week may have zero observed counts, but no approval rate when its count is
119
- zero. Missing amount or FX invalidates the affected amount sum, not the count.
120
- Export the two-period group values in `merchant-detail-comparison.csv` for review.
121
- Add per-merchant dispute and fraud history and monthly VAMP charts using the periods,
122
- series and availability rules in [risk history](risk-history.md). Use 340FRD file
123
- generation dates as report dates. Monthly charts switch between counts and rates;
124
- rate tables and `merchant-risk-history.csv` expose numerator, denominator and its
125
- month. Keep weekly counts without inventing a weekly monitoring rate. Mastercard
126
- EFM rates use fraud chargebacks, not the 340FRD count series. These are not
127
- authorization-cohort metrics. Settlement sales/refunds are omitted from section 3.
128
-
129
- ## Chinese report structure
130
-
131
- Use this template for editorial review in place of the base report's chapter order
132
- and Sankey. Do not add portfolio summary, trends, change decomposition, funnel or
133
- overall dispute chapters.
134
-
135
- - Scope header: title, period, effective cutoff, sources and timezone/coverage caveats;
136
- include a comparison period only when a merchant comparison across periods is requested.
137
- - 商户要点: merchant-specific findings with counts, denominators and date basis. The lowest authorization rate chooses an authorization review, not the investigation order. If fraud or predispute history would change who is checked first, name that merchant and month here, and say whether the month is inside the report window. A user-excluded historical merchant appears once as an exclusion, not as a finding, and is absent from the tables.
138
- - 1. 子商户比较: stable IDs and display labels, merchant-level attempts, approvals,
139
- rates, settlement, refunds and observed disputes where supported. Keep small samples
140
- visible and unavailable values distinct from zero.
141
- - 2. 子商户逐周对比: a merchant-by-week matrix of approvals/attempts and rates,
142
- followed by per-merchant tables with date/week columns horizontally and metrics
143
- vertically, including successful authorization amount USD as a separate row from
144
- settled sales. Preserve the same orientation for selected and collapsed merchants.
145
- Keep all merchants reachable; default detail selections may be expanded while other
146
- merchant weekly tables are collapsed. Explain partial weeks and unavailable changes.
147
- - 3. 重点子商户: the full merchant breakdown suite above, using interactive this-week
148
- versus last-week charts and two-period supporting tables. No report-period total
149
- or older weeks in the two-week comparisons. Risk history uses its own longer windows.
150
- Priority merchants are expanded, and all other merchants remain accessible in
151
- collapsed sections, including when merchants are explicitly selected. Default priority means the largest by attempts and
152
- the lowest authorization rate among merchants with at least 30 attempts; this is
153
- a navigation rule, not a significance test. Keep source limitations beside the
154
- affected merchant and show group denominator definitions once. Remove extra explanatory
155
- prose; keep only limitations needed to interpret the evidence.
156
- - 4. 商户行动表: identify the merchant, evidence and next investigation for each row;
157
- distinguish hypotheses from facts. Include supported historical refund and dispute
158
- follow-ups for the relevant merchant, not portfolio history.
159
- - 5. 归因与覆盖: sources, identity, deduplication, conflicts, unknowns, join coverage,
160
- FX and unresolved attribution limits. Link supporting CSV/JSON reconciliation
161
- evidence without presenting aggregate totals in the report or exposing cardholder data.
162
-
163
- ## Done when
164
-
165
- A reader can identify which merchants to investigate and why, including a stated historical exclusion; each rate identifies
166
- its merchant, population and period; unsupported data is not presented as zero; and
167
- merchant attribution does not cross identity boundaries. Internal reconciliation
168
- accounts for unknowns and conflicts without advertising aggregate fields as deliverables.
169
- The Markdown and HTML use the same reviewed narrative and separate verified findings
170
- from operational hypotheses.
1
+ # Merchant report layout and interaction
2
+
3
+ Use this template in `write-report` and editorial review. Internal calculations may retain weekly tables, reconciliation and actions; the reader-facing report has only the two sections below. User instructions can override presentation without changing event identity or arithmetic.
4
+
5
+ ## 1. 子商户对比
6
+
7
+ Show every verified merchant, including historical merchants with no current observations, unless explicitly excluded. Keep unverified/unknown identities in reconciliation evidence, not as merchant rows or tabs. Columns: merchant, stable merchant ID, authorization attempts, approvals, approval rate, daily attempt-count sparkline, approved authorization amount USD, refund count, refund amount USD and dispute observation count (display label `争议笔数`). The dispute column remains an observation metric, not an official opening count. Explain that distinction beside the report's scope when material.
8
+
9
+ Amounts in the approved column use approved authorization attempts and authorization-date daily USD conversion. Never substitute settled sales. Missing authorization observations leave count/rate/amount cells blank; observed attempts with no approvals have zero approved amount and a zero approval rate. Zero attempts have an undefined rate.
10
+
11
+ Sparklines show daily authorization attempt counts for the two detail periods, not approval rates. Use a common zero-based scale across merchants. Preserve absent days as gaps and never connect across them. Tooltip shows the date and count. No merchant-search control or sample-note column.
12
+
13
+ ## 3. 重点子商户详情
14
+
15
+ One tab per merchant; all merchants are reachable. Detail selection controls the initial tab only, not which merchants are present. Keep tab focus and arrow/Home/End keyboard navigation, resize charts after a hidden tab becomes visible, and print all tabs.
16
+
17
+ At each tab's top, show the latest eight Monday–Sunday calendar weeks ending at the authorization cutoff (the earlier of requested end and last observed authorization date). Draw only weeks containing that merchant's observed authorization attempts; fewer observed weeks produce fewer categories. Count is a line on the right axis; attempt amount USD is a bar on the left axis. Calculate with the same daily FX rules. Missing FX leaves amount unavailable while counts remain visible. A merchant with no observations has an explicit empty state.
18
+
19
+ Below that, compare the week containing the authorization cutoff with the same weekdays one week earlier, even when the earlier period lies outside the main report start. Read those authorized historical source rows instead of creating false prior-period blanks. Preserve both period placeholders when observations are absent. Main comparison-table and risk-history dates use the common cutoff; authorization sparklines, details and eight-week trends use the independent authorization cutoff. A settlement cutoff must not truncate available weekend authorization records. State both cutoffs. Calculate groups across the union of both periods.
20
+
21
+ - BIN country: top ten by two-period attempts, Other and unknown separate. Display only approval rate with `approvals/attempts` labels. Clicking a real country expands/collapses its top five issuing banks inline; rank banks by **current-period** attempts descending, ties by bank name. Include only banks with positive current attempts. Compare the same selected banks against the previous period. Unknown bank labels remain explicit; do not merge similarly spelled issuers without a verified dictionary. Other is an aggregate, not a country. Keep denominator and missing-data rules for bank rows; unknown current/previous observations are gaps, while attempts with zero approvals have a genuine 0%.
22
+ - Card product: payment method × card type. Approval rate only, with approvals/attempts labels and no metric selector.
23
+ - Amount buckets: `[0,25)`, `[25,50)`, `[50,100)`, `[100,200)`, `[200,500)`, `[500,+inf)` USD; two histograms with shared ranges/scales. Unknown or unconvertible amounts remain separate.
24
+ - Authentication: paired pies for counts or amounts; an incomplete amount sum leaves that period's pie unavailable.
25
+ - Non-approval reasons: code × message, top ten across both periods, Other and unknown separate; two side-by-side bar panels. Shares use that merchant's non-approvals.
26
+
27
+ No weekly summary table, action-list chapter, coverage chapter, per-tab two-week summary table, daily-record expansion, chart-data expansion or VAMP component table appears in the business report. Keep calculation details and reconciliation in linked supporting artifacts. Necessary date, denominator and estimate limitations stay near the affected plot.
28
+
29
+ ## Risk charts
30
+
31
+ Every merchant has five simultaneous dual-axis charts: monthly and weekly disputes, monthly and weekly fraud, and monthly VAMP extract estimate. Counts are bars on the left; rates are lines on the right. No count/rate toggle. Keep twelve month positions and eight week positions; gaps remain gaps. Refer to [risk-history.md](risk-history.md) for numerator/denominator semantics.
32
+
33
+ ECharts is bundled locally and embedded with its license/NOTICE into a single HTML. No CDN or runtime data fetch. Hover/touch tooltips show period, full series label, count, ratio and numerator/denominator where available. Legends can toggle series. Preserve responsive horizontal scrolling for dense charts and resize only when containers change; do not reset chart options on every hover. Use SVG rendering for portable printing.
34
+
35
+ ## Verification
36
+
37
+ Reconcile merchant/group counts and approved amounts to their source populations. Verify all chart series against `presentation.json`; inspect real rendered scales, dual-axis units, count/rate tooltips, undefined rates, missing FX, empty history, tab switching, current-week issuer ranking and expand/collapse. Exercise the saved HTML with network disabled and verify zero external requests. Only synthetic fixtures belong in the skill repository.
@@ -4,7 +4,11 @@ Use the common effective cutoff. Retain 12 calendar months and eight Monday–Su
4
4
  weeks, with missing periods blank and the final period partial where applicable.
5
5
  Every merchant has dispute and fraud counts. Monthly charts also offer a rate view,
6
6
  with numerator, denominator and denominator month in the expandable table and CSV.
7
- Weekly charts show counts: do not invent a weekly card-network monitoring formula.
7
+ Weekly charts include descriptive same-week rates: observed numerator divided by
8
+ same-merchant, same-brand settled sales by transaction/capture date in that week.
9
+ These are not weekly network monitoring rates. Missing numerator/denominator is a gap;
10
+ zero denominators are undefined. Monthly programme-aligned rate definitions below
11
+ remain separate from these descriptive weekly rates.
8
12
  All charts use `comparison_charts.py`; nulls are gaps, never fabricated zeros.
9
13
 
10
14
  ## 340FRD reporting date and attribution
@@ -35,10 +39,12 @@ incidence. RDR and formal escalation can each appear in their respective series.
35
39
  Conflicting identities/brands are quarantined; unknown stages remain unresolved.
36
40
 
37
41
  A monitoring-style chargeback numerator needs an opening and its received date.
38
- `First CB Request` with `1st chargeback` is the adapter's supported opening pair.
39
- Response-, loss- or reversal-only cases cannot be promoted to openings. Preserve
40
- observed counts while leaving affected rate cells blank. Keep independently supported
41
- merchant/brand/month cells computable.
42
+ `First CB Request` establishes an explicit received opening date. Response-, loss- and
43
+ reversal-stage records also establish that a formal dispute already opened: count that
44
+ case once regardless of whether it is pending or resolved. When the original request is
45
+ absent, extract estimates use the earliest supplied formal-stage observation date and
46
+ state that this is not a verified network processing month. RDR-only cases are excluded.
47
+ Conflicting merchant, provider or brand identities remain quarantined.
42
48
 
43
49
  ## Monthly count-rate formulas
44
50
 
@@ -70,16 +76,27 @@ each rate. Do not infer continuous coverage from min/max event dates.
70
76
 
71
77
  ## VAMP
72
78
 
73
- The file-generation-date reporting convention resolves the fraud report-date choice.
74
- Do not continue to list that choice as missing. It does not establish TC40 event
75
- identity, TC15/TC05 processing dates, corrections, CE3.0/pre-dispute exclusions,
76
- VisaNet CNP eligibility, completeness or descriptor/acquirer/market grouping.
77
- Keep official VAMP unavailable until the remaining inputs are verified.
78
-
79
- VAMP is eligible TC40 fraud plus TC15 disputes divided by TC05 settled transactions
80
- for the same reporting month. Do not deduplicate across TC40 and TC15. RDR does not
81
- automatically erase a related TC40. Do not manufacture VAMP by adding the observed
82
- count series or the descriptive pre-dispute rate.
79
+ The Visa portion of DART-340 is TC40. Use its file-generation reporting month and
80
+ existing exact-repeat handling; Mastercard DART records are not Visa TC40.
81
+
82
+ Display **VAMP(导出估算)** as `(attributable Visa TC40 records + opened formal
83
+ Visa disputes) / same-merchant same-month Visa settled Sale count`. Formal dispute
84
+ status need not be resolved: count an opened case once, including response, loss or
85
+ reversal records. Exclude RDR-only cases from the formal dispute numerator; RDR does
86
+ not automatically erase related TC40. Do not deduplicate across TC40 and TC15.
87
+
88
+ Use the earliest supplied formal-stage date when the original request is absent.
89
+ The sales denominator uses the existing transaction/capture-month evidence. Expose
90
+ these date choices beside the plot and in supporting evidence. These are extract
91
+ estimates, not certification of TC15/TC05 processing months, corrections, CE3.0 or
92
+ other exclusions, VisaNet CNP eligibility, complete scope, or descriptor/acquirer/
93
+ market grouping. Official network VAMP remains unavailable until those are verified.
94
+
95
+ Draw VAMP numerator counts as left-axis bars and the estimate as a right-axis line.
96
+ Keep all twelve months. Missing either numerator component or a positive denominator
97
+ leaves the ratio blank; never replace absent TC40 with zero. Genuine zero ratios may
98
+ be retained in supporting records while omitted as plotted rate points. Every plotted
99
+ ratio has an explicit numerator, denominator and denominator period.
83
100
 
84
101
  ## Sources
85
102