66 Commits

Author SHA1 Message Date
84cf6758bb
fix(growth): results is now a keyword list 2024-10-05 15:10:40 +00:00
7e041ae6c9
chore(growth): adjust indicator lookup to use atoms for unit 2024-10-05 15:09:44 +00:00
82d7009b34
chore(growth): adjust key in ets tables to contain atoms
The `ets` tables containing growth indicator has a key in the form of
`{gender :: atom(), unit :: atom(), value :: number()}`.
2024-10-05 15:07:10 +00:00
fa65a36852
test(growth): fix doctest for centile and percentile
All checks were successful
continuous-integration/drone/pr Build is passing
2024-10-05 12:58:36 +00:00
f3846cad24
chore(growth): update doc to reflect percentile values
All checks were successful
continuous-integration/drone/pr Build is passing
This fixes an issue were the returned value represented the measurment
at a given z-score (the centile value).
2024-10-03 22:16:15 +00:00
27a7a05584
fix(growth): improve doc for centile calculation
This module converts a given z-score and Box-Cox values into the related
measurement.
2024-10-03 22:14:56 +00:00
fc0d9db7a5
merge: updates from upstream
All checks were successful
continuous-integration/drone/pr Build is passing
Conflicts:
  mix.exs
  mix.lock
2024-10-02 12:31:04 +00:00
0ae8bf53a2 chore(deps): update dependency gettext to ~> 0.26.0 (#94)
All checks were successful
continuous-integration/drone/push Build is passing
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [gettext](https://hex.pm/packages/gettext) | minor | `~> 0.25.0` -> `~> 0.26.0` |

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4zOS42IiwidXBkYXRlZEluVmVyIjoiMzguMzkuNiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: Joao P Dubas <joao.dubas+gitea@gmail.com>
Reviewed-on: #94
Co-authored-by: renovate-bot <renovate-bot@dubas.dev>
Co-committed-by: renovate-bot <renovate-bot@dubas.dev>
2024-10-02 11:51:23 +00:00
8328bbe9fb
merge: updates from tracking
All checks were successful
continuous-integration/drone/pr Build is passing
2024-09-25 23:48:32 +00:00
90613635fb
merge: updates from upstream
All checks were successful
continuous-integration/drone/pr Build is passing
Conflicts:
    .gitignore
    lib/wabanex/application.ex
    mix.lock
2024-09-22 19:06:02 +00:00
9be7566cbb feat: execute service as distributed erlang (#96)
All checks were successful
continuous-integration/drone/push Build is passing
To create a cluster with distributed nodes, the following changes were made:

* Use [`dns_cluster`][0] to execute distributed nodes
* Add _script_ to execute distributed nodes locally

Also, improve local execution by:

* Use [`mix release`][1] to make easier [deploy `phoenix`][2]
* Use [`compose watch`][3] to synchronize code from the host with the service

Some minor improvements:

* Ignore files and folders in git and docker
* Remove boilerplate comments

[0]: https://github.com/phoenixframework/dns_cluster
[1]: https://hexdocs.pm/mix/Mix.Tasks.Release.html
[2]: https://hexdocs.pm/phoenix/releases.html
[3]: https://docs.docker.com/compose/how-tos/file-watch/

Co-authored-by: Joao P Dubas <joao.dubas@gmail.com>
Reviewed-on: #96
Co-authored-by: Joao P Dubas <joao.dubas+gitea@gmail.com>
Co-committed-by: Joao P Dubas <joao.dubas+gitea@gmail.com>
2024-09-22 18:56:27 +00:00
5c044e69d9
fix(growth): use centile and percentile correctly
1. The calculation made in `Grownth.Calc.Centile.compute/4` converts a
   given z-score into the expected measurement value.
   This can be used to get specific values for key z-scores, such as,
   -3, -2, 2 and 3.
2. To calculate the percentile of a given z-score the system uses the
   cumulative distribution function.
2024-08-28 13:03:45 +00:00
0d7a4cc9c3
chore(growth): move nil logic to scorer behaviour
All checks were successful
continuous-integration/drone/pr Build is passing
Handle `nil` measurement in `Growth.Score.Scorer`.
2024-06-11 14:53:19 +00:00
c81e4fda67
chore(growth): add log in loader
All checks were successful
continuous-integration/drone/pr Build is passing
2024-06-11 12:02:14 +00:00
bc9c2124f1
chore(growth): add example for Growth.new/4 2024-06-11 12:01:50 +00:00
c14a26a184
fix(growth): measure for subscapular skinfold 2024-06-11 12:01:25 +00:00
79aec9f7e5
feat(growth): calculate z-score/centile for all indicators
All checks were successful
continuous-integration/drone/pr Build is passing
2024-06-11 11:42:57 +00:00
2545a796c3
chore(growth): return nil when measure isn't set 2024-06-11 11:42:17 +00:00
88b8e811a8
chore(growth): apply scorer behaviour in indicators 2024-06-11 11:41:31 +00:00
fa022b9592
feat(growth): calculate z-score/centile for all indicators
The `Growth.Score.Scorer` behaviour implements the methods needed to
calculate z-score and centile for any indicator.
2024-06-11 11:38:18 +00:00
0ac434c61d
fix(growth): ignore enum result explicitly
All checks were successful
continuous-integration/drone/pr Build is passing
2024-06-10 19:24:41 +00:00
06b35cbceb
wip(growth): implement results for bmi
Some checks failed
continuous-integration/drone/pr Build is failing
This implementation should be made generic for all other scores.
2024-06-10 19:09:35 +00:00
28f0546bcb
chore(growth): add default value for results 2024-06-10 18:35:12 +00:00
c175c3edfd
fix(growth): typespec and doc for centile calc 2024-06-10 18:34:24 +00:00
4234b2e917
chore(growth): load is independent from task
Some checks failed
continuous-integration/drone/pr Build is failing
Ensure that `Growth.Indicators.Load.all/0` can be run independently from
the task.

So, the `ets` table is create based on the filename processed.
2024-06-10 13:01:44 +00:00
04fff60541
wip(growth): add score module
Some checks failed
continuous-integration/drone/pr Build is failing
This module is responsible for calculate the z score/centile for each
measurement.
2024-06-10 12:15:16 +00:00
b415b38184
feat(growth): load data on application start
To make this possible, the following changes were made:

* Use `Task` to start the load process
* Create `ets` table before start the async task
  * This is needed to keep the tables alive after the task process exits
* Adjust the application to start the `Growth.Indicators.Load` task
2024-06-10 12:11:18 +00:00
412250d7ef
feat(growth): add struct to represent measurement
All checks were successful
continuous-integration/drone/pr Build is passing
2024-06-09 20:00:49 +00:00
d3c1aa9b6b
chore(growth): improve age documentation and typing 2024-06-09 19:59:33 +00:00
025ab1537d
chore(growth): name ets tables with score modules 2024-06-09 19:58:34 +00:00
52c1d0c028
feat(growth): load csv indicators into ets tables
All checks were successful
continuous-integration/drone/pr Build is passing
2024-06-07 13:28:13 +00:00
902a22c947
chore(growth): fetch extended data for indicators
All checks were successful
continuous-integration/drone/pr Build is passing
Also, improve module doc.
2024-06-06 22:49:52 +00:00
a8466f0c1d
chore(growth): add documentation and examples
All checks were successful
continuous-integration/drone/pr Build is passing
2024-06-06 20:39:10 +00:00
Joao P Dubas
bb79aa2f3a fix(growth): alias z-score and use if
Some checks failed
continuous-integration/drone/pr Build is failing
2024-06-06 11:34:02 +00:00
500d0e89bb
wip(growth): calculate key metrics for growth
Some checks failed
continuous-integration/drone/pr Build is failing
1. calculate age in days, weeks, and months
2. calculate body mass index for metric and english unities
3. calculate z-score for a given measurement and box-cox parameters (l,
   m, s)
4. calculate centile score for a given measurement and box-cox
   parameters
2024-06-06 01:36:11 +00:00
8be9fa38bb
wip(growth): add fix note on convert/3 method
All checks were successful
continuous-integration/drone/pr Build is passing
2024-06-04 23:56:27 +00:00
9c8e1d20ee
wip(growth): improve data parsing
1. Fetch common data for all indicators
2. Remove headers during merge

Also, re-generate files.
2024-06-04 23:55:03 +00:00
2fedb4ecf0
wip(growth): change from with to case
All checks were successful
continuous-integration/drone/pr Build is passing
2024-06-04 14:36:20 +00:00
58f14c0346
wip(growth): fetch|extract|save indicators from WHO
Initial implementation to fetch growth indicators from WHO.

For now, the system merges the measurements for each gender and age
group in a single `csv` file.

The final solution should do this, saving a `dets` file.
2024-06-04 13:57:32 +00:00
34c3a3e4c2 feat: expose system metrics (#4)
Use prom_ex to expose system metrics to prometheus and create dashboards.

Co-authored-by: Joao P Dubas <joao.dubas@gmail.com>
Reviewed-on: #4
2022-05-03 16:19:39 +00:00
39419f8837 feat (ci): improve configuration (#16)
- Remove unused `github-actions` configuration
- Cache build and deps to make tests faster
- Add lint step

Reviewed-on: #16
2022-04-26 00:01:43 +00:00
410a509faa chore: apply credo suggestions (#3)
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Mainly add module docs and fix some aliases.
2022-04-22 00:49:00 +00:00
Joao P Dubas
f07965afa4 [extra-01] use date_range to represent training period
Adjust graphql training object and input to use date_range type as a
representation for period field.
2021-06-28 13:55:55 +00:00
Joao P Dubas
24a2c516c5 [extra-01] add custom date range graphql type
This type allow graphql to work natively with postgres date range and
reduce the amount of work to convert between representations.
2021-06-28 13:55:37 +00:00
Joao P Dubas
1597d34a2d [extra-01] adjust training query to filter by period 2021-06-28 00:31:44 +00:00
Joao P Dubas
a69b771847 [extra-01] training has a period validity
We move from start/end date to a period date range to represent the
interval where a training take place.

Besides that, new constraints are added to ensure a trainings of a user
can't overlap. These constraints reflect in changeset validation.
2021-06-28 00:31:36 +00:00
Joao P Dubas
da77d81200 [day-05] preload training alongside user
Preload training and exercises when fetching an user and expose this
information in graphql.
2021-06-26 18:08:29 +00:00
Joao P Dubas
5c2c588cca [day-04] expose exercise in graphql 2021-06-26 17:32:35 +00:00
Joao P Dubas
eaac531e0b [day-04] expose training in graphql 2021-06-26 17:31:59 +00:00
Joao P Dubas
d5faec5f65 [day-04] move uuid scalar import to root type
With this change, uuid4 is available to all graphql types.
2021-06-26 17:29:41 +00:00