Python 中的 EDI X12 模板(最有可能是 django 或 jinja)(带有 sqlalchemy)

发布于 2024-09-07 13:47:50 字数 804 浏览 3 评论 0原文

我的案例

我正在开发一个系统,需要为医疗保健(保险)交易和查询(特别是 270 资格和 837 索赔)创建各种 X12 文件。

我知道有一些很好的工具(特别是 pyx12)用于在 XML 和 X12 之间进行转换,实际上我已经从 pyx12 导入一些组件来实际创建/操作 x12 数据。

即使考虑到这一点,在对格式进行了一些研究之后,我开始相信我可以更轻松地使用模板语言生成这些格式。我认为这将是为每个部分声明/查询需要重复的任何段和循环定义 for 循环的问题,并且标题区域将在某种程度上是静态的,除了任何元素值可以根据我的上下文轻松更新。

几乎我所有的记录都来自 sqlalchemy,因此应该很容易循环遍历数据库中的记录,其中关系被很好地定义和映射。

我的问题:

  1. 我认为这与其说是一个问题,不如说是寻求建议和寻求帮助。洞察力,所以请随意使用所有这些进行拍摄。 IE,你认为这是个好主意还是浪费时间?
  2. 对于任何顽固的 x12 人来说,从头开始构建 x12 时遇到过什么样的问题?我应该注意什么?
  3. 这种实施方式以前有人做过吗?是否有任何语言的特定 X12 格式模板的示例? (我确实看起来收效甚微)

只是一个旁注:

我们已经在使用 python 和 django,因此我们可以使用模板语言。如果我们需要将这些事情作为后台进程来完成,我们要么使用 hacky 配置环境技巧来让 django 模板在我们的 django 项目之外工作,要么使用 jinja 来代替——这几乎是可以互换的。

My Case:

I'm working on a system that will need to create various X12 files for health care (insurance) transactions and inquiries (Specifically 270 Eligibility and 837 Claim).

I know there are good tools out there (pyx12 specifically) for converting between XML and X12, and actually I've gone as far as importing some components from pyx12 to actually create/manipulate x12 data.

Even considering that, after researching the formats a bit, I'm starting to believe that I could have an easier time generating these formats using a template language. I think that it would be a matter of defining for loops for any segments&loops that need to be repeated per portion claim/inquiry, and the header regions are going to be somewhat static besides whatever element values that could be easily updated by my context.

Almost all of my records are coming out from sqlalchemy so it should be easy enough to loop through my records in the database where relations are very well defined and mapped.

My questions:

  1. I suppose this is less of a question and more of a quest for advice & insight, so feel free to shoot with all of that. IE, Do you think this is a good idea or a waste of time?
  2. For any die-hard x12 people, what kind of problems have you run into building x12 from scratch? What should I watch out for?
  3. Has this style of implementation been done before? Are there examples of specific X12 format templates available, from any language? (I did look with little success)

Just a side note:

We're already working with python and django, so that template language is available to us. If we need to do these things as a background process we'll either do the hacky config environment tricks to get django templates to work outside of our django project or else use jinja instead--which is nearly interchangeable.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

愁杀 2024-09-14 13:47:50

我没有专门研究 x12,但我经常通过模板生成各种文本格式,并且我可以确认它的工作方式非常神奇。我会推荐 mako (因为它基本上为您提供了 Python 模板的所有功能),但是如果您如果您热衷于使用类似 django 的模板,那么 jinja2 绝对是您的最佳选择。它的主要优点包括速度、易于调试、更丰富的模板库,以及易于独立使用。

I haven't worked on x12 specifically, but I've often generated all kinds of textual formats by templating, and I can confirm it works like a charm. I would recommend mako (because it basically gives you all the power of Python for your templating), but if you're keen on staying with django-like templates, then jinja2 is definitely the way to go. Its main advantages include speed, ease of debugging, and a richer templating library, as well as the ease of stand-alone use.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文