The content of the invention
Based on this, it is necessary to for above-mentioned technical problem, there is provided a kind of utilization and calculating that can be improved to basic data
Flexibility calculating method and device.
A kind of calculating method, methods described include:
Pending actuarial task is obtained, the actuarial task includes language file and index to be output;
Obtain the basic data that there are mapping relations with the language file;
The basic data is calculated according to the arithmetic logic defined in the language file;
Generation report data corresponding with the index.
In one of the embodiments, methods described also includes:
Obtain initial data;
Data cleansing is carried out to the initial data, generates basic data.
In one of the embodiments, before the step of acquisition pending actuarial task, in addition to:
The generation request of actuarial task is obtained, the actuarial task generation request includes actuarial model;
Obtain the DSL files defined in the actuarial model;
Information in the DSL files is verified, after verification passes through, generates language file;
Index to be output is obtained, actuarial task is generated according to the language file and the index to be output.
In one of the embodiments, the arithmetic logic according to defined in the language file is to the basic data
The step of being calculated, including:
Whether in the language file include rely on label, if so, then if detecting
Read the file identification in the dependence label;
Obtain and language file is relied on corresponding to the file identification and there are mapping relations with the dependence language file
Basic data;
It is right according to the arithmetic logic defined in the language file, the arithmetic logic relied on defined in language file
The basic data is calculated.
In one of the embodiments, after the step of generation report data corresponding with the index, also wrap
Include:
Form displaying figure is generated according to the report data.
A kind of actuarial device, described device include:
Actuarial task acquisition module, for obtaining pending actuarial task, the actuarial task includes language file
With index to be output;Obtain the basic data that there are mapping relations with the language file;
Computing module, for being calculated according to the arithmetic logic defined in the language file the basic data;
Report data generation module, for generating report data corresponding with the index.
In one of the embodiments, described device also includes:
Basic data processing module, for obtaining initial data;Data cleansing, generation basis are carried out to the initial data
Data.
In one of the embodiments, described device also includes:
Actuarial task generation module, for obtaining the generation request of actuarial task, the actuarial task generation request includes
Actuarial model;Obtain the DSL files defined in the actuarial model;Information in the DSL files is verified, in school
Test by rear, generation language file;Index to be output is obtained, is generated according to the language file and the index to be output
Actuarial task.
In one of the embodiments, whether the computing module is additionally operable to detect in the language file includes relying on mark
Label, if so, then reading the file identification in the dependence label;Obtain rely on corresponding to the file identification language file and with
The language file that relies on has the basic data of mapping relations;According to the arithmetic logic defined in the language file, described
The arithmetic logic defined in language file is relied on, the basic data is calculated.
In one of the embodiments, described device also includes:
Display module, for generating form displaying figure according to the report data.
Above-mentioned calculating method and device, by there is provided language file and index to be output, and there is provided language text
The mapping relations of part and basic data, the basic data mapped is counted according to the arithmetic logic defined in language file
Calculate, generate report data corresponding with the index.The calculating of actuarial is carried out by setting language file, the effect of calculating can be improved
Rate.By setting the mapping relations of language file and basic data, the flexibility of actuarial can be also improved.
Embodiment
In order to make the purpose , technical scheme and advantage of the present invention be clearer, it is right below in conjunction with drawings and Examples
The present invention is further elaborated.It should be appreciated that specific embodiment described herein is only to explain the present invention, not
For limiting the present invention.
The calculating method that the embodiment of the present invention is provided, it can be applied in application environment as shown in Figure 1.It is whole with reference to figure 1
End 110 can be connected by corresponding network with server 120, and pending actuarial task, actuarial are sent to the server 120
Task includes language file.Server can obtain the actuarial task pair of the Agency after pending actuarial task is received
The language file answered, according to the Data Identification defined in the language file, arithmetic logic and index to be output, generation is with being somebody's turn to do
Report data corresponding to index.
In one embodiment, server 120 includes data processing server 121, the and of actuarial model design server 122
Actuarial engine server 123.Data processing server 121 is used to obtain and store the data related to actuarial business, to being deposited
The data of storage are cleaned.The data can be to be interacted with the terminal that data manipulation person uses, and generate or receive by the terminal
The data of upload.Actuarial model design server 122 is used to provide UI interfaces (User Interface.User interface) give actuarial
Business personnel defines actuarial model.(domain-specific languages, field are special by one or more DSL for actuarial model
Attribute is sayed) file combines, is stored in DSL storehouses, finally inputted to actuarial engine server 123.Actuarial model designs
Server 122 is additionally operable to the definition to actuarial model, and is closed to establishing mapping between defined actuarial model and basic data
System.Actuarial engine server 123 be used for from actuarial model design server 122 obtain defined in DSL files, and according to from
The basic data that there are mapping relations with the DSL files is obtained in data processing server 121, according to described in the DSL files
Information the basic data is handled, generate actuarial result.The actuarial result can be corresponding report data.
Fig. 2 is the internal structure schematic diagram of server in one embodiment.The server includes connecting by system bus
Processor, non-volatile memory medium, built-in storage and network interface.Wherein, the non-volatile memory medium of the server
It is stored with operating system, database and actuarial device.Basic data, DSL files and language file etc. are stored with database
Data.The actuarial device is used to realize a kind of calculating method.The processor of the server is used to provide calculating and control ability, branch
Support the operation of whole server.The built-in storage of the server provides for the operation of the actuarial device in non-volatile memory medium
Environment, computer-readable instruction can be stored with the built-in storage, can when the computer instruction readable instruction is executed by processor
A kind of so that calculating method of computing device.The network interface of the server is used for the user terminal with outside and examination & verification according to this
Terminal is communicated by network connection.Server can with independent server either multiple server groups into server cluster
To realize.
It will be understood by those skilled in the art that the structure shown in Fig. 2, the only part related to application scheme knot
The block diagram of structure, does not form the restriction for the server being applied thereon to application scheme, and specific server can include
Than more or less parts shown in figure, either combine some parts or arranged with different parts.
Fig. 3 is the schematic flow sheet of calculating method in one embodiment.The present embodiment is applied to shown in Fig. 2 in this way
Server illustrates.Reference picture 3, the calculating method specifically comprise the following steps:
Step S302, obtains pending actuarial task, and actuarial task includes language file and index to be output.
In the present embodiment, pending actuarial task can be pre-arranged in specified path, and server can periodically be gone
Inquire about and whether there is actuarial task in the path, can be according to each actuarial task when multiple pending actuarial tasks be present
The generation time, one or more factors such as processing priority, obtain the generation time earliest and/or the actuarial of processing priority appointed
Business.Wherein, each actuarial task is provided with state tag, and the processing that would know that the actuarial task according to the state tag is entered
Exhibition, processing progress include pending, processing neutralisation treatment completion etc..
Actuarial task includes language file and index to be output.Language file and index can be one or more.
Wherein, index definable to be output is in language file, the index that can be also uploaded by terminal.Index refers to specifically need essence
Some data obtained needed for calculation, an index, which may need to rely on one or more language files, is calculated final result.
Language file is the intermediate language file that server is understood that and performed.Language file can be XML (Extensible
Markup Language, extensible markup language), JSON (JavaScript Object Notation), PB (Protocol
Any one or more default language file such as Buffers), a language file describe one and minimum reusable patrolled
Collect encapsulation.Language file can be generated by DSL files corresponding conversion, or directly write and formed by developer.Adopted in DSL files
DSL language is the linguistic norm that service-user defines, and a DSL files may be compiled according to the difference of DSL compilers
More parts of language files are translated into, for example are compiled into XML intermediate language files.
In one embodiment, server can in be provided with task queue, the actuarial task is storable in corresponding task
In queue.Server timing or according to whether there is pending actuarial task, and root in certain frequency detecting task queue
According to default scheduling strategy, one or more of actuarial tasks are obtained, acquired actuarial task is distributed to thread pool
In, the thread in idle condition, and carry out actuarial calculation process.Wherein, scheduling strategy include serial scheduling, Parallel Scheduling or
Serial parallel mixed scheduling.Multiple thread pools are provided with server, each thread pool can be at idle or operation fair state.
Specifically, the task scheduling modules (Dispatcher) in actuarial engine server obtain task, root from queue
Thread pool idle thread is distributed to according to scheduling strategy.
Step S304, obtain the basic data that there are mapping relations with language file.
In the present embodiment, mapping relations are provided between language file and one or more basic datas so that according to this
Mapping relations can get corresponding basic data.The basic data is storable in server context (context) container,
And stored in the form of tables of data.The context container is located in data processing server, actuarial model design server
Demapping instruction according to transmitted by terminal, establish the mapping relations between each language file and base data table.Specifically,
Parsing module (Resolver) in server is unpacked the actuarial task, receives wherein language file, and is mapped as " performing
Unit " memory model.The motor unit that execution unit (IExecutable) can run for engine is abstracted, and execution unit can
Specific basic data is called to be calculated.
Further, the basic data can be divided into region basic data and national basic data.Such as the basic number
According to for demographic data, and it is nationwide population that each endemic demographic data and synthesis can be divided into according to region
According to.The annual newborn population quantity, size of population at each age and/or age bracket, every can be further comprised in demographic data
The birth rate in year, comprehensive fertility-rate etc..
Step S306, basic data is calculated according to the arithmetic logic defined in language file.
Corresponding arithmetic logic and the operational parameter needed to use defined in language file, the operational parameter can be base
The data of some or multiple specific data, a certain kind or a variety of field types in plinth data.Server can be from basic number
Corresponding data are obtained according to middle, are calculated according to the arithmetic logic defined in the language file.
Specifically, actuarial engine server, which can parse, whether there is default keyword in the language file, the pass is obtained
Operational parameter defined in key word, and inquired about from the base data table mapped and obtain number corresponding with the operational parameter
According to.The one or more therein such as operational parameter, arithmetic logic can be defined in keyword respectively.
For example, following one section of language defined in language file:
Wherein,<metadata>With</metadata>This can be read to key in as a pair default keywords, server
Operational parameter between word, the parameter are respectively " population ", " permanent resident population's number " and " population classification ".From the basic number of mapping
According to inquired about in table and field defined in obtaining be " population ", " permanent resident population's number " and " population classification " data.
Again for example, one section of following language is defined again in language file:
Wherein,<conditions>With</conditions>Also it is a pair of default keywords, it is right that this can be read in server
Operational parameter and arithmetic logic between keyword, arithmetic logic are respectively defined in keyword<exp>With</exp>Among, and have
Body can call exp4j to parse expression formula therein, and be calculated, and the result being calculated is stored in into TLS (Thread
Local Storage, thread-local storage TLS) in, the result is interim findings.
Step S308, generate report data corresponding with index.
In the present embodiment, the index can be defined within language file.Likewise, certain a pair of keyword can be defined within
It is interior.Server can be from this to obtaining index in keyword, the report data according to corresponding to result of calculation generates the index.
Actuarial engine server can obtain execution unit and successively according to the executor module (Executor) set in it
Call, until showing that result of calculation is exported to follower module (Output).The result of calculation of follower module receiving actuator
First it is buffered in internal memory, refreshes at regular time and quantity to external cache, the report data according to corresponding to the result generates index.
For example, following one section of language defined in language file:
Wherein,<outputs>With</outputs>Also it is a pair of default keywords, this can be read to keyword in server
Between defined output index, after the achievement data is calculated, generate corresponding report data.Form refers to terminal
The set for the index that can be shown on interface.
In the present embodiment, by there is provided language file and index to be output, and language file and basic number are provided with
According to mapping relations, the basic data mapped is calculated according to the arithmetic logic defined in language file, generation with
Report data corresponding to the index.The calculating of actuarial is carried out by setting language file, the efficiency of calculating can be improved.By setting
The mapping relations of language file and basic data are put, can also improve the flexibility of actuarial.
In one embodiment, above-mentioned calculating method also includes:Obtain initial data;It is clear that data are carried out to initial data
Wash, generate basic data.
In the present embodiment, if pair initial data is the required data used during above-mentioned actuarial, above-mentioned
Performed before step S302.Otherwise, the cleaning process of the data can be before any one above-mentioned step at any one
Or perform afterwards, or perform side by side.
Initial data refers to the data without any processing.Data processing server may have access to related Data web site, obtain
The data on the Data web site are taken, as initial data.The data that the terminal of data manipulation person is uploaded can be also received, as original
Beginning data.
Data cleansing includes data desensitization, data check and data conversion.Wherein, data desensitize in initial data
Sensitive data be encrypted.For example the data include identification card number of individual etc., and the identification card number can be added
It is close.Data check is used to inquire about to whether there is dirty data in initial data, and deletes the dirty data, to eliminate dirty data to actuarial
As a result influence.Server is provided with dirty data decision method for the data of each type, is examined according to default decision method
Whether survey is dirty data.For example the character length scope of the data of each type or the magnitude range of numerical value etc. can be set, when certain
The character length of the data of one type is not within preset range, or numerical value size be not at default magnitude range it
It is interior, then judge the data for dirty data.Data check be uniformly be converted into there will be the data of a variety of different expression modes it is same
The process of the default form of presentation of kind.
Server is provided with a kind of corresponding form of presentation for each type of data, when the number for detecting a certain type
According to set form of presentation it is inconsistent when, can be according between the form of presentation of the type data and set form of presentation
Transformational relation, convert thereof into set form of presentation.For example the data are drug class data, the coding of same medicine
Different being encoded used in different regions, the coded system of the drug class data, and the volume that will be detected can be set in server
The code mode data different from set, according to corresponding transformational relation, convert thereof into the coding being correspondingly arranged, so as to shape
Into unified coding.
After completing to the cleaning of initial data, the data after cleaning are saved as into basic data.
In the present embodiment, by the cleaning to data, basic data is generated, can be easy to subsequently to the calling of the basic data
And calculating, so as to further increase the convenience of actuarial and efficiency.
In one embodiment, above-mentioned calculating method also includes the step of actuarial task generation.As shown in figure 4, the step
Suddenly specifically include:
Step S402, obtains the generation request of actuarial task, and the generation request of actuarial task includes actuarial model.
In the present embodiment, actuarial model design server can receive the actuarial task generation request of user terminal transmission, should
The generation request of actuarial task includes actuarial model.Further, in addition to user identifies so that can be only according to user mark
The one corresponding user identity of identification.For example server can send actuarial model design interface to user terminal, when user terminal connects
After receiving the triggering to the control of the expression task creation on interface, generation actuarial task generation request, send this request to
Server.
Specifically, the task is received by the execution controller (RunController) in actuarial model design server
Generation request.System entry and controller of the controller for operation actuarial engine are performed, for driving engine to perform, inquires about progress
Deng operation.Controller is performed after actuarial task generation request is received, a new actuarial task will be created, and update
The progress of the actuarial task is " started ".RunController collect this establishment actuarial task related parameter,
Index and actuarial condition etc..The parameter, index and actuarial condition etc. may be disposed in actuarial model, such as, wrapped on the interface
Specific computation model and involved parameter, index and actuarial condition etc. are included, user terminal is being detected in default position
After putting the information such as parameter, index and the actuarial condition of place input, the information is packed into the generation request of actuarial task in the lump
In.If parameter is " standard year ";Index is " prediction year ", and whether actuarial condition is " needing to observe results of intermediate calculations "
(snapshot) etc..
Step S404, obtain the DSL files defined in actuarial model.
One or more DSL files would generally be defined in actuarial model.DSL files are that server is determined exclusively for service-user
The linguistic norm of justice, it is more friendly for business personnel.Specifically, the modelling controller in actuarial model design server
(DesignController) can be used to support user to design DSL rules, the modelling controller designs for actuarial model
The entrance of modelling system in server.
In one embodiment, definable DSL pickups rule in actuarial model, DSL in actuarial model design server
Pickup model (DSLFetcher) can pick up the regular DSL texts that correlation is obtained from Relational database/library according to DSL
Part.Index DSL file identification and/or batch is contained in DSL pickup rules.File identification can be used for unique identification corresponding
DSL files or language file, batch are used to identify the mediant generated according to corresponding DSL files and/or language file
According to.It can be handled with a DSL files or language file according to different actuarials, generate a variety of intermediate data, server can be should
Intermediate data sets corresponding batch.The intermediate data can be achievement data corresponding to other actuarial tasks.It is fixed in DSL files
The specific actuarial rule of justice so that according to one or more DSL files, final index can be calculated.
The DSL files that information in index DSL representation of file actuarial models is pointing directly at, it can be set in each DSL files
One or more relies on DSL files, relies on DSL files by setting, can improve the convenience to actuarial model design.Wherein,
DSL files are relied on, are referred to by the DSL files cited in other DSL files.In index DSL files can be set needed for quote according to
Rely the file identification and/or batch of DSL files.
DSLFetcher can get index DSL files, analytic index DSL files, obtain the dependence DSL defined in it
File, and further the dependence DSL files got are parsed, whether also defined with detecting in dependence DSL files
DSL files are relied on, until all dependence DSL files are acquired and finished.
Wherein, when obtaining the process of DSL files, the state of the actuarial task created can be updated to by server
“fetching DSL”。
Step S406, the information in DSL files is verified, after verification passes through, generate language file.
In the present embodiment, DSL collectors (DSLCompiler) are additionally provided with actuarial model design server,
DSLCompiler can pick up the DSL files of output according to DSLFetcher, judge need not to change (such as the DSL
File has been saved into the file of corresponding intermediate language form).And by compiling (conversion) into actuarial engine server energy
The language file of identification.If DSL files are directly default language files, DSLCompiler is directly returned and is not any behaviour
Make.Otherwise, DSLCompiler can carry out syntax check, morphology inspection and compiling generation language file etc. to each DSL files
Work.Check whether the field defined in each DSL files meets corresponding definition and require, and whether indispensable field deposits
Wait.
If verification is by the way that more new state is " mission failure ", and returns to actuarial task failed regeneration to user terminal
Result.If verification passes through, according to the acquired corresponding language file of DSL file generateds.Specifically, the language file can
For XML language file.
Step S408, index to be output is obtained, actuarial task is generated according to language file and index to be output.
In the present embodiment, index to be output i.e. may be disposed in language file, can also during establishment task,
The prompt message of index input is sent to user terminal, and the index that the relative users for obtaining user terminal transmission are inputted.Most
Actuarial task is generated according to the index and with the language file created eventually, and updates corresponding state for " task creation is complete
Into ".Meanwhile the actuarial task created can be placed in task queue so that in actuarial engine server
Dispatcher obtains actuarial task from queue, and thread is distributed to according to set scheduling strategy (serial, parallel, to mix)
Pond idle thread, actuarial task is handled.
In the present embodiment, by the DSL files defined in actuarial model, and according to DSL file generated language files, according to
The language file and index to be output, generate actuarial task.Because DSL files are more friendly for business personnel, and language is literary
Part is defined as performing more friendly intermediate language file for machine parsing, can further improve the facility to the generation of actuarial task
Property.
In one embodiment, as shown in figure 5, being counted according to the arithmetic logic defined in language file to basic data
The step of calculation, including:
Step 502, whether detect includes relying on label in current language file.If so, then perform step 504;Otherwise, hold
Row step 508.
In the present embodiment, server can detect to each language file.For each language file, it is detected respectively
Inside whether define dependence label.
Step 504, the file identification and/or batch relied in label is read.
Dependence language file or intermediate data cited in the language file has been relied on defined in label.Dependence language text
Part can determine that the intermediate data that intermediate data can be generated by other Languages file can be by corresponding by file identification
The file identification of language file and its batch represent.
Step 506, obtain to rely on language file corresponding to file identification and/or batch and with dependence language file have and reflect
Penetrate the basic data and/or intermediate data of relation.
Wherein, the intermediate data generated by corresponding language file that batch is mapped.Specifically, with language file
For XML language file, relying on label can be arranged to<Require>Label.Resolver in actuarial engine server can
It is set and sequentially parses execution unit defined in XML language file, if runs into<Require>Label, then recursion resolution its
Rely on XML language file content.And parse whether there is also XML language file is relied in the dependence XML language file, until institute
Some dependence XML language files, which are acquired, to be finished, and reads the execution list in each language file and its dependence language file
Member, obtain basic data and/or intermediate data corresponding to execution unit.
Step 508, detecting each language file, whether detection finishes, if so, then performing step 510, otherwise, performs step
Rapid 502.
After the language file currently detected is detected, next language file can be obtained, and it is next for this
Individual language file, perform step 502.After all language files are performed both by, then step 510 is performed.
Step 510, according to language file, rely on language file defined in arithmetic logic, to basic data and mediant
According to being calculated.
In one embodiment, whether the detectable intermediate data of server, which has generated, finishes, if so, then obtaining among this
Data, otherwise, then stop to carry out actuarial calculating, until after detecting intermediate data generation, recover the essence of the actuarial task
Calculate.
Dependence label may further be provided in the present embodiment, in language file, according to corresponding to obtaining the dependence label
XML language file is relied on, further according to each language file and its is relied in language file, defined arithmetic logic and corresponding
Basic data is calculated, and can further improve the convenience of actuarial engine computing.
In one embodiment, after the step of generating report data corresponding with index, in addition to:According to form number
According to generation form displaying figure.
In the present embodiment, server can receive the instruction of the displaying to form of user terminal initiation, and displaying instruction includes
Involved report data and display form.Server can according to corresponding display form, by coordinate integrate report heading with
Form table volume data;And according to processing mode is rendered corresponding to display form, the related displaying information of form is rendered, is completed to form
The displaying of data.
In the present embodiment, by carrying out data display to form, it may be such that user more intuitively gets corresponding actuarial
As a result.
Fig. 6 is the structural representation of actuarial device in one embodiment.As shown in fig. 6, a kind of actuarial device, runs on clothes
It is engaged on device, including:Actuarial task acquisition module 602, computing module 604 and report data generation module 606.Wherein:
Actuarial task acquisition module 602, for obtaining pending actuarial task, actuarial task include language file and
Index to be output;Obtain the basic data that there are mapping relations with language file.
Computing module 604, for being calculated according to the arithmetic logic defined in language file basic data.
Report data generation module 606, for generating report data corresponding with index.
In one embodiment, as shown in Figure 7, there is provided another actuarial device, the device also include:
Basic data processing module 608, for obtaining initial data;Data cleansing, generation basis are carried out to initial data
Data.
In one embodiment, as shown in Figure 8, there is provided another actuarial device, device also include:
Actuarial task generation module 610, for obtaining the generation request of actuarial task, the generation request of actuarial task includes essence
Calculate model;Obtain the DSL files defined in actuarial model;Information in DSL files is verified, after verification passes through,
Generate language file;Index to be output is obtained, actuarial task is generated according to language file and index to be output.
In one embodiment, whether computing module 604 is additionally operable to detect in language file includes relying on label, if so,
Then read the file identification relied in label;Obtain and language file is relied on corresponding to file identification and is had with relying on language file
The basic data of mapping relations;According to the arithmetic logic defined in language file, arithmetic logic defined in language file is relied on,
Basic data is calculated.
In one embodiment, as shown in Figure 9, there is provided another actuarial device, device also include:
Display module 612, for generating form displaying figure according to report data.
One of ordinary skill in the art will appreciate that realize all or part of flow in above-described embodiment method, being can be with
The hardware of correlation is instructed to complete by computer program, described program can be stored in a non-volatile computer and can be read
In storage medium, the program is upon execution, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, described storage is situated between
Matter can be magnetic disc, CD, read-only memory (Read-Only Memory, ROM) etc..
Each technical characteristic of embodiment described above can be combined arbitrarily, to make description succinct, not to above-mentioned reality
Apply all possible combination of each technical characteristic in example to be all described, as long as however, the combination of these technical characteristics is not deposited
In contradiction, the scope that this specification is recorded all is considered to be.
Embodiment described above only expresses the several embodiments of the present invention, and its description is more specific and detailed, but simultaneously
Can not therefore it be construed as limiting the scope of the patent.It should be pointed out that come for one of ordinary skill in the art
Say, without departing from the inventive concept of the premise, various modifications and improvements can be made, these belong to the protection of the present invention
Scope.Therefore, the protection domain of patent of the present invention should be determined by the appended claims.