-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from baluyotraf/20230322
Blog update and Alternative Queries
- Loading branch information
Showing
12 changed files
with
208 additions
and
105 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Alternative Queries | ||
|
||
Alternative Queries is a library to help created type-checked and reusable | ||
handcrafted SQL queries. The library also manages merging of parameters from | ||
nested queries, making sure that the parameters are passed to your database | ||
connection correctly. | ||
|
||
The library is still in development and there's still no `0.1` release. If | ||
you are curious however, feel free to check the [Alternative Queries Documentation] | ||
and try it out by downloading the [Alternative Queries Package]. | ||
|
||
[Alternative Queries Documentation]: https://altqq.baluyotraf.com/stable/ | ||
[Alternative Queries Package]: https://pypi.org/project/altqq/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
authors: | ||
baluyotraf: | ||
name: Raf Baluyot | ||
description: Creator | ||
avatar: https://avatars.githubusercontent.com/u/7478783 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Stories | ||
|
||
Here are stories and updates written about software and machine learning. |
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--- | ||
authors: | ||
- baluyotraf | ||
date: | ||
created: 2024-03-15 | ||
updated: 2024-03-22 | ||
categories: | ||
- software | ||
- machine-learning | ||
--- | ||
|
||
# Hejdå Autoliv! | ||
|
||
Today, March 15, 2024, I spent my last day in Autoliv. I went to the Vårgårda | ||
office to meet my colleagues from research and gave everyone thanks. In | ||
return, I also got a lot of compliments. Oh, and there's some project where my | ||
input was appreciated. | ||
|
||
<!-- more --> | ||
|
||
Thinking about it, my contract lasted for 1 year and 10 months. And I thought | ||
it would be nice to look back at the things I've done with the team. | ||
|
||
## Software Services | ||
|
||
A lot of the things we did in research are software driven, without going to | ||
details of the services, here are the things I added to those services. | ||
|
||
* Database Migrations, Proper Indexing and Constraints | ||
* RESTful APIs | ||
* Kotlin Multiplatform SDK for iOS/Android | ||
* Android Application | ||
* ServiceNow and Azure AD Integration (OpenIDC) | ||
* Pre-commit and CI Pipelines | ||
* Reusable CI Templates | ||
* Automated Documentations | ||
* Full Unit and Integration Test Suite via Docker Compose | ||
* Security Review | ||
* Data Migration Script | ||
|
||
## E-Safe Pre-Study and Other Research | ||
|
||
Electric powered mobility solutions has been gaining popularity. After coming | ||
to Autoliv, I had to work on a research project for Vinnova. The paper is | ||
available in the [Vinnova Publication] for more details. | ||
|
||
In the project, we got a lot of data from electric scooters with front facing | ||
cameras. My main contribution to the project are the computer vision outputs. | ||
This means working mostly on object detection, distance estimation, object | ||
tracking, and video stabilization. Below are some of the examples of the data | ||
we processed, as shown in the paper. | ||
|
||
![E-safe Pre-study](assets/esafe.png) | ||
|
||
Aside from this, there are also other internal researches that I've been a part | ||
of, both with employees and thesis students. | ||
|
||
[Vinnova Publication]: https://www.vinnova.se/en/p/e-safe-pre-study/ | ||
|
||
## Motorcycle Airbags | ||
|
||
Autoliv has officially announced its [Motorcycle Airbags], and part of the work | ||
I've done is making sure that the crash algorithm is robust and capable. | ||
|
||
![Motorcycle](https://www.autoliv.com/sites/default/files/pr/202306017153-2.png) | ||
|
||
[Motorcycle Airbags]: https://www.autoliv.com/press/autoliv-launch-its-first-motorcycle-airbag-2025-2132315 | ||
|
||
|
||
## Next Chapters | ||
|
||
As I wait for my next assignment or next opportunity, I've been planning on | ||
working on the following things. | ||
|
||
* Continue my courses on Explainable AI and Machine Learning for Predictive | ||
Maintenance. | ||
* Write an open source library for typed and composable handwritten SQL | ||
in Python. Current planned name is alternative queries (altqq). | ||
* Keep up with the latest advancements in LLMs. Thankfully, I did work with a | ||
chatbot company before and have the fundamentals to built my knowledge on. |
77 changes: 77 additions & 0 deletions
77
docs/stories/posts/20240322-blog-updates-and-altqq/content.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- | ||
authors: | ||
- baluyotraf | ||
date: | ||
created: 2024-03-22 | ||
categories: | ||
- software | ||
- data | ||
--- | ||
|
||
# Blog Updates and Alternative Queries | ||
|
||
Today, I would like to announce some blog updates and the release of my SQL | ||
helper library, Alternative Queries (altqq). | ||
|
||
<!-- more --> | ||
|
||
## Blog Updates | ||
|
||
As of today, the blogs in the page are powered by MkDocs Material's blog | ||
plugin. This means that the blog page will now have additional features such | ||
as archive, categories, and previews. If you're interested in creating blogs, | ||
be sure to check the [MkDocs Material Documentation]. If you're not aware how | ||
to start, you can check the [Software+ML Code]. | ||
|
||
## Alternative Queries | ||
|
||
If you work a lot with handcrafted SQL queries and prefer to have type-checked | ||
parameters, and reusable queries, feel free to check my library called | ||
Alternative Queries (altqq). | ||
|
||
### Managing Ordered Parameters | ||
|
||
Alternative Queries also allows you to manage your query parameters. For | ||
example, for ODBC databases, `pyodbc` does not allow named parameter. If means | ||
that to reuse queries, one needs to make note of the parameters, as they must | ||
be in order. For example | ||
|
||
```python | ||
query1 = """SELECT * from "Users" where "Id" = ?""" | ||
query2 = """SELECT * from "Users" where "Name" = ?""" | ||
|
||
full_query = f"{query1} UNION ALL {query2}" | ||
parameters = [uuid4(), "Arie"] | ||
``` | ||
|
||
The simple above looks simple, but if `query1` takes 3 parameters, and the | ||
`full_query` reuses 3-5 existing queries, the scenario becomes more complex. | ||
Even in this case, there is a possibility to define `parameters` as | ||
`["Arie", uuid4()]` if one is not careful. | ||
|
||
### Managing Named Parameters | ||
|
||
`psycopg` support is not yet implemented in the current version. But as an | ||
example, `psycopg` provides named parameters. The advantage of named parameters | ||
are obvious: no parameter repetition, and more context from parameter names. | ||
|
||
```python | ||
query1 = """SELECT * from "Users" where "Id" = %(id)s""" | ||
query2 = """SELECT * from "Users" where "Name" = %(name)s""" | ||
|
||
full_query = f"{query1} UNION ALL {query2}" | ||
parameters = {"id": uuid4(), "name": "Arie"} | ||
``` | ||
|
||
This solution already looks better. There's no way of mistaking the query | ||
parameters, even if the queries are merged improperly. However, this can be | ||
an issue if the queries are complex and a lot of reuse is required. It is | ||
possible to merge different queries that require the same name. | ||
|
||
If you find these problems interesting, check the [Alternative Queries Documentation] | ||
and play around it by downloading the [Alternative Queries Package]. | ||
|
||
[MkDocs Material Documentation]: https://squidfunk.github.io/mkdocs-material/ | ||
[Software+ML Code]: https://github.com/baluyotraf/softwareplusml | ||
[Alternative Queries Documentation]: https://altqq.baluyotraf.com/stable/ | ||
[Alternative Queries Package]: https://pypi.org/project/altqq/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
CairoSVG==2.5.2 | ||
mkdocs==1.4.2 | ||
CairoSVG==2.7.1 | ||
mkdocs==1.5.3 | ||
mkdocs-include-markdown-plugin==3.9.1 | ||
mkdocs-material==8.5.8 | ||
Pillow==9.3.0 | ||
mkdocs-material==9.5.14 | ||
mkdocs-material-extensions==1.3.1 | ||
Pillow==10.2.0 |