Article body
Full article
“What was last month’s gross margin?” sounds simple, but the answer requires clear definitions of revenue and cost, refund treatment, period allocation, and the user’s data scope. A query may execute successfully while answering a question based on a different definition.
HENGSHI connects natural language to enterprise data through a metrics semantic layer, organizing AI analytics around reusable business definitions. This is the starting point for understanding NL2Metrics: prepare business semantics first, then let the Agent identify the question, choose objects, and call analytical tools. HENGSHI brings metric governance, HQL expressions, natural-language interaction, and visual applications together.

1. Turn Business Questions into Reusable Metrics
A business metric must specify what is calculated and under which conditions. For gross margin, business teams should confirm how revenue, costs, taxes, and refunds are treated, along with the period, currency, and reporting granularity. If departments use different definitions, name and document them separately rather than leaving the model to choose during a query.
HENGSHI uses HQL to express business calculations and connect metric logic with underlying data storage and computation. The metrics platform supports organizing, enabling, disabling, and authorizing metrics by business topic. Data teams maintain the datasets and descriptions; business users consume these assets through metric analysis or natural-language entry points.
Centralized metrics provide an explicit place to change definitions and a shared basis for queries and dashboards. Reconciliation still requires the same metric, period, filters, data batch, and access identity. A difference in any of these can change the result.
2. NL2Metrics Organizes Model Work Around Business Objects
Within HENGSHI’s analytics system, a query can be understood through the following relationships. This describes how capabilities relate, not a fixed internal sequence every request must follow:
- Clarify the question: Use the request and current page to identify metrics, dimensions, time, and organizational scope; obtain clarification where needed.
- Locate resources: Find relevant objects among authorized datasets, business topics, and applications, using names, descriptions, and business knowledge to interpret terminology.
- Organize and execute the query: Calculate through the platform’s analytical objects and tools. Data Agent can also assist with HQL expressions and metric creation.
- Review the results: Check whether the actual data, filters, and calculations match the question. Query success does not establish a correct business answer.
- Develop deliverables: Generate charts or create and edit dashboards through the appropriate product entry points, adding analytical notes that can be reviewed.
NL2Metrics emphasizes governed business semantics. It does not mean the system never uses SQL or that the model merely matches existing names. Underlying data access and queries may still involve SQL. HENGSHI helps business analytics use confirmed data and metric assets without requiring every rule to be explained again for each question.
3. Reuse Semantics Across Queries, Dashboards, and Integrations
Metric owners maintain shared definitions. Business users can use them in metric analysis and dashboards, then ask natural-language questions about related changes. Data Agent’s metric authoring and visualization assistance also help analysts turn exploration into maintainable analytical assets.
HENGSHI provides integration options including iframes, a JS SDK, and APIs, bringing analytics into existing enterprise systems. Each delivery should specify the identity used, resources exposed, responsibility for presenting results, and where assets are saved. An integration method alone does not guarantee shared session state or automatically shared permissions across entry points.
Existing metrics, datasets, and business knowledge remain reusable after a model change. Teams must still validate the new model’s tool calls, semantic interpretation, expression generation, and error handling. Reusable assets do not make model replacement free of cost or integration work.
4. The System Must Enforce Permissions
Business semantics determine how to calculate; data permissions determine who can see what. Both require implementation. HENGSHI provides business-topic authorization, data-package and dataset authorization, and row and column permissions. Effective rules also depend on the application’s data permission mode.
Projects should verify accounts, tenants, resources, and data scope along real usage paths. For a regional manager’s business queries, check both visible topics and row permissions on the corresponding data. Embedded applications also require verification of authentication identity and application permission configuration. A prompt saying “do not exceed permissions” does not implement access control.
Query timeouts, result size, database load, exports, and logs should be governed according to platform configuration, data-source capabilities, and deployment requirements. Specific quotas, circuit breakers, or audit granularity depend on the version and project configuration. Avoid inventing universal scanned-row limits or promising complete auditing of every operation.
5. Compare NL2SQL and Semantic-Layer Approaches Fairly
| Evaluation dimension | NL2SQL practice | Metric-centered practice |
|---|---|---|
| Business definitions | Supply business knowledge and calculation rules; metric definitions may also be incorporated | Maintain frequently used definitions centrally as reusable metrics |
| Implementation and maintenance | Maintain data structures, query context, and validation methods | Build metrics and knowledge, and check the impact of changes |
| Access control | May combine read-only accounts, database permissions, and query validation | Requires topic, data, and application permission configuration |
| Acceptance testing | Use real questions to verify queries, results, and handling of unauthorized requests | Reconcile under the same conditions to verify metrics, scope, and reuse across entry points |
Reading note: The two approaches can be combined. Compare execution, maintenance, and governance in practice; the approach’s name alone does not establish security or accuracy.
When evaluating systems, use the same set of questions: defined metrics, ambiguous metrics, multi-table analysis, unauthorized data, and retesting after a definition change. Checking answer sources, calculation conditions, refusal behavior, and maintenance methods is more informative than a universal accuracy rate without a test set or statistical method.
6. An Implementation Example for Group Sales Analysis
The following is a hypothetical solution example, not a real customer case or measured outcome. A group wants headquarters, regions, and stores to analyze net sales. Finance first confirms refund treatment and period allocation. The data team maintains the metrics and business topics, then configures visible scope by organizational role.
A regional manager asks, “Compare this month’s net sales by store,” and the Agent queries within the corresponding authorized scope. Headquarters uses the same metric for group analysis, and analysts place reviewed charts into business dashboards. The two roles may see different data ranges while sharing the same calculation rules.
If finance changes the period allocation of refunds, the team updates definitions, related knowledge, and reconciliation samples, and checks affected dashboards and questions. The value is a maintainable metric object, a controlled consumption scope, and a path from natural-language exploration to analytical applications.
HENGSHI’s NL2Metrics approach brings metric development, AI queries, and analytical delivery together for business use. Maintaining key definitions first, then validating with real questions and real roles, lets enterprises expand AI analytics while continuing to reuse their data governance and application investments.