From 3f728dcaff484385acc748766e1bbd1373e67696 Mon Sep 17 00:00:00 2001 From: Michael Fliegner Date: Mon, 26 Sep 2022 14:13:07 +0200 Subject: [PATCH] 0.4.0 dep BitemporalPostgres 1.1.4 --- Manifest.toml | 22 ++++---- Project.toml | 1 + testModelCompare.ipynb | 123 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 134 insertions(+), 12 deletions(-) create mode 100644 testModelCompare.ipynb diff --git a/Manifest.toml b/Manifest.toml index 560d948..997220c 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -2,7 +2,7 @@ julia_version = "1.8.0" manifest_format = "2.0" -project_hash = "dd4375ead039dbffa6197d5da8dc8b89f8be87cb" +project_hash = "f43d39537a5b3ffc3f960dcdf9e44421212139fb" [[deps.AbstractTrees]] git-tree-sha1 = "5c0b629df8a5566a06f5fef5100b53ea56e465a0" @@ -27,9 +27,7 @@ uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" [[deps.BitemporalPostgres]] deps = ["AbstractTrees", "Dates", "Intervals", "Logging", "Pkg", "SearchLight", "SearchLightPostgreSQL", "Test", "TimeZones", "ToStruct", "YAML"] -git-tree-sha1 = "9e6e7e2319f86507d44075690d720ca041f0d570" -repo-rev = "main" -repo-url = "https://github.com/Actuarial-Sciences-for-Africa-ASA/BitemporalPostgres.jl" +git-tree-sha1 = "180f11e9a9e5fc2a3efb4067b0e684e587607957" uuid = "e513cd14-23e6-48df-acf1-d9bc8fa5674b" version = "1.4.1" @@ -40,9 +38,9 @@ version = "0.4.2" [[deps.ChainRulesCore]] deps = ["Compat", "LinearAlgebra", "SparseArrays"] -git-tree-sha1 = "dc4405cee4b2fe9e1108caec2d760b7ea758eca2" +git-tree-sha1 = "e7ff6cadf743c098e08fca25c91103ee4303c9bb" uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" -version = "1.15.5" +version = "1.15.6" [[deps.ChangesOfVariables]] deps = ["ChainRulesCore", "LinearAlgebra", "Test"] @@ -97,15 +95,15 @@ uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f" version = "4.1.1" [[deps.DataAPI]] -git-tree-sha1 = "fb5f5316dd3fd4c5e7c30a24d50643b73e37cd40" +git-tree-sha1 = "1106fa7e1256b402a86a8e7b15c00c85036fef49" uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a" -version = "1.10.0" +version = "1.11.0" [[deps.DataFrames]] deps = ["Compat", "DataAPI", "Future", "InvertedIndices", "IteratorInterfaceExtensions", "LinearAlgebra", "Markdown", "Missings", "PooledArrays", "PrettyTables", "Printf", "REPL", "Reexport", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"] -git-tree-sha1 = "6bce52b2060598d8caaed807ec6d6da2a1de949e" +git-tree-sha1 = "db2a9cb664fcea7836da4b414c3278d71dd602d2" uuid = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" -version = "1.3.5" +version = "1.3.6" [[deps.DataStructures]] deps = ["Compat", "InteractiveUtils", "OrderedCollections"] @@ -535,9 +533,9 @@ version = "1.0.1" [[deps.Tables]] deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "OrderedCollections", "TableTraits", "Test"] -git-tree-sha1 = "5ce79ce186cc678bbb5c5681ca3379d1ddae11a1" +git-tree-sha1 = "2d7164f7b8a066bcfa6224e67736ce0eb54aef5b" uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" -version = "1.7.0" +version = "1.9.0" [[deps.Tar]] deps = ["ArgTools", "SHA"] diff --git a/Project.toml b/Project.toml index e71a08f..abe2e21 100644 --- a/Project.toml +++ b/Project.toml @@ -20,6 +20,7 @@ TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53" ToStruct = "43ec2cc1-0e50-5406-a854-b7ff8fdb8dad" [compat] +BitemporalPostgres = "1.4.1" ColorSchemes = "3" DataFrames = "1" Intervals = "1.6.0" diff --git a/testModelCompare.ipynb b/testModelCompare.ipynb new file mode 100644 index 0000000..2f679ca --- /dev/null +++ b/testModelCompare.ipynb @@ -0,0 +1,123 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Dict{String, Any} with 8 entries:\n", + " \"tsdb_validfrom\" => \"2022-09-26T11:30:44.483+00:00\"\n", + " \"ref_history\" => Dict{String, Any}(\"value\"=>9)\n", + " \"revision\" => Dict{String, Any}(\"ref_validfrom\"=>Dict{String, Any}(\"val…\n", + " \"partner_refs\" => Any[Dict{String, Any}(\"rev\"=>Dict{String, Any}(\"ref_valid…\n", + " \"ref_entities\" => Dict{String, Any}()\n", + " \"ref_version\" => Dict{String, Any}(\"value\"=>12)\n", + " \"tsw_validfrom\" => \"2022-09-26T11:30:44.483+00:00\"\n", + " \"product_items\" => Any[Dict{String, Any}(\"tariff_items\"=>Any[Dict{String, An…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "push!(LOAD_PATH, \"src\")\n", + "using JSON, LifeInsuranceDataModel, SearchLight, TimeZones, ToStruct\n", + "ENV[\"SEARCHLIGHT_USERNAME\"] = \"bitemporalpostgres\"\n", + "ENV[\"SEARCHLIGHT_PASSWORD\"] = \"jw8s0F49KL\"\n", + "\n", + "model0 = JSON.parse(JSON.json(csection(1, now(tz\"UTC\"), now(tz\"UTC\"))))\n", + "model1 = JSON.parse(JSON.json(csection(1, now(tz\"UTC\"), now(tz\"UTC\"))))\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "KeySet for a Dict{String, Any} with 5 entries. Keys:\n", + " \"ref_validfrom\"\n", + " \"ref_invalidfrom\"\n", + " \"ref_component\"\n", + " \"id\"\n", + " \"description\"" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "model0[\"revision\"]\n", + "keys(model0[\"revision\"])\n", + "\n", + "model1[\"revision\"][\"id\"][\"value\"] = nothing\n", + "model1[\"revision\"][\"description\"]= \"first mutation by GUI model\"\n", + "\n", + "model1[\"revision\"]\n", + "ToStruct.tostruct(ContractRevision, model1[\"revision\"])\n" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "\" diff for ref_component eq for id eq for description\"" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "function compareModelState(previous::Dict{String,Any}, current::Dict{String,Any})\n", + " println(\"huhu\")\n", + "end\n", + "\n", + "function compareRevisions(previous::Dict{String,Any}, current::Dict{String,Any})\n", + " diff = \"\"\n", + " for (key, previous_value) in previous\n", + " if !(key in (\"ref_validfrom\", \"ref_invalidfrom\"))\n", + " let current_value = current[key]\n", + " if previous_value != current_value\n", + " diff = diff * \" diff for \" * key\n", + " else\n", + " diff = diff * \" eq for \" * key\n", + " end\n", + " end\n", + " end\n", + " end\n", + " diff\n", + "end\n", + "compareRevisions(model0[\"revision\"], model1[\"revision\"])" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Julia 1.8.0", + "language": "julia", + "name": "julia-1.8" + }, + "language_info": { + "file_extension": ".jl", + "mimetype": "application/julia", + "name": "julia", + "version": "1.8.0" + }, + "orig_nbformat": 4 + }, + "nbformat": 4, + "nbformat_minor": 2 +}