Giter VIP home page Giter VIP logo

dedav4s's Introduction

dedav4s's People

Contributors

quafadas avatar scala-steward avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dedav4s's Issues

DSL problems

It does not appear to be easy to have en enum, which encodes certain strings:

enum Bah: 
  case valid
  case values
  case wait

values & wait will give compile errors.

The DSL, is incomplete, as these are commented out in a few places. To the best of my knowledge, they Arne't "crucial" and will therefore likely be left this way.

Very long string unions break something (circe encoding / compiler?)


/**
 * Defines how date-time values should be binned.
 */
type TimeUnit = 
    "date" | 
    "day" | 
    "dayhours" | 
    "dayhoursminutes" | 
    "dayhoursminutesseconds" | "dayofyear" | "hours" | "hoursminutes" | "hoursminutesseconds" | "milliseconds" | 
    "minutes" | "minutesseconds" | "month" | "monthdate" | "monthdatehours" | "monthdatehoursminutes" | "monthdatehoursminutesseconds" | "quarter" | "quartermonth" | "seconds" | "secondsmilliseconds" | 
    //"utcdate" | "utcday" | "utcdayhours" | "utcdayhoursminutes" | "utcdayhoursminutesseconds" | "utcdayofyear" | "utchours" | "utchoursminutes" | "utchoursminutesseconds" | "utcmilliseconds" | "utcminutes" | 
    //"utcminutesseconds" | "utcmonth" | "utcmonthdate" | "utcmonthdatehours" | "utcmonthdatehoursminutes" | "utcmonthdatehoursminutesseconds" | "utcquarter" | "utcquartermonth" | "utcseconds" | 
    //"utcsecondsmilliseconds" | "utcweek" | "utcweekday" | "utcweekdayhoursminutes" | "utcweekdayhoursminutesseconds" | "utcweeksdayhours" | "utcyear" | "utcyeardayofyear" | "utcyearmonth" | "utcyearmonthdate" | 
    //"utcyearmonthdatehours" | "utcyearmonthdatehoursminutes" | "utcyearmonthdatehoursminutesseconds" | "utcyearquarter" | "utcyearquartermonth" | "utcyearweek" | "utcyearweekday" | "utcyearweekdayhours" | 
    //"utcyearweekdayhoursminutes" | "utcyearweekdayhoursminutesseconds" | 
    "week" | "weekday" | "weekdayhoursminutes" | "weekdayhoursminutesseconds" | "weeksdayhours" | "year" | "yeardayofyear" | "yearmonth" | 
    "yearmonthdate" | "yearmonthdatehours" | "yearmonthdatehoursminutes" | "yearmonthdatehoursminutesseconds" | "yearquarter" |  "yearquartermonth" | 
    "yearweek" | 
    "yearweekday" | 
    "yearweekdayhours" | 
    "yearweekdayhoursminutes" | 
    "yearweekdayhoursminutesseconds"

// type TimeUnit = "date" | "day" // Short string unions work...

/**
 * Time unit for the field to be tested.
 *
 * Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field. or [a
 * temporal field that gets casted as
 * ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).
 *
 * __Default value:__ `undefined` (None)
 *
 * __See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html)
 * documentation.
 *
 * The timeUnit.
 */
type TimeUnitUnion = TimeUnit | TimeUnitParams
given Decoder[TimeUnitUnion] = {
    List[Decoder[TimeUnitUnion]](
        Decoder[TimeUnit].widen,
        Decoder[TimeUnitParams].widen,
    ).reduceLeft(_ or _)
}

given Encoder[TimeUnitUnion] = Encoder.instance {
    case enc0 : TimeUnit => Encoder.encodeString(enc0)
    case enc1 : TimeUnitParams => Encoder.AsObject[TimeUnitParams].apply(enc1)
}

case class TimeUnitParams (
    /**
     * If no `unit` is specified, maxbins is used to infer time units.
     */
    val maxbins : Option[Double] = None,

    /**
     * The number of steps between bins, in terms of the least significant unit provided.
     */
    val step : Option[Double] = None,

    /**
     * Defines how date-time values should be binned.
     */
    val unit : Option[TimeUnit] = None,

    /**
     * True to use UTC timezone. Equivalent to using a `utc` prefixed `TimeUnit`.
     */
    val utc : Option[Boolean] = None
) derives Encoder.AsObject, Decoder


scaladoc

We got a lot of free commentary from the code gen... check how to generate and publish scaladoc.

Boss Level: Generate a DSL

Surprisingly, this might actually be tractable.

Scalably typed already does this in JS land. So it would be perfectly possible to have a typesafe DSL in scala JS.

However, the implementations dead end at js.native calls. Point is, that we don't need those. Vega is declarative, so we only need to be able to serialise the object and properties to JSON. We can discard it's actual implementation!

Solution sketch :

  • fork scalably typed
  • replace it's js types with Jim ones <-- boss level.
  • find a way to serialise it's objects...

And then we'd generate the entire DSL automagically!

Scala JS support?

This actually shouldn't be too difficult. SBT type level already supports cross publishing.

Need another library for http requests in JS land.

How to display?

DSL not correctly encoding mark/encode path

import viz.PlotTargets.desktopBrowser
import viz.vega.plots._
val barchart = SpecUrl.BarChart.toDsl() // it decoded successfully!
//val barchart: 
//  Either[io.circe.Error, viz.dsl.vegaLite.VegaLiteDsl | viz.dsl.vega.VegaDsl] = Right(VegaDsl(

barchart.map(_.plot) // need a map right now as it's an either... 

Doesn't plot right now, because mark / encode is a blank case class.

case class VegaEncode() derives Encoder.AsObject, Decoder

Think the codegen fails because;
vega/vega#3491

More extension methods for vanilla scala datastructures

On simple iterables...

Iterable[Numeric] - pie chart
Iterable[Numeric] -line chart
Iterable[Numeric] -dot plot
Iterable[(Numeric, Numeric)] - scatterplot
Iterable[(Numeric, Numeric)] - regression
Iterable[(Numeric, Numeric)] - quantile quantile

etc

desktopBrowser and websocket PlotTargets do not work on (some?) Linux distributions

The problem is here:

Desktop.getDesktop().browse(tempFi.toNIO.toUri())

BROWSE is not supported under some Linux distributions and the Desktop.getDesktop().browse call throws an exception java.lang.UnsupportedOperationException: The BROWSE action is not supported on the current platform!. This link has some suggestions for cross-platform implementations; more or less you do runtime.exec("xdg-open " + url) on X11-based systems (I'm not sure how to do this under Wayland).

VSCode target?

It would be cool, to not leave VSCode context, when using worksheets, for example.

Can this be done?

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.