Automation report is a set can solve many areas of industry involves the report generation requirements, the project is the first purpose is to simplify the manual process inside the company of a link, the main purpose is to the plane of the laboratory tests show data results combined with the corresponding report template batch generate a report(.pdf)。
The project running environment is suitable for all major operating systems, the author mainly introduces the production environment is Linux, use Python compiled languages, using PDFTK, WKHTML format conversion software format on the processing; Using Jinja2 template engine and MarkupSafe templates for HTML escape and tags automatically, at the same time efficient transform source into Python bytecode, speed up the template execution time;The existing table data batch rapidly into a database and combined with the Java file upload download page data, and other functions of system development.Finally realize the detecting data and combined with the matching report template, and generate the final report in PDF format.
1、To convert data source after the
csv file (file - save as file type (csv (comma separated) (*.csv) - save), with special programming code editor will confirm for utf-8 (in the case of the notebook, file - coding - utf-8 - save), csv file to be included in the data folder;
cd <program path>
Enter the report file path (< program path > program path, such as：/home/jlcao/TP53/report）；
virtualenv -p <path> <file name>
(such as：/usr/local/bin/python3.5 report）In the current directory to create the report folder, the folder is created in the virtual environment.Just create once;
Activate the virtual environment（virtualenv）；
pip install -r requirements.txt
pip installation depends on the environment, operation requirements.txt, just run once;
python gen_report.py --result-dir results data/xxx.csv
（xxx.csv data file for the data folder，such as：TP53-10个口腔拭子交付报告-20170710.csv） Executing this command, you can in the results folder to generate xxx.csv specified in the patients with all reports, report is stored in a separate folder, the folder name and read xxx.csv data source name.
Hey, I'm Jack Cao, Java engineer, such as the Apache & Alibaba open source contributor, found in all the year round lot, Github, Gitee, zhihu, jianshu. At present is mainly responsible for group App backend development and maintenance, micro services infrastructure, infrastructure construction, Had the opportunity with Alibaba Health & PICC participate in large-scale project development; and my first studio was founded in 2017, solve all kinds of company 「incurable diseases」, to achieve the demand of 「imagination」.Have been torn between the demand and development of struggle, as in a line of powerhouse, is still in development.
More details, please scan qrcode：