Ocassionally, when you've got lots of business logic defined, you may need to perform some heavy calculations outside of your main SQL query and then join back the calculated result set into your final query to perform some statistical final calculation. Usually, the calculated result set would be in the form of a list of maps or list of tuples.
Deploying a Trained SpaCy Model As a Python Sub-Package
So you've trained your spaCy NLP model, you've got it to the highest accuracy you can push it to, and now you want to use it in your project or product. Now, what do you do?
If we were to take a glance at the official spaCy documentation for packaging, they advise using their command line interface to build a deployable Python package containing the model. This results in a package that can then be imported as follows:
import my_model_name
nlp = my_model_name.load()
However, that isn't good enough for us, organization-wise. Imagine having to manage so many separate packages for each machine learning model that you want to deploy. Just think of those import statements! Oh the horror! shudders
Translating Data Types Between Elixir and Python (when using Erlport/Export)
As explained in my original post on connecting Python with Elixir, there are some data translation issues that we will have to deal with when interfacing between the two languages.
Thankfully, the Erlport documentation kindly provides a full table of the data type mappings, which we can now use to make our lives easier.
Using Recursive Functions for Ecto Query Building
Composability is the name of the game when it comes to writing Ecto queries. With such a beautifully designed DSL given to us, we should make full use of its design to build our queries.
Doing Bulk Insertions with Embedded Schemas with Ecto.Repo.insert_all
You can perform bulk insertions for records that contain embedded schemas by doing the following:
