Git Product home page Git Product logo

historical-chart-data's Introduction

Components

График

{
    "type": "heart_rate_chart",
    "period": "P1D"
}

Text & Placeholders

{
    "type": "text.body",
    "text": "Let’s aim for a full $min_sleep_time$-$max_sleep_time$ hours tonight to help you feel more refreshed and ready to tackle the day."
}

Conditions

Представим, что у нас есть N шаблонов, в которых нужны условия для выбора тех или иных блоков для отображения. Будем делать это на основе параметров из контекста (профиль юзера, данные текущего контекста (сон, тренировка и тд))

JSON Logic

Есть вариант использовать инструмент JSON Logic https://jsonlogic.com/

Преимущества:

  • инструмент и формат давно известен и chartGPT умеет писать на нем, т.е. AI-генерируемый
  • он похож на то, что у нас уже реализовано
  • есть UI билдеры для сборк условий через UI, а на выходе json (или можно написать свой)
  • есть либы под JS, Python, C++, Java

Недостатки:

  • несколько громоздкий изза json
  • нет либы под iOS, но скорее всего достаточно JS тк шаблон можно процессить js'ом

Пример данных для условий

{ "sleep_time" : 20000, "sleep_ranges" : { "deep" : 5430 }, "sleep_interp" : { "deep" : "bad" } }

Пример использования в шаблоне

{
    "content": [
        {
            "type": "vbox",
            "items": [
                {
                    "text": "Header",
                    "type": "text.header",
                    "conditions": {
                        "and": [
                            {
                                "<": [{"var": "sleep_time"}, 25200]
                            },
                            {
                                "==": [{"var": "sleep_ranges.deep"}, 5430]
                            },
                            {
                                "==": [{"var": "sleep_interp.deep"}, "bad"]
                            }
                        ]
                    }
                },
                {
                    "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. https://welltory.com",
                    "type": "text.body"
                },

historical-chart-data's People

Watchers

Nikolai Schönknecht avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.