Skip to content

Commit

Permalink
Merge pull request #26 from finos-labs/update-elm-generated-code
Browse files Browse the repository at this point in the history
Updated transpiler and generated elm
  • Loading branch information
minesh-s-patel authored Apr 29, 2022
2 parents 769f9fb + eab5ae5 commit d1975d4
Show file tree
Hide file tree
Showing 9 changed files with 203 additions and 16 deletions.
Binary file modified rosetta-elm-gen/elm-transpiler.jar
Binary file not shown.
24 changes: 24 additions & 0 deletions rosetta-elm-gen/minimal/src/Com/Rosetta/Model/Rule.elm
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module Com.Rosetta.Model.Rule exposing (..)

import Morphir.SDK.LocalDate exposing (LocalDate)
import Morphir.SDK.LocalTime exposing (LocalTime)
import Com.Rosetta.Model.Type exposing (ZonedDateTime)
import Com.Rosetta.Model.Type exposing (Date)

-- This file is auto-generated from the ISDA Common Domain Model, do not edit.
-- Version: ${project.version}



onlyElement : List a -> Maybe a
onlyElement list =
case list of
[ a ] ->
Just a

_ ->
Nothing

flatten : List (List a) -> List a
flatten =
List.foldr (++) []
3 changes: 1 addition & 2 deletions rosetta-elm-gen/minimal/src/Com/Rosetta/Model/Type.elm
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module Com.Rosetta.Model.Type exposing (..)
import Morphir.SDK.LocalDate exposing (LocalDate)
import Morphir.SDK.LocalTime exposing (LocalTime)

type alias Date =
Expand All @@ -9,7 +8,7 @@ type alias Date =
}

type alias ZonedDateTime =
{ date : LocalDate
{ date : Date
, time : LocalTime
, timezone : String
}
54 changes: 54 additions & 0 deletions rosetta-elm-gen/minimal/src/Finos/Labs/Morphir/Techsprint/Rule.elm
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
module Finos.Labs.Morphir.Techsprint.Rule exposing (..)

import Morphir.SDK.LocalDate exposing (LocalDate)
import Morphir.SDK.LocalTime exposing (LocalTime)
import Com.Rosetta.Model.Type exposing (ZonedDateTime)
import Com.Rosetta.Model.Type exposing (Date)

import Finos.Labs.Morphir.Techsprint.Enum as Enum
import Finos.Labs.Morphir.Techsprint.Enum exposing (EventTimestampQualificationEnum)
import Finos.Labs.Morphir.Techsprint.Type exposing (ReportableEvent)
import Finos.Labs.Morphir.Techsprint.Type exposing (WorkflowStep)
import Finos.Labs.Morphir.Techsprint.Type exposing (EventTimestamp)
import Finos.Labs.Morphir.Techsprint.Type exposing (TradeState)
import Finos.Labs.Morphir.Techsprint.Type exposing (Trade)
import Finos.Labs.Morphir.Techsprint.Type exposing (CFTCPart45TransactionReport)
-- This file is auto-generated from the ISDA Common Domain Model, do not edit.
-- Version: ${project.version}

cFTCPart45TransactionReport : ReportableEvent -> CFTCPart45TransactionReport
cFTCPart45TransactionReport reportableEvent =
{ tradeDate = tradeDate reportableEvent
, eventTimestamp = eventTimestamp reportableEvent
}

eventTimestamp : ReportableEvent -> Maybe ZonedDateTime
eventTimestamp reportableEvent =
reportableEvent.originatingWorkflowStep.timestamp
|> List.filter
(\ item -> item.qualification == Enum.EventCreationDateTime
)
|> List.map
(\ item -> item.dateTime
)
|> onlyElement

tradeDate : ReportableEvent -> Date
tradeDate reportableEvent =
reportableEvent.reportableTrade.trade.tradeDate




onlyElement : List a -> Maybe a
onlyElement list =
case list of
[ a ] ->
Just a

_ ->
Nothing

flatten : List (List a) -> List a
flatten =
List.foldr (++) []
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Finos.Labs.Morphir.Techsprint.Enum exposing (EventTimestampQualificationE


type alias CFTCPart45TransactionReport =
{ tradeDate : LocalDate
{ tradeDate : Date
, eventTimestamp : Maybe ZonedDateTime
}
-- A class to represent the various set of timestamps that can be associated with lifecycle events, as a collection of [dateTime, qualifier].
Expand All @@ -29,7 +29,7 @@ type alias ReportableEvent =
}
-- Defines the output of a financial transaction between parties - a Business Event. A Trade impacts the financial position (i.e. the balance sheet) of involved parties.
type alias Trade =
{ tradeDate : LocalDate -- Specifies the date which the trade was agreed.
{ tradeDate : Date -- Specifies the date which the trade was agreed.
}
-- Defines the fundamental financial information that can be changed by a Primitive Event and by extension any business or life-cycle event. Each TradeState specifies where a Trade is in its life-cycle. TradeState is a root type and as such, can be created independently to any other CDM data type, but can also be used as part of the CDM Event Model.
type alias TradeState =
Expand Down
24 changes: 24 additions & 0 deletions rosetta-elm-gen/model/src/Com/Rosetta/Model/Rule.elm
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module Com.Rosetta.Model.Rule exposing (..)

import Morphir.SDK.LocalDate exposing (LocalDate)
import Morphir.SDK.LocalTime exposing (LocalTime)
import Com.Rosetta.Model.Type exposing (ZonedDateTime)
import Com.Rosetta.Model.Type exposing (Date)

-- This file is auto-generated from the ISDA Common Domain Model, do not edit.
-- Version: ${project.version}



onlyElement : List a -> Maybe a
onlyElement list =
case list of
[ a ] ->
Just a

_ ->
Nothing

flatten : List (List a) -> List a
flatten =
List.foldr (++) []
3 changes: 1 addition & 2 deletions rosetta-elm-gen/model/src/Com/Rosetta/Model/Type.elm
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module Com.Rosetta.Model.Type exposing (..)
import Morphir.SDK.LocalDate exposing (LocalDate)
import Morphir.SDK.LocalTime exposing (LocalTime)

type alias Date =
Expand All @@ -9,7 +8,7 @@ type alias Date =
}

type alias ZonedDateTime =
{ date : LocalDate
{ date : Date
, time : LocalTime
, timezone : String
}
87 changes: 87 additions & 0 deletions rosetta-elm-gen/model/src/Finos/Labs/Morphir/Techsprint/Rule.elm
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
module Finos.Labs.Morphir.Techsprint.Rule exposing (..)

import Morphir.SDK.LocalDate exposing (LocalDate)
import Morphir.SDK.LocalTime exposing (LocalTime)
import Com.Rosetta.Model.Type exposing (ZonedDateTime)
import Com.Rosetta.Model.Type exposing (Date)

import Finos.Labs.Morphir.Techsprint.Enum as Enum
import Finos.Labs.Morphir.Techsprint.Enum exposing (TradeIdentifierTypeEnum)
import Finos.Labs.Morphir.Techsprint.Enum exposing (PartyRoleEnum)
import Finos.Labs.Morphir.Techsprint.Enum exposing (RegimeNameEnum)
import Finos.Labs.Morphir.Techsprint.Enum exposing (SupervisoryBodyEnum)
import Finos.Labs.Morphir.Techsprint.Enum exposing (ExecutionVenueTypeEnum)
import Finos.Labs.Morphir.Techsprint.Enum exposing (ReportingRoleEnum)
import Finos.Labs.Morphir.Techsprint.Enum exposing (OrganizationCharacteristicEnum)
import Finos.Labs.Morphir.Techsprint.Enum exposing (TransactionCharacteristicEnum)
import Finos.Labs.Morphir.Techsprint.Enum exposing (ClearingExceptionReasonEnum)
import Finos.Labs.Morphir.Techsprint.Enum exposing (CreditDocumentEnum)
import Finos.Labs.Morphir.Techsprint.Enum exposing (NatureOfPartyEnum)
import Finos.Labs.Morphir.Techsprint.Enum exposing (FinancialSectorEnum)
import Finos.Labs.Morphir.Techsprint.Enum exposing (NonFinancialSectorEnum)
import Finos.Labs.Morphir.Techsprint.Enum exposing (SECEntityClassificationEnum)
import Finos.Labs.Morphir.Techsprint.Enum exposing (EventTimestampQualificationEnum)
import Finos.Labs.Morphir.Techsprint.Enum exposing (CategoryEnum)
import Finos.Labs.Morphir.Techsprint.Enum exposing (NaturalPersonRoleEnum)
import Finos.Labs.Morphir.Techsprint.Enum exposing (GoverningLawEnum)
import Finos.Labs.Morphir.Techsprint.Type exposing (ReportableEvent)
import Finos.Labs.Morphir.Techsprint.Type exposing (WorkflowStep)
import Finos.Labs.Morphir.Techsprint.Type exposing (MessageInformation)
import Finos.Labs.Morphir.Techsprint.Type exposing (EventTimestamp)
import Finos.Labs.Morphir.Techsprint.Type exposing (BusinessEvent)
import Finos.Labs.Morphir.Techsprint.Type exposing (Instruction)
import Finos.Labs.Morphir.Techsprint.Type exposing (PrimitiveInstruction)
import Finos.Labs.Morphir.Techsprint.Type exposing (TradeState)
import Finos.Labs.Morphir.Techsprint.Type exposing (Trade)
import Finos.Labs.Morphir.Techsprint.Type exposing (Identifier)
import Finos.Labs.Morphir.Techsprint.Type exposing (Party)
import Finos.Labs.Morphir.Techsprint.Type exposing (NaturalPerson)
import Finos.Labs.Morphir.Techsprint.Type exposing (AssignedIdentifier)
import Finos.Labs.Morphir.Techsprint.Type exposing (PartyRole)
import Finos.Labs.Morphir.Techsprint.Type exposing (ReportableInformation)
import Finos.Labs.Morphir.Techsprint.Type exposing (RegulatorApplicability)
import Finos.Labs.Morphir.Techsprint.Type exposing (PartyInformation)
import Finos.Labs.Morphir.Techsprint.Type exposing (RelatedParty)
import Finos.Labs.Morphir.Techsprint.Type exposing (CFTCPartyInformation)
import Finos.Labs.Morphir.Techsprint.Type exposing (ClearingException)
import Finos.Labs.Morphir.Techsprint.Type exposing (ClearingExceptionDeclaration)
import Finos.Labs.Morphir.Techsprint.Type exposing (ESMAPartyInformation)
import Finos.Labs.Morphir.Techsprint.Type exposing (CorporateSector)
import Finos.Labs.Morphir.Techsprint.Type exposing (NonFinancialSector)
import Finos.Labs.Morphir.Techsprint.Type exposing (SECPartyInformation)
import Finos.Labs.Morphir.Techsprint.Type exposing (ContractDetails)
import Finos.Labs.Morphir.Techsprint.Type exposing (PartyContractInformation)
import Finos.Labs.Morphir.Techsprint.Type exposing (NaturalPersonRole)
import Finos.Labs.Morphir.Techsprint.Type exposing (CFTCPart45TransactionReport)
-- This file is auto-generated from the ISDA Common Domain Model, do not edit.
-- Version: ${project.version}

cFTCPart45TransactionReport : ReportableEvent -> CFTCPart45TransactionReport
cFTCPart45TransactionReport reportableEvent =
{ tradeDate = tradeDate reportableEvent
, eventTimestamp = eventTimestamp reportableEvent
}

tradeDate : ReportableEvent -> Date
tradeDate reportableEvent =
reportableEvent.reportableTrade.trade.tradeDate

eventTimestamp : ReportableEvent -> ZonedDateTime
eventTimestamp reportableEvent =
reportableEvent.originatingWorkflowStep.timestamp




onlyElement : List a -> Maybe a
onlyElement list =
case list of
[ a ] ->
Just a

_ ->
Nothing

flatten : List (List a) -> List a
flatten =
List.foldr (++) []
20 changes: 10 additions & 10 deletions rosetta-elm-gen/model/src/Finos/Labs/Morphir/Techsprint/Type.elm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type alias BusinessEvent =
, after : List TradeState -- Specifies the after trade state(s) created.
}
type alias CFTCPart45TransactionReport =
{ tradeDate : LocalDate
{ tradeDate : Date
, eventTimestamp : ZonedDateTime
, cleared : String
, centralCounterparty : Maybe String
Expand Down Expand Up @@ -101,8 +101,8 @@ type alias CFTCPart45TransactionReport =
, fixedRateDayCountConventionLeg2 : Maybe String
, floatingRateDayCountConventionLeg1 : Maybe String
, floatingRateDayCountConventionLeg2 : Maybe String
, fixingDateLeg1 : Maybe LocalDate
, fixingDateLeg2 : Maybe LocalDate
, fixingDateLeg1 : Maybe Date
, fixingDateLeg2 : Maybe Date
, floatingRateResetFrequencyPeriodLeg1 : Maybe String
, floatingRateResetFrequencyPeriodLeg2 : Maybe String
, floatingRateResetFrequencyPeriodMultiplierLeg1 : Maybe Int
Expand Down Expand Up @@ -135,23 +135,23 @@ type alias CFTCPart45TransactionReport =
, strikePriceNotation : Maybe String
, optionPremiumAmount : Maybe Float
, optionPremiumCurrency : Maybe String
, optionPremiumPaymentDate : Maybe LocalDate
, firstExerciseDate : Maybe LocalDate
, optionPremiumPaymentDate : Maybe Date
, firstExerciseDate : Maybe Date
, cDSIndexAttachmentPoint : Maybe Float
, cDSIndexDetachmentPoint : Maybe Float
, indexFactor : Maybe Float
, embeddedOptionType : Maybe String
, uniqueProductIdentifier : Maybe String
, finalContractualSettlementDate : LocalDate
, finalContractualSettlementDate : Date
, settlementCurrencyLeg1 : Maybe String
, settlementCurrencyLeg2 : Maybe String
, settlementLocationLeg1 : Maybe String
, settlementLocationLeg2 : Maybe String
, allocationIndicator : String
, nonStandardizedTermIndicator : Maybe String
, blockTradeElectionIndicator : Bool
, effectiveDate : LocalDate
, expirationDate : LocalDate
, effectiveDate : Date
, expirationDate : Date
, executionTimestamp : ZonedDateTime
, reportingTimestamp : ZonedDateTime
, platformIdentifier : Maybe String
Expand Down Expand Up @@ -231,7 +231,7 @@ type alias NaturalPerson =
, initial : List String -- The natural person's middle initial(s). If a middle initial is provided then a name should be absent.
, surname : Maybe String -- The natural person's surname.
, suffix : Maybe String -- Name suffix, such as Jr., III, etc.
, dateOfBirth : Maybe LocalDate -- The natural person's date of birth.
, dateOfBirth : Maybe Date -- The natural person's date of birth.
}
-- A class to specify the role(s) that natural person(s) may have in relation to the contract.
type alias NaturalPersonRole =
Expand Down Expand Up @@ -304,7 +304,7 @@ type alias SECPartyInformation =
-- Defines the output of a financial transaction between parties - a Business Event. A Trade impacts the financial position (i.e. the balance sheet) of involved parties.
type alias Trade =
{ tradeIdentifier : List Identifier -- Represents the identifier(s) that uniquely identify a trade for an identity issuer. A trade can include multiple identifiers, for example a trade that is reportable to both the CFTC and ESMA, and then has an associated USI (Unique Swap Identifier) UTI (Unique Trade Identifier).
, tradeDate : LocalDate -- Specifies the date which the trade was agreed.
, tradeDate : Date -- Specifies the date which the trade was agreed.
, party : List Party -- Represents the parties to the trade. The cardinality is optional to address the case where the trade is defined within a BusinessEvent data type, in which case the party is specified in BusinessEvent.
, partyRole : List PartyRole -- Represents the role each specified party takes in the trade. further to the principal roles, payer and receiver.
, contractDetails : Maybe ContractDetails -- Represents information specific to trades involving contractual products.
Expand Down

0 comments on commit d1975d4

Please sign in to comment.