View Source Glific.CSV.File (Glific v5.1.6)

First implementation to convert sheets to flows using a menu structure and UUID

Link to this section Summary

Functions

Given a header, extract the indexes of the language, menu and content items which helps us when parsing each row

Read a csv file, and split it up into a bunch of tuples that we are interested in. Assuming that the csv file is valid for now

Link to this section Types

@type t() :: %Glific.CSV.File{
  __meta__: Ecto.Schema.Metadata.t(),
  contents: String.t() | nil,
  id: non_neg_integer() | nil,
  inserted_at: :utc_datetime | nil,
  main_menu: map() | nil,
  name: String.t() | nil,
  organization:
    Glific.Partners.Organization.t() | Ecto.Association.NotLoaded.t() | nil,
  organization_id: non_neg_integer() | nil,
  updated_at: :utc_datetime | nil,
  uuid_map: map() | nil
}

Link to this section Functions

@spec parse_header(list()) :: {list(), map()}

Given a header, extract the indexes of the language, menu and content items which helps us when parsing each row

Link to this function

process_csv_file(file, output, organization_id)

View Source
@spec process_csv_file(String.t(), String.t(), non_neg_integer()) :: map()

Read a csv file, and split it up into a bunch of tuples that we are interested in. Assuming that the csv file is valid for now