Coder Social home page Coder Social logo

accordproject / cicero-template-library Goto Github PK

View Code? Open in Web Editor NEW
79.0 79.0 95.0 22.31 MB

Accord Project Template Library

Home Page: https://templates.accordproject.org

License: Apache License 2.0

JavaScript 0.14% HTML 98.25% Gherkin 1.06% Rich Text Format 0.30% CSS 0.11% Nunjucks 0.14%
cicero cicero-templating

cicero-template-library's People

Contributors

4katie avatar aniruddha-shriwant avatar arteevraina avatar daniloff200 avatar dependabot[bot] avatar dianalease avatar distributedlock avatar dlkconsultancy avatar doomswatter avatar dselman avatar irmerk avatar javiercanossini avatar jeromesimeon avatar kanav-raina avatar kewbish avatar martinhalford avatar mengwong avatar michael-grover avatar michizhou avatar mttrbrts avatar nicbritz avatar peterhunn avatar petrgazarov avatar rniordson avatar sidhyatikku avatar steffinstanly avatar tkuhrt avatar utajum avatar vishals99 avatar yash-garg 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cicero-template-library's Issues

Remove Language column from main page

All templates are now migrated to Ergo, and we plan and deprecate source templates using JavaScript, so the corresponding language column in the index on the main page seem superfluous.

screen shot 2018-12-07 at 2 31 16 pm

New Parser: Copyright License

Bug Report πŸ›

Working with a micropublish of the new Cicero parser and the generated template, crashing on load

Expected Behavior

Load without crashing

Current Behavior

TypeError: Cannot read property 'slice' of undefined
    at index.esm.js:1
    at Oe (index.esm.js:1)
    at index.esm.js:1
    at renderWithHooks (react-dom.development.js:14803)
    at updateForwardRef (react-dom.development.js:16816)
    at beginWork (react-dom.development.js:18645)
    at HTMLUnknownElement.callCallback (react-dom.development.js:188)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:237)
    at invokeGuardedCallback (react-dom.development.js:292)
    at beginWork$1 (react-dom.development.js:23203)

Possible Solution

This may be in the rendering for the ClauseComponent in web-components

Steps to Reproduce

  1. Working off this branch
  2. Update latest micropublish of Cicero (v0.21) Parser Branch and markdown-transform
  3. Load https://parserv2--templates-accordproject.netlify.app/archives/[email protected] in storybook

Context (Environment)

Desktop

latedeliveryandpenalty contract ignoring deliveredAt

the current version of the latedeliveryandpenalty clause compares the delivery date against the current date and time, where previously it was checked against the 'deliveredAt' date and time. Perhaps the logic could be improved to check for the presence of deliveredAt and only use the current time if it is there is no deliveredAt specified

Update Markdown Files

Tasks

  • Take another pass through the templates
    • Ensure .md files have markdown
    • Also ensure the markdown is correct and tests pass

Related Issues:

  • N/A

Hacktoberfest:

This issue can provide for multiple pull requests.

update: copyright year in footer

I was exploring the website and found the copyright year 2018-2022 on the documentation page so updating the same in template library pages.

Migrate CI/CD to GitHub Actions

As described in accordproject/technical-steering-committee#4

Please follow the conventions in accordproject/concerto#236

  • Remove secrets from Travis (for AP maintainers: in Travis Repository Settings)
  • Disable Travis in the configuration (for AP maintainers: Travis Personal Profile > Settings > Accord Project
  • Remove .travis.yml and .travis directories in repo
  • Add .github/workflows directory based on those in ./concerto/.github/workflows
  • Remove scripts in ./scripts replace by those found in ./concerto/scripts
  • Fix package.json notable adjustments: remove some of the old scripts, make sure code coverage works
  • Test build on PR with timestamps
  • Test build on GitHub release with version number
  • Update GitHub "branch protection" rules to point to the new workflows instead of Travis

Perishable Goods should be stateful

We should re-implement the Perishable-Goods template to be stateful. This would allow sensor readings to be submitted one by one (or in small batches). The min/max values would be kept in state. When the shipment is received a payment obligation is emitted and the contract state is set to COMPLETED. If sensor readings are received after the due date of the contract notifications can be emitted that the contract is late.

Refactor templates to use common types

The templates are starting to suffer from duplication of common types. They need to be refactored to import shared definitions of these types.

The following common types have been identified in the existing templates:

  • Duration
  • Temporal Unit
  • State
  • Entity Type
  • Address
  • Monetary Amount
  • Percentage
  • Year
  • Quarter In Year
  • Sensor Reading
    • Accelerometer
    • Temperature
    • Humidity
  • Unit of Weight
  • Business
  • Legal Entity
  • Currency
  • Company Type

minilatedeliveryandpenalty: Buyer and Seller should be swapped

Is your feature request related to a problem? Please describe.
[{buyer}] shall pay to [{seller}] a penalty -- the two placeholders should be swapped

Describe the solution you'd like
Template text should be fixed so that seller pays buyer a penalty

Describe alternatives you've considered
N/A

Additional context
Similar problem with minilatedeliveryandpenalty-payment, minilatedeliveryandpenalty-capped, simplelatedeliveryandpenalty templates

String error at ~/src/supply-agreement-loc/text/grammar.tem.md

Hi, This is Eason.
I am the GSoC Student at Accord Project working on Automatic Identification And Classification of Contract Data Types with NLP Models.

Currently, I'm working on data mining for contract template library to analyze and prepare data for Deep Learning.
And I will report some bug I found durning my work.

I found a bug at ~/src/supply-agreement-loc/text/grammar.tem.md and ~/src/supply-agreement-loc/text/sample.md around line 85

the text currently is : the {[exporter}} consents in writing, or
I expect it is: the {{exporter}} consents in writing, or

It should be {{ not {[

Also, I want to know what should I do if I found similar bug afterward.
Can I send PR directly?
Or Should I open an issue like this one?

Thanks for your attention.

Cannot distinguish which class is a request for some of these

This is not exactly a bug, more a topic for discussion and a problem for me.

For the ContractPen (contractpen.com) project I have developed an importer which imports this code into ContractPen data models. In the case of Eat Apples it is difficult to determine which class is the request class by looking at the model code alone.

https://github.com/accordproject/cicero-template-library/blob/master/src/eat-apples/models/model.cto

Although I can determine it by looking at the Ergo code, my opinion - it would be nice to require request classes to be marked as request somehow, either by inheritance or other.

Invalid Link for Docusign Connect at Home Page

Bug Report πŸ›

Hi, I’m exploring template studio and found a invalid link:
https://templates.accordproject.org/[email protected]

Which at https://templates.accordproject.org/

Expected Behavior

It should work
It work If the URL is https://templates.accordproject.org/[email protected]

Current Behavior

https://templates.accordproject.org/[email protected]

Possible Solution

Steps to Reproduce

  1. Go to https://templates.accordproject.org/
  2. Click docusign-connect
  3. You go to https://templates.accordproject.org/[email protected]

Context (Environment)

Desktop

  • OS: macOS
  • Browser: Chrome

Detailed Description

Possible Implementation

Change the URL link. maybe from docusign-connect's package.json.

Migrate template tests to new Cucumber-Gherkin syntax

Cicero now has support for https://cucumber.io for testing templates. This means we can start migrating templates to that new syntax.

Current work migrating templates is on the following branch: https://github.com/accordproject/cicero-template-library/tree/js-feature-cucumber

Here is the list of templates to be migrated:

Promissory Note template tests do not work as intended

Describe the bug
The test uses a fixed time and the local timezone of the system running the test, which leads to discrepancies with calculation of the compounded interest. This is not an issue in production, but my timezone is the Indian Standard TIme (IST) or UTC +5:30, so the test fails.

To Reproduce
Steps to reproduce the behavior:

  1. Go to /cicero-template-library/src/promissory-note/
  2. Run npm run test
  3. Output shows test failing due to mismatch of expected value with actual value of the compound interest.

Expected behavior
The test was supposed to pass with expected value being equal to actual value.

Screenshots
Screenshot from 2019-10-30 19-48-35

Desktop (please complete the following information):

  • OS: Ubuntu 18.04

Additional context
N/A

Lawyer contributions

Lawyers would like to contribute to this library. In order of importance, lawyers would like to:

  1. contribute representative template clause and contract text
  2. contribute parameterized template grammar
  3. contribute template models
  4. write and contribute Ergo logic
  5. see a template 'in action' somehow

Publish to templates.accordproject.org

Create a build process that publishes the templates to templates.accordproject.org.

  • Run unit tests for each template

  • We can build archives for each template (which will resolve all the external dependencies, so they load fast and are validated).

  • We can name each archive using the fqn of the template model, plus the version number from package.json.

  • Save all versions of a valid template to cheap and reliable object/document storage

  • Generate an HTML overview page for each archive in object store, based on the README, package.json (compatible Cicero version) model info etc (edited)

  • We can link from the template HTML page to the model HTML page for external dependencies.

  • We can also publish an index.json file with metadata so that tools can quickly find templates based on metadata. (edited)

  • Add Template.fromArchive(url) to load a template from a URL

New Parser: Supply Agreement Perishable Goods

Bug Report πŸ›

Working with a micropublish of the new Cicero parser and the generated template, crashing on load

Expected Behavior

Successful render

Current Behavior

Uncaught (in promise) Error: Inconsistent values for variable shipment: SHIP_001 and Grade I, Size 4, Zutano Mexican Avocados

Steps to Reproduce

  1. Working off this branch
  2. Update latest micropublish of Cicero (v0.21) Parser Branch and markdown-transform
  3. Load https://parserv2--templates-accordproject.netlify.app/archives/[email protected] in storybook

Context (Environment)

Desktop

Publish Compiled Archives

Feature Request πŸ›οΈ

A user should be able to download specific compiled archives in addition to or instead of the source code archive

Use Case

Specific:

We are building a Cicero Word Add-In. Within the desktop version of Word, the embedded MS Edge browser which handles add-ins cannot seem to handle the action of fromUrl and fromArchive, which compiles Ergo into Javascript. Aside from utilizing web workers, accessing a pre-compiled archive from URL would be useful.

Hypothetical:

A user should be able to access compiled versions of the archive for their specific use case (ES6, WASM, etc.)

Possible Solution

Adjust the build script for the templates to publish an ES6 compiled archive now, and further versions in the future. This will require strict semantic versioning.

Context

Uncertain if Word is indeed using Edge for Add-Ins. Word online in the Edge browser works without issue. Also uncertain if web workers would solve the issue.

New Parser: SAFT

Bug Report πŸ›

Working with a micropublish of the new Cicero parser and the generated template, crashing on load

Expected Behavior

Successful parse

Current Behavior

Initial parse error

Steps to Reproduce

  1. Working off this branch
  2. Update latest micropublish of Cicero (v0.21) Parser Branch and markdown-transform
  3. Load https://parserv2--templates-accordproject.netlify.app/archives/[email protected] in storybook

Context (Environment)

Desktop

New Parser: Interest Rate Swap

Bug Report πŸ›

Working with a micropublish of the new Cicero parser and the generated template, crashing on load

Expected Behavior

Hide and reveal optional variables (with nothing else in optional)

Current Behavior

When hiding one of the optional variables, receive ParseException:

Screen Shot 2020-07-15 at 3 57 20 PM

Uncaught (in promise) ParseException: Parse error at line 42 column 39
Floating Rate Day Count Fraction: "30"
                                      
Expected: ' '
    at _throwParseError (http://localhost:9009/vendors~main.9a1e714796444341673e.bundle.js:59473:11)
    at TemplateMarkTransformer.dataFromCiceroMark (http://localhost:9009/vendors~main.9a1e714796444341673e.bundle.js:59560:13)
    at Clause.parse (http://localhost:9009/vendors~main.9a1e714796444341673e.bundle.js:1643:42)
    at http://localhost:9009/main.9a1e714796444341673e.bundle.js:1073:18
    at http://localhost:9009/main.9a1e714796444341673e.bundle.js:1107:5
    at invokeFunc (http://localhost:9009/vendors~main.9a1e714796444341673e.bundle.js:287115:23)
    at trailingEdge (http://localhost:9009/vendors~main.9a1e714796444341673e.bundle.js:287164:18)
    at timerExpired (http://localhost:9009/vendors~main.9a1e714796444341673e.bundle.js:287152:18)

Steps to Reproduce

  1. Working off this branch
  2. Update latest micropublish of Cicero (v0.21) Parser Branch and markdown-transform
  3. Load https://parserv2--templates-accordproject.netlify.app/[email protected] in storybook
  4. Click an optional to hide text

Context (Environment)

Desktop

Introduce Open In VSCode option for templates

Feature Request πŸ›οΈ

An Open in VSCode option can be set up along side Open in Template Studio to let users access templates from the Cicero-template-library repository on GitHub.dev

Use Case

Possible Solution

Context

Detailed Description

New Parser: IP Payment

Bug Report πŸ›

Working with a micropublish of the new Cicero parser and the generated template, crashing on load

Expected Behavior

Successful parse

Current Behavior

Initial parse error

Steps to Reproduce

  1. Working off this branch
  2. Update latest micropublish of Cicero (v0.21) Parser Branch and markdown-transform
  3. Load https://parserv2--templates-accordproject.netlify.app/archives/[email protected] in storybook

Context (Environment)

Desktop

Small bug in the car rental template

Describe the bug
This is a parse error in the car rental template in the template library

To Reproduce
Steps to reproduce the behavior:

  1. Go to the homepage of the Template Studio
  2. Click on Search Template Library
  3. Click on car-rental-tr which is at the second place.

Expected behavior
No error should have occurred.

Screenshots
chrome_1mfxJIgHSI

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Chrome
  • Version 88.0.4324.182

Accord Project logo not showing up in navbar

Screenshot
image

To Reproduce
Steps to reproduce the behavior:

  1. Run a build.
  2. Load build/index.html in the browser manually.

Expected behavior
Logo should appear in the navbar instead of an alternate text

Desktop:

  • OS: Ubuntu 18.04
  • Browser: chrome

Date-time error in demandforecast template

Running the demand forecast template raises an internal moment error/warning:

bash-3.2$ cicero execute --template ./ --dsl ./sample.txt --data ./data.json 
cicero execute --template ./ --dsl ./sample.txt --data ./data.json 
08:44:45 - info: Logging initialized. 2018-04-18T12:44:45.483Z
08:44:46 - info: CICERO-ENGINE {"request":{"$class":"org.accordproject.demandforecast.ForecastRequest","supplyForecast":1200,"transactionId":"9e1e672c-2b5d-4638-964f-6c1b7bbab75b","timestamp":"2018-04-18T12:44:46.449Z"},"response":{"$class":"org.accordproject.demandforecast.BindingResponse","transactionId":"6a3c51a0-e53f-4d20-ad2c-32d32fec8422","timestamp":"2018-04-18T12:44:46.453Z"},"data":{"$class":"org.accordproject.demandforecast.TemplateModel","purchaser":"PETER","supplier":"DAN","effectiveDate":"04/02/2018","minimumPercentage":85}}
Deprecation warning: value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.
Arguments: 
[0] _isAMomentObject: true, _isUTC: false, _useUTC: false, _l: undefined, _i: 04/02/2018, _f: undefined, _strict: undefined, _locale: [object Object]
Error
    at Function.createFromInputFallback (/Users/jeromesimeon/git/cicero/node_modules/moment/moment.js:324:94)
    at configFromString (/Users/jeromesimeon/git/cicero/node_modules/moment/moment.js:2366:11)
    at configFromInput (/Users/jeromesimeon/git/cicero/node_modules/moment/moment.js:2592:9)
    at prepareConfig (/Users/jeromesimeon/git/cicero/node_modules/moment/moment.js:2575:9)
    at createFromConfig (/Users/jeromesimeon/git/cicero/node_modules/moment/moment.js:2542:40)
    at createLocalOrUTC (/Users/jeromesimeon/git/cicero/node_modules/moment/moment.js:2629:12)
    at createLocal (/Users/jeromesimeon/git/cicero/node_modules/moment/moment.js:2633:12)
    at Moment.isBefore (/Users/jeromesimeon/git/cicero/node_modules/moment/moment.js:3200:48)
    at Object.apply (/Users/jeromesimeon/git/cicero/node_modules/vm2/lib/contextify.js:288:34)
    at execute (vm.js:26:13)
08:44:46 - info: {"clause":"demandforecast@0.0.6-4e8927e99afa2d81afcc6ec5241225dd88ce1b72cfa2359dda195d4c2dc0adc8","request":{"$class":"org.accordproject.demandforecast.ForecastRequest","supplyForecast":1200},"response":{"$class":"org.accordproject.demandforecast.BindingResponse","requiredPurchase":1020,"year":2018,"quarter":2,"transactionId":"6a3c51a0-e53f-4d20-ad2c-32d32fec8422","timestamp":"2018-04-18T12:44:46.453Z"}}```

While the system recovers, this should probably be fixed either directly in the logic or in the Cicero grammar visitor for parsing dates.

Cucumber test fail for supplyagreement template

Currently running 12 steps (1 failed, 11 passed) on supplyagreement. When testing, there was an external .js file for state and another for request.

State:

{
   "$class": "org.accordproject.supplyagreement.AgreementState",
   "stateId": "org.accordproject.supplyagreement.AgreementState#1",
   "purchaseObligation" : null,
   "deliveryObligation" : null,
   "paymentObligation" : null
 }

Request:

{
   "$class": "org.accordproject.supplyagreement.ForecastRequest",
   "supplyForecast": 1200.0
}

When command is run cicero execute -β€”request req1.js -β€”state state1.js, this returns:

{
  "clause": "supplyagreement@0.8.1-1b83eed11769be2306c88e8cd56f4b89cfde8644f74db0a7d70ce0b044781a49",
  "request": {
    "$class": "org.accordproject.supplyagreement.ForecastRequest",
    "supplyForecast": 1200
  },
  "response": {
    "$class": "org.accordproject.supplyagreement.ForecastResponse",
    "transactionId": "f4b88cdb-ec55-41d1-bd55-6c6f1648d2ab",
    "timestamp": "2019-02-20T22:52:04.398Z"
  },
  "state": {
    "$class": "org.accordproject.supplyagreement.AgreementState",
    "purchaseObligation": {
      "$class": "org.accordproject.supplyagreement.PurchaseObligation",
      "requiredPurchase": 1020,
      "year": 2019,
      "quarter": 1,
      "party": "PETER"
    },
    "stateId": "org.accordproject.supplyagreement.AgreementState#1"
  },
  "emit": []
}

So, taking that state:

"$class": "org.accordproject.supplyagreement.AgreementState",
"purchaseObligation": {
  "$class": "org.accordproject.supplyagreement.PurchaseObligation",
  "requiredPurchase": 1020,
  "year": 2019,
  "quarter": 1,
  "party": "PETER"
},
"stateId": "org.accordproject.supplyagreement.AgreementState#1"

And listing it as the Then the new state of the contract should be result in the logic.feature file.

Still receiving this error message:

βœ– Then the new state of the contract should be # ../../node_modules/@accordproject/cicero-engine/lib/steps.js:189
       """
       {
           "$class": "org.accordproject.supplyagreement.AgreementState",
           "purchaseObligation": {
             "$class": "org.accordproject.supplyagreement.PurchaseObligation",
             "requiredPurchase": 1020.0,
             "year": 2019,
             "quarter": 1,
             "party": "PETER"
           },
           "stateId": "org.accordproject.supplyagreement.AgreementState#1"
       }
       """
       {}
       Error
           at orgXaccordprojectXsupplyagreementXSupplyAgreement_demandforecast (vm.js:61:11)
           at __dispatch (vm.js:1218:17)
           at vm.js:1198:9
           at ContextifyScript.Script.runInContext (vm.js:59:29)
           at VM.run (/Users/jolenelanglinais/Code/Clause/CucumberWkShp/cicero-template-library/node_modules/vm2/lib/main.js:211:72)
           at Engine.execute (/Users/jolenelanglinais/Code/Clause/CucumberWkShp/cicero-template-library/node_modules/@accordproject/cicero-engine/lib/engine.js:233:27)
           at send (/Users/jolenelanglinais/Code/Clause/CucumberWkShp/cicero-template-library/node_modules/@accordproject/cicero-engine/lib/steps.js:53:19)
           at World.<anonymous> (/Users/jolenelanglinais/Code/Clause/CucumberWkShp/cicero-template-library/node_modules/@accordproject/cicero-engine/lib/steps.js:196:16)

installment-sale template monetary value

Is your feature request related to a problem? Please describe.
The current template for 'installment-sale 0.13.0' uses "total amount e[{INITIAL_DUE}]" or "remaining balance of E[{TOTAL_DUE_BEFORE_CLOSING}]".

Describe the solution you'd like
instead of E, it would be nice to have a currency (EUR, GBP) or a currency symbol.

Describe alternatives you've considered
It may be possible to manually amend the text of the template every time you use it...

Additional context

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.