FHIR Chat · Code Templates · hapi

Stream: hapi

Topic: Code Templates


view this post on Zulip Grahame Grieve (Jun 26 2017 at 03:32):

how many people would find it useful if we generated a stub set of java lines for populating and reading the different resource types?

view this post on Zulip Grahame Grieve (Jun 26 2017 at 03:34):

something along the lines of

view this post on Zulip Grahame Grieve (Jun 26 2017 at 03:34):

    CodeSystem cs = new CodeSystem();
    cs.setId();
    cs.setUrl(url+"/"+cs.getId());
    cs.addIdentifier().setSystem().setValue();
    cs.setName();
    cs.setTitle();
    cs.setStatus();
    cs.setExperimental();

view this post on Zulip David Hay (Jun 27 2017 at 01:07):

excuse my ignorance, but doesn't hapi already do that?

view this post on Zulip Grahame Grieve (Jun 27 2017 at 02:03):

does it? I haven't seen it

view this post on Zulip Kevin Mayfield (Jun 27 2017 at 07:45):

It does but you need to specify the parameters. Is that the point?

view this post on Zulip David Hay (Jun 27 2017 at 21:48):

Isn't it this: http://hapifhir.io/doc_fhirobjects.html ??

view this post on Zulip Grahame Grieve (Jun 27 2017 at 21:49):

no, that explains how it works. What I'm thinking is pre-generated java psudo-code that you can copy and paste into your source, and then fill out the values

view this post on Zulip David Hay (Jun 27 2017 at 23:00):

What would the advantage be over simply using the hapi library?

view this post on Zulip James Agnew (Jun 28 2017 at 02:14):

I think the idea here is that if you're using the HAPI library, this would be a snippet of code you could use to populate one of HAPI's objects by filling in the various blanks.

How would you decide which fields to populate in a given resource? Like would your stub code cover all fields in the resource (would likely be overwhelming), just the required ones (wouldn't be much help) or some predetermined list of "popular" ones or something?

view this post on Zulip Grahame Grieve (Jun 28 2017 at 02:15):

I would do all elements to the data type level - paste them in, delete the ones I'm not going to use

view this post on Zulip Grahame Grieve (Jun 28 2017 at 02:16):

but I do very often do fluent setters.. that complicates matters for the template...

view this post on Zulip James Agnew (Jun 28 2017 at 02:20):

yeah, i generally go pretty nuts with the fluent setters. i just love those things.

truthfully I'm not sure I'd use these much personally.. if you do end up doing this we could certainly find a home for them on the HAPI website though.

view this post on Zulip Grahame Grieve (Jun 28 2017 at 04:56):

well, I'd generate something like this:

view this post on Zulip Grahame Grieve (Jun 28 2017 at 04:56):

https://web.archive.org/web/20160321140303/http://www.sproutee.com/mytemplates.xml

view this post on Zulip Hannes Ulrich (Jun 28 2017 at 15:43):

There is a code template feature in Postman, where you can try the http call and then generate the corresponding snippet. This works pretty well, maybe a FHIR support comes handy!

view this post on Zulip Grahame Grieve (Jun 29 2017 at 06:27):

thx I hadn't seen that before.

view this post on Zulip Grahame Grieve (Jun 29 2017 at 06:27):

maybe I should add this to the notepad++ plug-in to work the same...

view this post on Zulip Brian Postlethwaite (Jul 04 2017 at 03:42):

That's a groovy Idea, I might suggest it on the .net channel too!


Last updated: Apr 12 2022 at 19:14 UTC