uFincs Update #12
Published: 2021-07-19 23:37:13

**Previewing the Import Rules System**

___

The matter concerning my existence today is a quick update on the import rules system for uFincs.

## Last Time

During [uFincs Update #10](https://www.onmattersconcerningmyexistence.com/p/ufincs-update-10), I gave a short update on the rules system just as development was really ramping up. Now that it's more or less fully functional, I'll be previewing it in preparation for launch (hopefully) sometime at the end of the month.

## Import Rules System

If you want to jump straight into trying it out, you can use a 'staging' version of uFincs here: [https://ufc-381.ufincs.com](https://ufc-381.ufincs.com). If you have an account with uFincs, then you can log in using those same credentials. Don't worry; any changes you make here won't be reflected against your actual account's data.

The first thing you'll notice is that the "Import Transactions" option in the "Add" button menu no longer takes you directly to the import process. Now there's this sort of 'overview' page:

![The newly designed "Import Overview" page. It is the hub for choosing an import option and managing your import rules.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ci5w6j04o3qqpbe2n6j6.png)

This overview page combines the new view for the import rules with the options for importing transactions. Currently (as was previously the case) we only support importing from CSV files, but this new design gives us a good place to put any future import options.

Let's take a closer look at the rules. Here's the new form for creating/updating a rule:

![The new Import Rule form.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1ese5bal1phqfn88auwi.png)

An import rule is quite simple: it consists of a set of conditions and a set of actions. If, during import, a rule's conditions match for a certain transaction, then the rule's actions will be applied to the transaction.

I've kept things quite simple for this initial implementation. A condition can match against a transaction's Account or Description property, using either a plain string or a regex. An action can set one or more of a transaction's Account, Description, or Type. 

That's it. 

However, even with this limited set of actions and conditions, I expect that this will still cover a large majority of use cases. After all, the import process is usually just a matter of cleaning up some transaction descriptions and categorizing them to the right account. These rules should help to drastically cut down on any repetitive importing or to help with importing a large number of transactions all at once.

Of course, if there are any other conditions or actions that you want supported, just let me know!

Once a rule has been created, here's what it looks like in the table:

![An example rule displayed in table format.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rzjmho8gx3elj2536121.png)

Yeah, I'll admit, it's not the prettiest thing. But it gets the job done.

Finally, here's what the rules look like during the import process itself. First, you'll find a new section during the fourth step (Adjust Transactions):

![The Adjust Transactions step with a red arrow pointing at the new "Active Import Rules" section.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fbxft7y5q2qbj81fsvs5.png)

And you can open it up to reveal a list of the currently active import rules:

![The Adjust Transactions step with the "Active Import Rules" section open.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6k80ds06oxoeonkpwr7k.png)

These are all of the rules whose conditions matched up with any of the transactions that you're currently importing. 

If you want to add any other rules, you can also do that here. 

Finally, you can toggle the rules on or off, in case you need to reference the original values  from your CSV file.

That's all I've got in terms of the preview. While the functional implementation is basically done at this point, I'm still in the weeds when it comes to testing. There's a lot of weird ways the rules system can be abused to create invalid transactions, so I'm definitely trying to cover as many of those corner cases as possible before releasing this out to everyone.

In the meanwhile, feel free to try it out and let me know what you think!

Till next time.