File analysis method and device

By setting up a message queue between the server and the upstream node and using a policy model to develop a parsing method, the system paralysis problem of the server when facing massive requests and the file type independent parsing algorithm are solved, and efficient file parsing and full-link data transmission are achieved.

CN119905188APending Publication Date: 2025-04-29BEIJING JINGDONG TUOXIAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311413923.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-27
Publication Date
2025-04-29

AI Technical Summary

Technical Problem

When automatically parsing physical examination reports and other files on the server, it is easy to cause system paralysis when facing massive requests. The existing technology requires independent development of parsing algorithms for different file types, resulting in confusion in parsing logic and inconvenient maintenance, and it is difficult for downstream nodes to obtain parsing results accurately.

Method used

By setting up a message queue between the server and the upstream node, adjusting the message consumption strategy according to the current load status to avoid system paralysis; adopting the policy mode to develop a parsing method corresponding to the enumeration value of the file type, realizing dynamic switching and flexible expansion; publishing the parsed successful message in the downstream message queue for downstream nodes to read the full analysis results according to the service source mark.

Benefits of technology

It effectively avoids system paralysis when facing massive requests, reduces the amount of code development and post-maintenance work, ensures that downstream nodes can accurately obtain parsing results, and achieve the goal of full-link work.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119905188A_ABST
    Figure CN119905188A_ABST
Patent Text Reader

Abstract

The invention discloses a file analysis method and device, and relates to the technical field of intelligent medical treatment. A specific embodiment of the method comprises the following steps: reading a to-be-analyzed file identifier from a preset upstream message queue according to a current load state, and acquiring a to-be-analyzed file by using the to-be-analyzed file identifier; detecting a file type of the to-be-analyzed file, and determining a total analysis target method corresponding to the file type of the to-be-analyzed file according to a pre-configured first corresponding relationship; the first corresponding relation is a corresponding relation between the file type and a full-quantity analysis method in a pre-written file analysis interface; and calling the total analysis target method in the file analysis interface to analyze the to-be-analyzed file so as to obtain a total analysis result of the to-be-analyzed file. According to the implementation mode, system paralysis possibly occurring in the face of massive requests can be avoided, and the code development amount and the later maintenance workload are reduced based on the strategy mode.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of smart medical technology, and in particular to a file parsing method and device. Background Art

[0002] In the current scenario where the server automatically parses files such as physical examination reports, the server parses the full amount of data from the physical examination report and returns it directly to the client through a direct connection. When faced with massive parsing requests, the above processing method is likely to cause the system to crash. In addition, the current file types of physical examination reports include images, portable documents (such as PDF), structured documents (such as Json, Xml), etc. In practice, automatic parsing algorithms are generally developed independently for different file types, resulting in confusing parsing logic and not conducive to later maintenance. In addition, it is difficult for downstream nodes to accurately obtain the parsing results after the physical examination report is parsed, and it is inconvenient for downstream nodes to use the physical examination report. Summary of the invention

[0003] In view of this, the embodiment of the present invention provides a file parsing method and device, which can realize a message consumption strategy adjusted according to the current load state based on the message queue between the server and the upstream node, thereby avoiding possible system paralysis when facing massive requests. In addition, a corresponding parsing method corresponding to the file type enumeration value is developed based on the strategy mode, which realizes dynamic switching and flexible expansion of the parsing method, reducing the amount of code development and subsequent maintenance workload.

[0004] To achieve the above objective, according to one aspect of the present invention, a file parsing method is provided.

[0005] The file parsing method of an embodiment of the present invention includes: reading a to-be-parsed file identifier from a preset upstream message queue according to a current load state, and obtaining the to-be-parsed file using the to-be-parsed file identifier; detecting the file type of the to-be-parsed file, and determining a full parsing target method corresponding to the file type of the to-be-parsed file according to a pre-configured first correspondence; the first correspondence is a correspondence between a file type and a full parsing method in a pre-written file parsing interface; calling the full parsing target method in the file parsing interface to parse the to-be-parsed file, so as to obtain a full parsing result of the to-be-parsed file.

[0006] Optionally, obtaining the file to be parsed using the file to be parsed identifier includes: determining the name of the file to be parsed using the file to be parsed identifier, obtaining a download link of the file to be parsed using the name of the file to be parsed, and obtaining the file to be parsed from cloud storage using the download link.

[0007] Optionally, calling the full-parsing target method in the file parsing interface to parse the file to be parsed to obtain the full-parsing result of the file to be parsed includes: calling the full-parsing target method to parse the file to be parsed to obtain a preliminary parsing result including basic data, indicator data and conclusion data; wherein, the indicator data includes: multiple indicator names and indicator values ​​under the multiple indicator names; extracting non-standard names from the multiple indicator names, and using a pre-established second corresponding relationship to modify the extracted non-standard names into corresponding standard names to obtain the full-parsing result; the second corresponding relationship is the corresponding relationship between non-standard names and standard names.

[0008] Optionally, the method further includes: storing the obtained full parsing result in a preset database; using the to-be-parsed file identifier to query a cache used to record the parsing status of the to-be-parsed file, obtaining a parsing record of the to-be-parsed file, and updating the parsing status in the parsing record to parsing success.

[0009] Optionally, the method further includes: publishing a parsing success message containing a file identifier and a business source tag to a preset downstream message queue, so that the downstream node reads the parsing success message from the downstream message queue based on the business source tag, and then reads the corresponding full parsing result from the database based on the file identifier in the parsing success message.

[0010] Optionally, the method further includes: in response to receiving a parsing instruction issued by a client, determining the file to be parsed targeted by the parsing instruction; detecting the file type of the file to be parsed, and determining the local parsing target method corresponding to the file type of the file to be parsed according to the correspondence between the pre-configured file type and the local parsing method in the file parsing interface; calling the local parsing target method in the file parsing interface to parse the file to be parsed and obtain basic data in the file to be parsed; displaying the obtained basic data on the client, and obtaining confirmed basic data based on the basic data confirmation instruction issued by the client; after obtaining the full parsing result, associating the full parsing result with the confirmed basic data.

[0011] Optionally, the method further comprises: after obtaining the confirmed basic data, generating the identification of the file to be parsed, establishing a corresponding relationship between the identification of the file to be parsed and the name of the file to be parsed; and the file types include: images, portable documents and structured documents.

[0012] To achieve the above objective, according to another aspect of the present invention, a file parsing device is provided.

[0013] The file parsing device of an embodiment of the present invention may include: a file acquisition unit, used to read the identifier of the file to be parsed from a preset upstream message queue according to the current load state, and use the identifier of the file to be parsed to obtain the file to be parsed; a strategy pattern processing unit, used to detect the file type of the file to be parsed, and determine the full parsing target method corresponding to the file type of the file to be parsed according to a pre-configured first correspondence; the first correspondence is the correspondence between the file type and the full parsing method in a pre-written file parsing interface; a parsing unit, used to call the full parsing target method in the file parsing interface to parse the file to be parsed, so as to obtain the full parsing result of the file to be parsed.

[0014] To achieve the above objective, according to another aspect of the present invention, an electronic device is provided.

[0015] An electronic device of the present invention comprises: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the file parsing method provided by the present invention.

[0016] To achieve the above objective, according to yet another aspect of the present invention, a computer-readable storage medium is provided.

[0017] A computer-readable storage medium of the present invention stores a computer program, which implements the file parsing method provided by the present invention when executed by a processor.

[0018] According to the technical solution of the present invention, the embodiments of the above invention have the following advantages or beneficial effects:

[0019] The server reads the identifier of the file to be parsed from the upstream message queue according to the current load status, and uses the identifier of the file to be parsed to obtain the file to be parsed. Then, the server detects the file type of the file to be parsed, and determines the full parsing target method corresponding to the file type of the file to be parsed according to the correspondence between the pre-configured file type and the full parsing method in the pre-written file parsing interface. Finally, the server calls the full parsing target method in the file parsing interface to parse the file to be parsed, thereby obtaining the full parsing result of the file to be parsed. In this way, the message consumption strategy adjusted according to the current load status is implemented based on the message queue between the server and the upstream node, thereby avoiding the possible system paralysis in the face of massive requests, and the corresponding parsing method corresponding to the file type enumeration value is developed based on the strategy mode, which realizes the dynamic switching and flexible expansion of the parsing method, and reduces the code development and subsequent maintenance workload. In order to address the problem that it is difficult for downstream nodes to accurately obtain parsing results after parsing, an embodiment of the present invention publishes a parsing success message containing a file identifier and a business source tag in a downstream message queue. The downstream node can read the parsing success message from the downstream message queue in a targeted manner based on the business source tag, and then read the corresponding full parsing results from the database based on the file identifier in the parsing success message, thereby achieving the purpose of full-link work.

[0020] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0022] Figure 1 It is a schematic diagram of the main steps of the file parsing method in an embodiment of the present invention;

[0023] Figure 2 is a schematic diagram of the pre-analysis timing of an embodiment of the present invention;

[0024] Figure 3 is a schematic diagram of the analysis timing of an embodiment of the present invention;

[0025] Figure 4 It is a schematic diagram of components of a file parsing device in an embodiment of the present invention;

[0026] Figure 5 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;

[0027] Figure 6 It is a schematic diagram of the structure of an electronic device used to implement the file parsing method in an embodiment of the present invention. DETAILED DESCRIPTION

[0028] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0029] It should be pointed out that the embodiments of the present invention and the technical features therein may be combined with each other without conflict.

[0030] Figure 1 Schematic diagram of main steps of the file parsing method according to an embodiment of the present invention.

[0031] like Figure 1 As shown, the file parsing method of the embodiment of the present invention can be executed by the server, and the specific steps are as follows:

[0032] Step S101: Read the to-be-parsed file identifier from the preset upstream message queue according to the current load state, and obtain the to-be-parsed file using the to-be-parsed file identifier.

[0033] In the prior art of automatically parsing documents such as physical examination reports on the server side, the server side parses the full amount of data from the physical examination report and then returns it directly to the client side through a direct connection. When faced with massive parsing requests, the above processing method is likely to cause the system to crash. In order to solve the above problems, the present invention arranges a message queue between the server side and the upstream node to avoid a direct connection between the server side and the upstream node. The messages sent by the upstream node are placed in the message queue in an asynchronous manner, and the server side can determine the time to consume messages in the message queue according to the current load status (such as the occupancy rate of the central processing unit CPU and the graphics processing unit GPU). For example, when the current load is high, the server side only consumes a small amount of messages from the message queue or does not consume messages; when the current load is low, the server side can consume a large amount of messages in batches from the message queue or consume all related messages, thereby avoiding paralysis of the server side due to insufficient computing power.

[0034] In this step, after the server consumes the file parsing-related message from the message queue, it can extract the identifier of the file to be parsed, and use the extracted identifier of the file to be parsed to obtain the file to be parsed. In actual applications, the server can first use the identifier of the file to be parsed to determine the name of the file to be parsed, then use the name of the file to be parsed to obtain the download link of the file to be parsed, and finally use the above download link to obtain the file to be parsed from the cloud storage (such as object storage, block storage, etc.).

[0035] Step S102: Detect the file type of the file to be parsed, and determine the full parsing target method corresponding to the file type of the file to be parsed according to a pre-configured first correspondence; the first correspondence is the correspondence between the file type and the full parsing method in the pre-written file parsing interface.

[0036] In the existing technology of file parsing, it is generally necessary to independently develop automatic parsing algorithms for different file types, which leads to confusing parsing logic and is not conducive to later maintenance. In order to solve the above problems, the present invention uses a strategy pattern (StrategyPattern) to develop corresponding parsing methods corresponding to file type enumeration values, thereby realizing dynamic switching and flexible expansion of parsing methods, reducing the amount of code development and later maintenance workload. In the strategy pattern, the behavior of a class or its algorithm can be changed at runtime. The strategy pattern defines a series of algorithms or strategies, and encapsulates each algorithm or strategy in an independent class so that they can be replaced with each other; by using the strategy pattern, different algorithms can be selected as needed at runtime without modifying the client code.

[0037] In order to adaptively parse the files to be parsed of different file types, the embodiment of the present invention pre-writes the full parsing method and the partial parsing method of each file type based on the above strategy pattern, and places these methods in the same interface (i.e., the file parsing interface) for easy calling, wherein the file type is used as an enumeration value to locate the corresponding parsing method. The full parsing method refers to a method for parsing the entire text of a file, and the partial parsing method refers to a method for parsing only the basic data from the file to be parsed. Generally, the basic data refers to the key data in the file to be parsed formulated at the business level. For example, the basic data in the physical examination report can be personal information such as name, gender, age, and mobile terminal number. Exemplarily, the above file types may include: images, portable documents (such as PDF format) and structured documents (such as Json, Xml).

[0038] In this step, the server detects the file type of the file to be parsed, and determines the full parsing target method corresponding to the file type of the file to be parsed according to the correspondence between the pre-configured file type and the full parsing method in the pre-written file parsing interface, so as to facilitate subsequent parsing.

[0039] Step S103: calling the full analysis target method in the file analysis interface to analyze the file to be analyzed, so as to obtain the full analysis result of the file to be analyzed.

[0040] In this step, the server directly calls the full-analysis target method in the file parsing interface to parse the file to be parsed, and the full-analysis result of the file to be parsed can be obtained. Specifically, the server can call the full-analysis target method determined in step S102 to parse the file to be parsed, and obtain a preliminary parsing result including basic data, indicator data and conclusion data. Among them, the indicator data can be key-value pair data, which refers to the relevant data associated with the preset indicators, which may include multiple indicator names and indicator values ​​under multiple indicator names; the conclusion data refers to the relevant conclusions obtained by analyzing the indicator data. For example, when the file to be parsed is a physical examination report, the indicator name is the name of each physical examination item, the indicator value is the corresponding data obtained by the examination, and the conclusion data is the health-related conclusion obtained by analyzing the indicator data.

[0041] After that, the server can extract non-standard names from multiple indicator names, and use the pre-established correspondence between non-standard names and standard names (i.e., the second correspondence, which can be stored in a dictionary or thesaurus) to modify the extracted non-standard names into corresponding standard names to obtain the full parsing result. After obtaining the full parsing result, the server can store the obtained full parsing result in a preset database for subsequent use, and the server can use the above file identifier to be parsed to query the cache (such as Redis) used to record the parsing status of the file to be parsed, obtain the parsing record of the file to be parsed, and update the parsing status in the parsing record to parsing success.

[0042] In the prior art, after successfully parsing a file, the server generally sends the parsing success data containing the file identifier to a specific downstream node. However, this direct sending method has poor scalability, and some unconfigured downstream nodes cannot obtain the parsing success data when they need to, which is not conducive to achieving the overall work purpose. In order to solve this problem, an embodiment of the present invention arranges a message queue between the server and the downstream node to realize asynchronous message transmission, and constructs a parsing success message with a corresponding business source tag, that is, the parsing success message contains the file identifier, the business source tag and the current parsing status. It can be understood that the business source tag is used to distinguish different business operations and business links. For example, a unique business source tag can be pre-assigned to the file parsing service.

[0043] After the server publishes the parsing success message containing the file identifier, business source tag and current parsing status to the downstream message queue, the downstream node can determine whether it needs to consume the relevant message based on the business source tag. If consumption is required, the corresponding full parsing result is read from the database based on the file identifier in the parsing success message, and the corresponding business logic is executed based on the full parsing result read.

[0044] In actual scenarios, before executing the above full analysis, you can perform a pre-analysis of the file to be analyzed to obtain the basic data in the file to be analyzed, display the above basic data on the client and send a confirmation reminder to the user to ensure the correctness of the basic data. After confirming that the basic data is correct, the user can issue a confirmation instruction; when the user needs to modify the basic data, he can also confirm after modifying the relevant data. The specific execution steps of the pre-analysis are as follows.

[0045] After receiving the parsing instruction issued by the client, the server first determines the file to be parsed for the parsing instruction. Then, the server detects the file type of the file to be parsed, and determines the local parsing target method corresponding to the file type of the file to be parsed according to the correspondence between the pre-configured file type and the local parsing method in the file parsing interface. After determining the local parsing target method, the server calls the above local parsing target method in the file parsing interface to parse the file to be parsed, thereby obtaining the basic data in the file to be parsed. Thereafter, the server displays the obtained basic data on the client, and obtains the confirmed basic data based on the basic data confirmation instruction issued by the client. It can be understood that the confirmed basic data can be the basic data that has not been modified by the user, or it can be the basic data that has been modified by the user. After obtaining the confirmed basic data, the server can generate the above file identifier to be parsed for the file to be parsed, and establish a correspondence between the file identifier to be parsed and the name of the file to be parsed. Based on this correspondence, the server can use the file identifier to be parsed to determine the name of the file to be parsed in the subsequent full parsing process, and then obtain the file to be parsed. Finally, when the server obtains the above full analysis results, it can associate the full analysis results with the confirmed basic data to ensure the correctness of the basic information in the full analysis results.

[0046] Through the above steps, the embodiment of the present invention implements a message consumption strategy adjusted according to the current load status based on the message queue between the server and the upstream node, thereby avoiding possible system paralysis when facing massive requests, and develops a corresponding parsing method corresponding to the file type enumeration value based on the policy mode, realizing dynamic switching and flexible expansion of the parsing method, reducing the amount of code development and subsequent maintenance workload. In order to solve the problem that it is difficult for downstream nodes to accurately obtain the parsing results after parsing, the embodiment of the present invention publishes the parsing success message containing the file identifier and the business source tag in the downstream message queue. The downstream node can read the parsing success message from the downstream message queue based on the business source tag, and then read the corresponding full parsing result from the database based on the file identifier in the parsing success message, thereby achieving the purpose of full-link work.

[0047] A specific embodiment of the present invention is described below. Figure 2 and Figure 3 .

[0048] This embodiment is explained by taking the online medical examination report analysis scenario as an example. In this scenario, the user requests the analysis of the medical examination report based on the client. The appointment center, the operation end, the file analysis application and the algorithm application constitute the aforementioned service end. Among them, the appointment center is used to connect with the user's request and perform actions such as repeatability verification, analysis status initialization and update. The operation end serves as a transfer between the appointment center and the file analysis application and also undertakes certain business logic processing. The file analysis application is responsible for the logic of obtaining the file to be analyzed, file type detection, interface call, etc. The algorithm application is a pre-developed module based on optical character recognition or machine learning model.

[0049] Figure 2 is a schematic diagram of the pre-analysis timing of an embodiment of the present invention, see Figure 2 . During the pre-parsing process, after the user issues a file parsing instruction, the pre-parsing process of the file to be parsed is automatically executed, and the reservation center requests pre-parsing from the file parsing application. The file parsing application obtains the download link according to the file name (a file name list for image types) passed in by the client, replaces the download link with an intranet link to ensure data security, and determines the file to be parsed based on the intranet link. Thereafter, the file parsing application detects the file type of the file to be parsed and performs policy routing based on the policy mode according to the file type. After obtaining the local parsing target method, the file parsing application calls the local parsing target method in the file parsing interface of the algorithm application to obtain the parsed personal information in the file to be parsed (as basic data) and formats the personal information. Finally, the file parsing application returns the formatted personal information to the reservation center, and the reservation center returns the formatted personal information to the client. The user can confirm the above personal information through the client or modify it. After the pre-parsing is completed, the server can generate a unique identifier for the file to be parsed, that is, the above file identifier to be parsed.

[0050] Figure 3 is a schematic diagram of the analysis sequence of an embodiment of the present invention, see Figure 3. During the full analysis process, after the user confirms personal information on the client, the server executes the panoramic analysis process. The appointment center first performs a check to see if the file is duplicated. If the current file to be analyzed is duplicated with the historical file, a reminder is issued and the analysis is performed based on the historical file; if there is no duplication, the appointment center requests the operation end to save the report uploaded by the user, and the operation end saves it. Next, the appointment center initializes the analysis record of the file to be analyzed in the cache, and sets the analysis status in the analysis record to "to be analyzed". Thereafter, the operation end queries the report according to the identifier of the file to be analyzed, and calls the relevant interface of the file analysis application to perform full analysis. After the file analysis application is called, the download link of the report is first obtained and then the download link is converted into an intranet link. The report is obtained according to the intranet link and its file type is detected. Then, the policy routing is executed to obtain the full analysis target method and call the method to the file analysis interface of the algorithm application, and then the preliminary analysis result returned by the algorithm application is obtained. After that, the file analysis application performs the indicator name standardization operation on the indicator data in the preliminary analysis result, and obtains the full analysis result after formatting. Finally, the file parsing application returns the full parsing results to the reservation center, and the reservation center returns the full parsing results to the client for display, and updates the parsing status of the parsing record in the cache to parsing success, and encapsulates the file identifier, parsing status and corresponding business source tag in the parsing success message, and publishes the parsing success message to the downstream message queue, so that the downstream nodes can consume the parsing success message on demand according to the business source tag and then perform the corresponding business processing.

[0051] Through the above steps, it is possible to implement a message consumption strategy that is adjusted according to the current load status based on the message queue between the server and the upstream node, thereby avoiding possible system paralysis when facing massive requests, and developing a corresponding parsing method corresponding to the file type enumeration value based on the policy mode, realizing dynamic switching and flexible expansion of the parsing method, reducing the amount of code development and subsequent maintenance workload. In addition, in order to address the problem that it is difficult for downstream nodes to accurately obtain parsing results after parsing, an embodiment of the present invention publishes a parsing success message containing a file identifier and a business source tag in a downstream message queue, and the downstream node can read the parsing success message from the downstream message queue in a targeted manner based on the business source tag, and then read the corresponding full parsing result from the database based on the file identifier in the parsing success message, thereby achieving the purpose of full-link work.

[0052] It should be noted that the collection, collection, update, analysis, processing, use, transmission, storage and other aspects of user personal information that may be involved in the technical solution of the present invention are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.

[0053] For the above-mentioned method embodiments, for the convenience of description, they are expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the order of the actions described, and some steps can actually be performed in other orders or simultaneously. In addition, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily necessary to implement the present invention.

[0054] In order to better implement the above-mentioned solution of the embodiment of the present invention, relevant devices for implementing the above-mentioned solution are also provided below.

[0055] See also Figure 4 As shown, the file parsing device 400 provided by the embodiment of the present invention may include: a file acquisition unit 401, a strategy mode processing unit 402 and a parsing unit 403.

[0056] Among them, the file acquisition unit 401 can be used to read the identifier of the file to be parsed from the preset upstream message queue according to the current load status, and use the file identifier to be parsed to obtain the file to be parsed; the strategy pattern processing unit 402 can be used to detect the file type of the file to be parsed, and determine the full parsing target method corresponding to the file type of the file to be parsed according to a pre-configured first correspondence; the first correspondence is the correspondence between the file type and the full parsing method in the pre-written file parsing interface; the parsing unit 403 can be used to call the full parsing target method in the file parsing interface to parse the file to be parsed, so as to obtain the full parsing result of the file to be parsed.

[0057] In an embodiment of the present invention, the file acquisition unit 401 can be further used to: determine the name of the file to be parsed using the file identifier to be parsed, obtain a download link of the file to be parsed using the name of the file to be parsed, and use the download link to obtain the file to be parsed from cloud storage.

[0058] Preferably, the parsing unit 403 can be further used to: call the full parsing target method to parse the file to be parsed, and obtain a preliminary parsing result including basic data, indicator data and conclusion data; wherein the indicator data includes: multiple indicator names and indicator values ​​under the multiple indicator names; extract non-standard names from the multiple indicator names, and use a pre-established second corresponding relationship to modify the extracted non-standard names into corresponding standard names to obtain the full parsing result; the second corresponding relationship is the corresponding relationship between non-standard names and standard names.

[0059] As a preferred solution, the device 400 may further include: a subsequent processing unit, used to: store the obtained full parsing result in a preset database; use the to-be-parsed file identifier to query the cache used to record the parsing status of the to-be-parsed file, obtain the parsing record of the to-be-parsed file, and update the parsing status in the parsing record to successful parsing.

[0060] In specific applications, the subsequent processing unit can be further used to: publish a parsing success message containing a file identifier and a business source tag to a preset downstream message queue, so that the downstream node reads the parsing success message from the downstream message queue based on the business source tag, and then reads the corresponding full parsing result from the database based on the file identifier in the parsing success message.

[0061] In actual applications, the device may further include: a pre-parsing unit, which is used to: in response to receiving a parsing instruction issued by the client, determine the file to be parsed targeted by the parsing instruction; detect the file type of the file to be parsed, and determine the local parsing target method corresponding to the file type of the file to be parsed according to the correspondence between the pre-configured file type and the local parsing method in the file parsing interface; call the local parsing target method in the file parsing interface to parse the file to be parsed and obtain the basic data in the file to be parsed; display the obtained basic data on the client, and obtain the confirmed basic data based on the basic data confirmation instruction issued by the client; after obtaining the full parsing result, associate the full parsing result with the confirmed basic data.

[0062] In addition, in an embodiment of the present invention, the pre-parsing unit can be further used to: generate the file identifier to be parsed after obtaining the confirmed basic data, and establish a corresponding relationship between the file identifier to be parsed and the name of the file to be parsed; and the file types include: images, portable documents and structured documents.

[0063] According to the technical solution of the embodiment of the present invention, the server reads the identifier of the file to be parsed from the upstream message queue according to the current load status, and obtains the file to be parsed using the identifier of the file to be parsed. Then, the server detects the file type of the file to be parsed, and determines the full parsing target method corresponding to the file type of the file to be parsed according to the correspondence between the pre-configured file type and the full parsing method in the pre-written file parsing interface. Finally, the server calls the full parsing target method in the file parsing interface to parse the file to be parsed, thereby obtaining the full parsing result of the file to be parsed. In this way, the message consumption strategy adjusted according to the current load status is implemented based on the message queue between the server and the upstream node, thereby avoiding the possible system paralysis in the face of massive requests, and the corresponding parsing method corresponding to the file type enumeration value is developed based on the strategy mode, which realizes the dynamic switching and flexible expansion of the parsing method, and reduces the code development and later maintenance workload. In order to address the problem that it is difficult for downstream nodes to accurately obtain parsing results after parsing, an embodiment of the present invention publishes a parsing success message containing a file identifier and a business source tag in a downstream message queue. The downstream node can read the parsing success message from the downstream message queue in a targeted manner based on the business source tag, and then read the corresponding full parsing results from the database based on the file identifier in the parsing success message, thereby achieving the purpose of full-link work.

[0064] Figure 5 An exemplary system architecture 500 is shown to which the file parsing method or the file parsing device according to the embodiment of the present invention can be applied.

[0065] like Figure 5 As shown, the system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505 (this architecture is only an example, and the components included in the specific architecture may be adjusted according to the specific application). The network 504 is used to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 505. The network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables.

[0066] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various client applications, such as file parsing applications, etc. (only examples), can be installed on terminal devices 501, 502, 503.

[0067] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0068] The server 505 may be a server that provides various services, such as a background server (only an example) that provides support for file parsing applications operated by users using the terminal devices 501, 502, and 503. The background server may process the received file parsing request and feed back the processing result (such as the parsing result - only an example) to the terminal devices 501, 502, and 503.

[0069] It should be noted that the file parsing method provided in the embodiment of the present invention is generally executed by the server 505 , and accordingly, the file parsing device is generally disposed in the server 505 .

[0070] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.

[0071] The present invention also provides an electronic device. The electronic device of an embodiment of the present invention comprises: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the file parsing method provided by the present invention.

[0072] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of an electronic device suitable for implementing an embodiment of the present invention. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0073] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the computer system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0074] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed so that a computer program read therefrom is installed into the storage section 608 as needed.

[0075] In particular, according to the embodiments disclosed in the present invention, the process described in the main step diagram above can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the main step diagram. In the above embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit 601, the above functions defined in the system of the present invention are executed.

[0076] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0077] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0078] The units involved in the embodiments of the present invention may be implemented by software or hardware. The units described may also be set in a processor, for example, it may be described as: a processor includes: a file acquisition unit, a policy mode processing unit and a parsing unit. The names of these units do not constitute a limitation on the units themselves in some cases, for example, the file acquisition unit may also be described as "a unit that provides the policy mode processing unit with a file to be parsed".

[0079] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by the device, the steps executed by the device include: reading the identifier of the file to be parsed from the preset upstream message queue according to the current load state, and obtaining the file to be parsed using the identifier of the file to be parsed; detecting the file type of the file to be parsed, and determining the full parsing target method corresponding to the file type of the file to be parsed according to a pre-configured first corresponding relationship; the first corresponding relationship is the correspondence between the file type and the full parsing method in the pre-written file parsing interface; calling the full parsing target method in the file parsing interface to parse the file to be parsed, so as to obtain the full parsing result of the file to be parsed.

[0080] In the technical solution of the embodiment of the present invention, the server reads the identifier of the file to be parsed from the upstream message queue according to the current load state, and obtains the file to be parsed using the identifier of the file to be parsed. Then, the server detects the file type of the file to be parsed, and determines the full parsing target method corresponding to the file type of the file to be parsed according to the correspondence between the pre-configured file type and the full parsing method in the pre-written file parsing interface. Finally, the server calls the full parsing target method in the file parsing interface to parse the file to be parsed, thereby obtaining the full parsing result of the file to be parsed. In this way, the message consumption strategy adjusted according to the current load state is implemented based on the message queue between the server and the upstream node, thereby avoiding the possible system paralysis when facing massive requests, and the corresponding parsing method corresponding to the file type enumeration value is developed based on the strategy mode, which realizes the dynamic switching and flexible expansion of the parsing method, and reduces the code development and later maintenance workload. In order to address the problem that it is difficult for downstream nodes to accurately obtain parsing results after parsing, an embodiment of the present invention publishes a parsing success message containing a file identifier and a business source tag in a downstream message queue. The downstream node can read the parsing success message from the downstream message queue in a targeted manner based on the business source tag, and then read the corresponding full parsing results from the database based on the file identifier in the parsing success message, thereby achieving the purpose of full-link work.

[0081] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A file parsing method, characterized in that: include: Reading a to-be-parsed file identifier from a preset upstream message queue according to the current load state, and obtaining the to-be-parsed file using the to-be-parsed file identifier; Detecting the file type of the file to be parsed, and determining the full parsing target method corresponding to the file type of the file to be parsed according to a pre-configured first correspondence; the first correspondence is a correspondence between the file type and the full parsing method in a pre-written file parsing interface; The full-parsing target method in the file parsing interface is called to parse the file to be parsed, so as to obtain a full-parsing result of the file to be parsed.

2. The method according to claim 1, characterized in that The obtaining the to-be-parsed file by using the to-be-parsed file identifier includes: The name of the file to be parsed is determined using the identifier of the file to be parsed, a download link of the file to be parsed is obtained using the name of the file to be parsed, and the file to be parsed is obtained from cloud storage using the download link.

3. The method according to claim 1, characterized in that The calling of the full parsing target method in the file parsing interface to parse the file to be parsed to obtain a full parsing result of the file to be parsed includes: The full-analysis target method is called to parse the file to be parsed, and a preliminary parsing result including basic data, indicator data and conclusion data is obtained; wherein the indicator data includes: multiple indicator names and indicator values ​​under the multiple indicator names; Extract non-standard names from the multiple indicator names, and modify the extracted non-standard names into corresponding standard names using a pre-established second correspondence relationship to obtain the full parsing result; the second correspondence relationship is a correspondence relationship between non-standard names and standard names.

4. The method according to claim 1, characterized in that: The method further comprises: Storing the obtained full analysis results in a preset database; The cache for recording the parsing status of the file to be parsed is queried using the identifier of the file to be parsed to obtain a parsing record of the file to be parsed, and the parsing status in the parsing record is updated to parsing success.

5. The method according to claim 4, characterized in that The method further comprises: The parsing success message containing the file identifier and the business source tag is published in a preset downstream message queue, so that the downstream node reads the parsing success message from the downstream message queue based on the business source tag, and then reads the corresponding full parsing result from the database based on the file identifier in the parsing success message.

6. The method according to claim 2, characterized in that The method further comprises: In response to receiving a parsing instruction issued by a client, determining a file to be parsed targeted by the parsing instruction; Detecting the file type of the file to be parsed, and determining the local parsing target method corresponding to the file type of the file to be parsed according to the correspondence between the pre-configured file type and the local parsing method in the file parsing interface; Calling the local parsing target method in the file parsing interface to parse the file to be parsed, and obtaining basic data in the file to be parsed; The obtained basic data is displayed on the client, and the confirmed basic data is obtained based on the basic data confirmation instruction issued by the client; After obtaining the full analysis result, the full analysis result is associated with the confirmed basic data.

7. The method according to claim 6, characterized in that The method further comprises: After obtaining the confirmed basic data, generating the to-be-parsed file identifier, and establishing a corresponding relationship between the to-be-parsed file identifier and the name of the to-be-parsed file; And, the file types include: images, portable documents and structured documents.

8. A file parsing device, characterized in that: include: A file acquisition unit, configured to read a to-be-parsed file identifier from a preset upstream message queue according to a current load state, and acquire the to-be-parsed file using the to-be-parsed file identifier; A strategy mode processing unit, configured to detect the file type of the file to be parsed, and determine the full parsing target method corresponding to the file type of the file to be parsed according to a pre-configured first correspondence relationship; the first correspondence relationship is a correspondence relationship between the file type and the full parsing method in a pre-written file parsing interface; The parsing unit is used to call the full parsing target method in the file parsing interface to parse the file to be parsed, so as to obtain a full parsing result of the file to be parsed.

9. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.