Best Practice For Custom Field in Program Link

This forum is for programmers who have questions about the source code.
Post Reply
dgetz
Posts: 2
Joined: Fri Jul 22, 2022 7:47 am

Best Practice For Custom Field in Program Link

Post by dgetz » Mon Jul 25, 2022 8:53 am

Hi there,

I'm evaluating OD from the perspective of a third-party API provider. One feature I was looking at was the "program links" and using a custom URL to navigate to our doctor portal. The existing internal patient number won't match up to anything we have on our end, so I was looking at using a custom field.

Example:

Path of file to open: https://testurl.com/patient?patientId=[someCustomField]

There are a handful of out-of-the-box fields (fields like PatNum, FName, LName, etc) that will properly swap in the patient value; I found them in the Patients.cs ReplacePatient function. They are all similar like:

Code: Select all

ReplaceTags.ReplaceOneTag(template,"[NameF]",pat.FName,isHtmlEmail);
Firstly, am I in the right place? If so, what's the recommended way to handle this problem? I could add a line like this:

Code: Select all

ReplaceTags.ReplaceOneTag(template,"[SomeCustomField]", pat.SomeCustomField.ToString(), isHtmlEmail);
And then also extend the Patient class itself. But there are shortfalls: the function would have to be extended for each custom field versus a generic way to match fields.

Another idea would be creating a handful of these generic fields and letting third parties describe how to use them versus vendor-specific implementations in their documentation.

Any thoughts or feedback would be useful.
Derek

dgetz
Posts: 2
Joined: Fri Jul 22, 2022 7:47 am

Re: Best Practice For Custom Field in Program Link

Post by dgetz » Tue Jul 26, 2022 12:42 pm

I spent some more time analyzing the code and that won't work the way I laid it out. There's a few ways to go about it, but the first problem is that the Patient object won't have the custom field information, that's held in an array of PatField objects.

In the ProgramL.Execute, the ReplaceHelper function is used on the cmdline,path, and fileTemplate variables. One idea would be to extend the ReplaceHelper function to grab the array of PatField objects for the patient number, and then do something similar by replacing strings where they match the name of a custom field.

Any thoughts on this? Either in terms of the solution, or to go on a roadmap, or do it myself and create a pull request? Is there an SDLC or documentation for pull requests that you follow with suggestions from the community?

Edit: I did see there is a feature request tool on the help menu, would this be my best bet?

Post Reply