Naming Convention

There are two simple rules we encourage when it comes to naming conventions for functions:

1. Describe what your function does:

Using a name also helps you keep your functions short and concise.

A good format is: <verb><Entity>

  • The verb of what your function is doing.

  • The name of the entity that you are acting on.

If your function is doing too many things, then usually your function name will end up being too long and that’s a good indication to break your function up into smaller functions.

For example: createPatientRecord is a good because we know this function takes patient info and creates a patient record.

2. Include the name of the system the function is interacting with:

When you include the interacting system in the name of your function, you are essentially grouping your functions by what they interact with based on their concerns.

Interacting systems can be databases, APIs, or file systems, and these can be further grouped under a specific client site.

A good format is: <system><Verb><Entity>

One way you can do this is to initialize your functions inside of a Lua table that acts as a container for your functions.

In the screenshot below, we have stored out fhir.createPatient function in a fhir table where we expand functionality further by adding more functions.

On another level, you can also group your modules together under the same directory/folder, which can be useful for organizing modules based on your needs, for example, an system or client.

This is useful if you’re working with many sites that each have their own nuances

It also separates your concerns - you know the modules under FHIR only touch FHIR, and the modules under database interact with the database.

If you want to checkout more naming convention recommendations, see .

Â