diff --git a/.gitignore b/.gitignore index aaa7a5f..a0930cb 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ target/ dbt_packages/ logs/ +/profiles.yml # legacy -- renamed to dbt_packages in v1 dbt_modules/ diff --git a/README.md b/README.md index 14d96f1..f3c2f1c 100644 --- a/README.md +++ b/README.md @@ -12,841 +12,4 @@ Try running the following commands: - Check out [Discourse](https://discourse.getdbt.com/) for commonly asked questions and answers - Join the [dbt community](https://getdbt.com/community) to learn from other analytics engineers - Find [dbt events](https://events.getdbt.com) near you -- Check out [the blog](https://blog.getdbt.com/) for the latest news on dbt's development and best practices - -``` -dbt_shofco -├─ .DS_Store -├─ .git -│ ├─ COMMIT_EDITMSG -│ ├─ FETCH_HEAD -│ ├─ HEAD -│ ├─ config -│ ├─ description -│ ├─ hooks -│ │ ├─ applypatch-msg.sample -│ │ ├─ commit-msg.sample -│ │ ├─ fsmonitor-watchman.sample -│ │ ├─ post-update.sample -│ │ ├─ pre-applypatch.sample -│ │ ├─ pre-commit.sample -│ │ ├─ pre-merge-commit.sample -│ │ ├─ pre-push.sample -│ │ ├─ pre-rebase.sample -│ │ ├─ pre-receive.sample -│ │ ├─ prepare-commit-msg.sample -│ │ ├─ push-to-checkout.sample -│ │ └─ update.sample -│ ├─ index -│ ├─ info -│ │ └─ exclude -│ ├─ objects -│ │ ├─ 00 -│ │ │ ├─ 0f926169161f82fdd5675177f0c2a110568184 -│ │ │ ├─ e4e13222fc1f75afdabf5348bd593b7aca4776 -│ │ │ └─ e7a492e6bf8aace89edd91150fd56ec120c3c7 -│ │ ├─ 01 -│ │ │ ├─ 5a930792d972dfd36b1e33bbd098251edb3197 -│ │ │ ├─ 866f73d178f6834e3b3957cfce4b276ebd0f06 -│ │ │ ├─ ad3dc94e56b48c1dad8a257a4c78d8087ccadc -│ │ │ └─ e202e42cb201dc0052ab53c5aca285e1bf39e1 -│ │ ├─ 03 -│ │ │ └─ 1e7d280ea735ea2d26b2cf855668ea365ecf2f -│ │ ├─ 04 -│ │ │ └─ 19203321d0b1e78a3c9eff576d8fcbcd5de0db -│ │ ├─ 05 -│ │ │ ├─ 74692bd6bfbd96fb0e546b3573316e1da533bf -│ │ │ ├─ 8e2c424f317f59113e5e843817b57b1e8b8563 -│ │ │ └─ ad416d07c222ad2abaeb493d2d5ef1c574d465 -│ │ ├─ 07 -│ │ │ ├─ 4ba94b87ad25af2d0eb32dd8c757a040d8138f -│ │ │ └─ ae44e1c5179284a3183bd57995bba950dfd1d3 -│ │ ├─ 08 -│ │ │ └─ f73de2aa9cd58284d4d27dc140cff066cf709b -│ │ ├─ 0a -│ │ │ ├─ 72014183ada440564da66f3406573ff1c06cb8 -│ │ │ └─ c5632e668e192afa157e0a1815499e302198a7 -│ │ ├─ 0b -│ │ │ ├─ 41d3409f1f72c6db067e69986bb711fc9b5794 -│ │ │ ├─ d8368ee8e05c8039766d2b8b295a1787e4b941 -│ │ │ └─ eb7c9f1fcd10c02586b015c6647e5360a24040 -│ │ ├─ 0d -│ │ │ ├─ c9b0a6d677d3cfbb88e680ae94436d9ffa5b76 -│ │ │ └─ e196370ba60ff177bdd2deff7f1f6efc9358a3 -│ │ ├─ 0e -│ │ │ ├─ 045f1fd8e89f23aeca7ad3141fd116277bb6a5 -│ │ │ ├─ aba3f68daf23a3c4f91428b24a5b75a195b024 -│ │ │ └─ cb615bf91a05b301ac75b79ba156039f5c3261 -│ │ ├─ 0f -│ │ │ ├─ 1b77109246d4e2859546103740bb2d0e271970 -│ │ │ └─ 5ace8a3ab3d46d710377c422613c67c59d2720 -│ │ ├─ 10 -│ │ │ ├─ 1ed2f0b51c907c39d9d0d620429bbea17260a1 -│ │ │ └─ a2ad95e245fab3ea54d93125a5d9fba3f39f61 -│ │ ├─ 11 -│ │ │ └─ ed947dc3686429079d66fe311f9f306fca9c21 -│ │ ├─ 12 -│ │ │ ├─ 197b44cc7149a3b109123eaa478f989b22b80d -│ │ │ └─ 906b6cabcb14ffc08282ba6410f47e5c8fa65d -│ │ ├─ 14 -│ │ │ ├─ 3e57f8589d77322f72d90740c4256e08a3008c -│ │ │ ├─ d446c5bfb321a8afb6b858bb1ce04689cf3674 -│ │ │ └─ f12192adbd06deb82ec02495c711abca10498b -│ │ ├─ 15 -│ │ │ ├─ 8ed962c9bc5112337acb6eba6d4ddcf267649f -│ │ │ └─ b887800c044ddd9fa3458d293c6e9285ef42f2 -│ │ ├─ 17 -│ │ │ └─ 60b7258360a94589933440053740e842206098 -│ │ ├─ 18 -│ │ │ ├─ 35aed386d8a2be9728e7ddbe8038fbeff4d90f -│ │ │ ├─ c9e0ebf549b7de0b4d32c7e3a9631d9df7aaa6 -│ │ │ └─ fdb14d38a1b21780299aa8aa80bcc08d505e85 -│ │ ├─ 19 -│ │ │ ├─ 2fd7cd5672d065a8ab882d195bf6646c76fbb1 -│ │ │ ├─ 5c376c39da749db0f006b5c977073d218e711b -│ │ │ ├─ 629972547651b912592901a2e737af505e7899 -│ │ │ └─ e7492ad6cb2106c69451683c1dba4d31f1c235 -│ │ ├─ 1a -│ │ │ ├─ 0d03cf5c7bf8695572e48ff0f81007b78c6676 -│ │ │ ├─ 3d3b0bef1f7e31326672b55b5dd1f5dd6a5893 -│ │ │ ├─ a78b4ef2ba53e2ea7f3cc9a51de7f9ec863145 -│ │ │ └─ cb5a25b43e0cc5ce5c6bdcba8d52f7d176cc3f -│ │ ├─ 1b -│ │ │ └─ 1f232ad16116507d36bafcdb252e415c2c67d8 -│ │ ├─ 1c -│ │ │ ├─ 27bbd386bf1417f0531f3d69180a90523fcee4 -│ │ │ ├─ 8edcc0570e3dd3e55613a48676e79efcb308fa -│ │ │ └─ ac71a8f7ae20b4c7d7a49c2d5862d2ab589b09 -│ │ ├─ 1e -│ │ │ ├─ 0b6c933210b59d7053a51adcf38281de64e1e4 -│ │ │ ├─ 8b3776dcd8fd8666d68a7009db74f80b1dc808 -│ │ │ └─ 96707cceb8436eb98e4de72bfe001482e06c40 -│ │ ├─ 1f -│ │ │ └─ b5e00b9868149c32dbf7333fdf65c0ed9631d1 -│ │ ├─ 21 -│ │ │ └─ 2d172b98b86154997b6236cb70412210155420 -│ │ ├─ 23 -│ │ │ ├─ 12568724917acf7a3f17d367b19ed25e86b108 -│ │ │ ├─ 386a94cfc7ddc2ea183de47b2db34a6f4927a3 -│ │ │ └─ b196c40d9a1555c54c1cdc7bcb63dc43601f6b -│ │ ├─ 24 -│ │ │ ├─ 3aa59a20a1792220c1a9229c5737b286b0ca8c -│ │ │ └─ d6309438d1b1fbbbd94c41f5f1da8a3a3ae547 -│ │ ├─ 25 -│ │ │ └─ 5541f634c184b087cb5d61861dc8b0fd3a5d78 -│ │ ├─ 26 -│ │ │ ├─ 273711b0de9e7535b106c3ba286e432b9b85f5 -│ │ │ ├─ 775955e61ec97f1b0dca7358704ddea02c9ddc -│ │ │ └─ e4c17821750c2c817ab535e5d6fa71cf99156e -│ │ ├─ 27 -│ │ │ ├─ 0129a95d858cf6f51ac588e0864144ab449abf -│ │ │ └─ 1666f8fac1f2d1b679159f6e4756926d14068d -│ │ ├─ 28 -│ │ │ └─ 95298fee875bc0200510d92727a2457ca2e8f2 -│ │ ├─ 29 -│ │ │ ├─ 1feb7e20eaa3e7c7d1d56df00b0923e3357627 -│ │ │ ├─ 54694d51b532b2966c5d4b194307fa9a83f79b -│ │ │ ├─ 56a30aeac0efc577438b9ecb0b44f898d2d862 -│ │ │ └─ ecc202fe69168df0dd6d996b554d508a221404 -│ │ ├─ 2a -│ │ │ └─ 54e805150e51e62d6a4aebe9eaafcd23528702 -│ │ ├─ 2b -│ │ │ ├─ 5639978f20d2256324966aa9dac97eb8f0146a -│ │ │ └─ 5955280fa3aefd02090bbab6280a878cbac9d9 -│ │ ├─ 2c -│ │ │ ├─ 58c5123c95daf9fd8b5451aca4eb3e6584c277 -│ │ │ └─ cd816cdb779407d941f6078af7601846a12c7f -│ │ ├─ 2d -│ │ │ ├─ 066ecd262ed78ce27c0dd0cb002c0dc0c1fd39 -│ │ │ ├─ c925985b1ab7649b8a4bf56de47a6931e97fb0 -│ │ │ └─ f3bd9ae76680422ba08639287ffe14552159d7 -│ │ ├─ 2e -│ │ │ └─ fc878c18d9360a385cda9d131f5163d43b0b9c -│ │ ├─ 2f -│ │ │ ├─ 6f24135097eea06ec760f9af0bd0db95e6de86 -│ │ │ ├─ bc0b940b57ce5734212412184a2f68b941a59e -│ │ │ └─ cc114cade6c60fdd9034ae3a9e209c763c7d26 -│ │ ├─ 30 -│ │ │ └─ a7626a287edd634ff72625fa14ed36822a14c3 -│ │ ├─ 32 -│ │ │ └─ dbc5e50c5383975f8873374f3fc5ebd1c6e35a -│ │ ├─ 33 -│ │ │ ├─ 22b1870e11f7660ac8c55346f3eab0f62003d8 -│ │ │ └─ 9853dbe114a4ddde2cc5c3503dffd4fc912a9c -│ │ ├─ 34 -│ │ │ ├─ 535c782c71e57129e9ac959646396343472e9c -│ │ │ └─ fb381809145cddc1c2b562fd1541e4d34b9a8b -│ │ ├─ 36 -│ │ │ ├─ 603552ae17d892f29c4f0f693baff05fe06221 -│ │ │ └─ 7002fdc5c639dc10d20a4f066dc0088e0c7460 -│ │ ├─ 37 -│ │ │ ├─ eb8c8ffcdf3da4f6000ce0b9813b756657ede6 -│ │ │ └─ f28016d8ad869ca4fab3822f1daa515e00b1f9 -│ │ ├─ 39 -│ │ │ ├─ 26e6349d4da4b7964d2dff1e349568957e0bad -│ │ │ ├─ 90d4d37c44dbc67f5913b54941c3ada26926d1 -│ │ │ ├─ b871ca00974bb9d834196818d6e8456a6fb194 -│ │ │ └─ d3572b9950fd61f7a706bb639aefe36f56ad97 -│ │ ├─ 3b -│ │ │ ├─ 625312b8b3fda9627263c8ed886990b9c24c48 -│ │ │ └─ d270e5ccc79b22ea1840e9983cb586fb54a04c -│ │ ├─ 3c -│ │ │ └─ 5559bbb46780d66eae63048b73fe171144ebd0 -│ │ ├─ 3d -│ │ │ ├─ 11811fcd263a0dd684d1195143441d71dd0299 -│ │ │ ├─ 913c87df586585ee071da8caa61a632f405cd4 -│ │ │ ├─ bba301c835df89627c6ff6eafe1932bd5ffc01 -│ │ │ └─ f42c8ee39798764071be2458db14294aca2578 -│ │ ├─ 3e -│ │ │ ├─ 130a01dac47ab9f9adf63a729f60a1f15fa154 -│ │ │ ├─ 81e838426dbc4b890521b515c955a9a4a72eb2 -│ │ │ └─ b5c019ff4e805acc07fa2bb458d495e218c86f -│ │ ├─ 3f -│ │ │ ├─ 1f735088e8e55ee74834ace6f39600376d11f7 -│ │ │ ├─ 50d48ef316f3a7712f5b3f0a9bcfe91ac05cf4 -│ │ │ ├─ 8784373ff5c08fcf43db5eaf7debb843df1a57 -│ │ │ ├─ 88987bf7e8d9bc60e3afa5cb90ffd8430615c7 -│ │ │ └─ ef050becfd32689739a39f4e8d886fbd9b1086 -│ │ ├─ 40 -│ │ │ ├─ 573c5a26fd092ac6595031c73890ee1d78fcb9 -│ │ │ └─ a5991898bd84423f949cec7efc12646d8597db -│ │ ├─ 41 -│ │ │ └─ e33c6c31e68a8f398252f560ac0aa8d572673a -│ │ ├─ 42 -│ │ │ ├─ 69c88658d1ef6b563b1bbbd9f938ad5e62825b -│ │ │ ├─ dd98e45ef32a94c0bd45677b4e7ced90b55d2c -│ │ │ └─ eceb024167faf16743e4efd4b0a3e286b5f2b5 -│ │ ├─ 43 -│ │ │ └─ 338b61ec09711c4e948b0ea008fcd0febc30ec -│ │ ├─ 44 -│ │ │ ├─ 0815b9b5ff758379e89a46a29494bfb05df92b -│ │ │ └─ 3ad974e2ef19a889ae03b762a2c2b132766a55 -│ │ ├─ 45 -│ │ │ ├─ 299fa660569286948855c8156e622dd870746d -│ │ │ ├─ 680d0ae840fd66298456437eef03534892b09f -│ │ │ └─ ddeb6228d75ca412be8640b424271c44e40aef -│ │ ├─ 46 -│ │ │ ├─ 0429231ea80fb65de0ed2979810905ae9456cf -│ │ │ └─ b93873382bcbbe6ce3b825851a92b983ca2a03 -│ │ ├─ 47 -│ │ │ ├─ 0b9f5b2ee90539509208bd1f13a0cdc4bfd170 -│ │ │ ├─ 88102b06639987032075aea4accb5cf4851f3c -│ │ │ └─ 9cc6ee9d77890ec73b2c86235765e38c7b9348 -│ │ ├─ 48 -│ │ │ └─ 751e247647ed9816b00b5ee67928b6fab0a868 -│ │ ├─ 49 -│ │ │ └─ 6f496d2e496317ee4a22e7780cf608ea2e6099 -│ │ ├─ 4a -│ │ │ └─ f9f54a7824d911c54706aba20b2afaf265db75 -│ │ ├─ 4b -│ │ │ └─ a842e297b4fd360796c535a5d166eddcbdf7c3 -│ │ ├─ 4c -│ │ │ ├─ 27550369a3e4adaabfc83a93a05a5c99fb3061 -│ │ │ ├─ 4548d29a82cd44ff1ae0bfc2c8f6c8cd384693 -│ │ │ ├─ 5a59a6a03e4eae6b003324c5828de8087fd5a2 -│ │ │ ├─ 5e0f2505c422d47fd4a258a986e3ef23b90250 -│ │ │ ├─ 82d9b7711b40642057711e8bc06bd2873df9b3 -│ │ │ ├─ b8992ea8bdd447a9c9c18c66f7d2d7b16390a9 -│ │ │ └─ ce837ef2f98a892b5a2712b1a2290635fb77df -│ │ ├─ 4d -│ │ │ ├─ 3132c5039d86c1e7da3da6ae964562b2d6dbe4 -│ │ │ ├─ 7771e4a2a6b54b358dacbaf8df9b5b9bc09142 -│ │ │ └─ 91548f4cde9d2afbf1a6ace0ee0c7659ea70b3 -│ │ ├─ 4f -│ │ │ ├─ 42474809724ea7af8c5c6247c3207e6901f5a1 -│ │ │ ├─ 7d0a8f74dfde40d7cf42683dfe75746f59484e -│ │ │ └─ 8cf5b9b1acca10aab25f53a7e94db167afa228 -│ │ ├─ 50 -│ │ │ ├─ 0bb66b242ff595ecf5a30066c62d652e51085a -│ │ │ ├─ 5f5c8e49bc2900a08e737dcd74adb2933ac354 -│ │ │ └─ e9215454865a203321ee1e6cc58c60448edb50 -│ │ ├─ 51 -│ │ │ ├─ a1f6e86cae662009774d77d31103051e0a5a03 -│ │ │ └─ d60f6b44debfd104c09d004af58c0c929620bc -│ │ ├─ 52 -│ │ │ └─ 1d2728c5200687cb3564faaff9950f84328db7 -│ │ ├─ 53 -│ │ │ └─ c0155304733e6e5a312e616fec256257a0116f -│ │ ├─ 55 -│ │ │ ├─ 0d9a6cea2c909e170dc15418b16c21f057b1bb -│ │ │ └─ dfb05cb72971d935b712c30c97c5484aba12a1 -│ │ ├─ 56 -│ │ │ ├─ 0545011366b95441af3b50fe542a166a454cf7 -│ │ │ ├─ 69d79f0d5f550add78abcd2b6bef771d3a772b -│ │ │ ├─ 88e864b9ff577d0bf0136e7db73c8f62d4c378 -│ │ │ └─ 8a7f6b90f436643ff9d78921ef9624881b9b3e -│ │ ├─ 57 -│ │ │ ├─ 3d30b16234948b47dc9a799e36e8cbe7675300 -│ │ │ └─ da5454d894aa5a6b0f835cc447295ad515a2a0 -│ │ ├─ 58 -│ │ │ └─ 2ae4e6e0ecd6f5aad9659818db537337259604 -│ │ ├─ 59 -│ │ │ ├─ 0a6e742d87dcd19e3cfc0fd077117cb4535ecc -│ │ │ ├─ 35baa5f33d562161d07f7b205d8955dae84f2d -│ │ │ ├─ aa365ade53db0f696ab33e9dcbe2bfc7137aa7 -│ │ │ └─ bee3dd9d7063acb0063be6e22aa8d6ca5681ae -│ │ ├─ 5b -│ │ │ ├─ 324a3aacb137e66988cc034a8739e420137738 -│ │ │ └─ 6b6f142f1400e4c3c28b86691b2896c71c8f70 -│ │ ├─ 5c -│ │ │ ├─ 504e42471efae4c601cab9fbc23004a6949ca8 -│ │ │ ├─ 522f79deec94d8a9e28fc66f97ed6eb0b26b37 -│ │ │ ├─ 9e485b8fee67131b3f59c300a52aa9e6bd4e8e -│ │ │ └─ aca9146c7f62c98b53cc8239a70592192bf1a5 -│ │ ├─ 5d -│ │ │ ├─ 9395f3bf957e066caa62a00a0b30c9320aae89 -│ │ │ ├─ a9ca5fd8d36fbe1ef8a2e32df80298acf3e575 -│ │ │ └─ d6f3ed7ac2bcb30664c894e99f64ccbe47fe40 -│ │ ├─ 5e -│ │ │ ├─ 05b76f65bb51dd62b844e895d30d83391a4526 -│ │ │ ├─ 29c306b0b5dc7f67f79cbca8bffe0e9a25760a -│ │ │ ├─ 47c53b6ea6a075a446fe813ffe6f44c78d7690 -│ │ │ ├─ c9896f64cb2c5a9f192ae5bdb3196deac31880 -│ │ │ └─ fd62dd34c59256e8aa4e7da13b7feab5808257 -│ │ ├─ 5f -│ │ │ └─ 59bc7a96a279b9239ed635f7c486f8187d8c99 -│ │ ├─ 60 -│ │ │ ├─ 5ea7ff7e058806d16f55e911aac213ff239912 -│ │ │ └─ 7635bc50b031a32b3bf616dbb2c1a3f48b8572 -│ │ ├─ 61 -│ │ │ └─ a58739a8638857f1ab9b746b1e7bf01c3395f7 -│ │ ├─ 63 -│ │ │ ├─ 87ecd6eb535587e833388b15e7a86649dde128 -│ │ │ ├─ c56f69a5348e3312b14dd3dcbf2d39ff3867b8 -│ │ │ └─ d74fa147effa2f3d7446e7cb5583c7ea98676e -│ │ ├─ 64 -│ │ │ ├─ 94eb3bef133b77227c9d16db936260b4625a14 -│ │ │ ├─ d194a1a5ef81fce275bb7243368d75a3f501a5 -│ │ │ └─ f4447c29a0fb5130c1dbde4985278dc2b42f75 -│ │ ├─ 66 -│ │ │ ├─ 172d532ba8a923c497dadb0a7995a499b2a1e7 -│ │ │ ├─ e04aa074fac06fbe0ad35637195cb39fa7d923 -│ │ │ └─ e8409762482a64e6a4fcfd1c7d69c0c3cde825 -│ │ ├─ 67 -│ │ │ ├─ 24d131e0fafa62efa31997345a0001903938dc -│ │ │ ├─ 64c3483e308095b4d2654ec3901a3fa079c47f -│ │ │ ├─ 70414f7a3e68d558df8166dd9dca2c21be32f7 -│ │ │ └─ ffcb140fad641b245e614d90ad3961c9aefb0c -│ │ ├─ 68 -│ │ │ ├─ 140248c14590f7bca10dc79aaa691fc73633a9 -│ │ │ ├─ 50c3fe976504e58b8b2713f088ffc05555061d -│ │ │ └─ 8626bbbc57e78f8d1a1befa9c20938d94f24c9 -│ │ ├─ 69 -│ │ │ ├─ 4c37e45a91c809a1f5c76fe7724b65611848af -│ │ │ ├─ 7201220b6f4d31c2b0ca81c8f65b0a9ff584ad -│ │ │ ├─ af14768b0518a02e78d3c5f66429977cdd7ea6 -│ │ │ └─ ed311ef113662487ab962b4e93f25f1a27b545 -│ │ ├─ 6a -│ │ │ └─ 8af2711c3234a2e6ca841eb29ef745d4c138b4 -│ │ ├─ 6b -│ │ │ ├─ 50feb62c4950f1d4d6398b459e28088e52d464 -│ │ │ └─ f645ccb39ebb6699b16d66f55de9ab00cea95a -│ │ ├─ 6d -│ │ │ ├─ 25602f12e224bac75fa570d98a1462e3e57ee5 -│ │ │ ├─ 6d12d6e7d32a4fb33e8a4ab71a215a99e56485 -│ │ │ ├─ 8c412ba03e3506517781083aef5ba9ec5296eb -│ │ │ └─ d06da0999f455ce4510a55086227d692bff3ba -│ │ ├─ 6e -│ │ │ ├─ d9c808cbcfa8510b350c6f8e760053b7a87f96 -│ │ │ └─ f3bb0c340c0677706ae1a3cea9e2136bb6258d -│ │ ├─ 6f -│ │ │ └─ 01c7cf33add5e6b93347fdafa85c8660283f9a -│ │ ├─ 70 -│ │ │ └─ c017d8aa1ee6808c63e5233ab5b345b9974d34 -│ │ ├─ 71 -│ │ │ ├─ 0e14a795a1fd85fdec2e470e58c876e9e977af -│ │ │ ├─ 137e0eff6ae5aefadf8b20def0af1ab036418f -│ │ │ └─ 9c9f62d25f5ada076f3839c4d1b1700056a3cf -│ │ ├─ 72 -│ │ │ └─ c5e182aa360f0ee555b387fa75d293c79eb321 -│ │ ├─ 73 -│ │ │ └─ e56024f3f95193cf02ae46cbb6ce83a47ef574 -│ │ ├─ 74 -│ │ │ ├─ 25cdd37baa3612d6a1c7cc9cd7e97ebc876c76 -│ │ │ ├─ 3079c89ba20904f8f56ca05bc314c6bb8a1306 -│ │ │ └─ 574044948bc466680fbb0319c1a6f830c5ec6b -│ │ ├─ 75 -│ │ │ ├─ 2495b3d7ec56c810a14da23cf5e7cab80df32e -│ │ │ └─ 28f66bde2d266351697caf4fd23711532e15b1 -│ │ ├─ 76 -│ │ │ └─ d7df58f53c5f075cbfdbcc50594b8cf6a00947 -│ │ ├─ 77 -│ │ │ └─ 6743bb5b1121d5d28bd477e5ce2dce6c796845 -│ │ ├─ 78 -│ │ │ └─ 5757b848fc8295e8decd614d02efa70fd78931 -│ │ ├─ 79 -│ │ │ ├─ 63ba56f6e8db5444f9c3a0cfe77b1824c198cc -│ │ │ └─ fa6731bcec81ff0f5a761f20f181da7419643a -│ │ ├─ 7a -│ │ │ └─ 729deaf98723ae677e9047c92278629b2345c8 -│ │ ├─ 7b -│ │ │ └─ 17ed9a38e1a8fe346021073f074a60b93eb5ad -│ │ ├─ 7c -│ │ │ ├─ 744b3066c068f0fb4f52604e8eb00e92025c42 -│ │ │ └─ e9871602fcdc214e1df41aa184443153db759c -│ │ ├─ 7e -│ │ │ ├─ d815de43501ed327c52f51b81cbae9aa19a89b -│ │ │ └─ f9cf46de07e756a66db6dd317109e38f914517 -│ │ ├─ 80 -│ │ │ ├─ 63dbb4cecc3f778263100eb82a70e5059491d7 -│ │ │ └─ c12148dddef7e4d702830daf6c6b4f9f7d7e31 -│ │ ├─ 81 -│ │ │ ├─ 42cf24eb92185e78863a1d6fdf90c1f8101e1f -│ │ │ ├─ 5eee38321ac32dd1ba55d0ad9587da668931e4 -│ │ │ └─ fc15b1b71dc4a9a7d5e48a010b22a890425926 -│ │ ├─ 82 -│ │ │ ├─ 86ab942bd487af4e28b15068615c45c88bba8e -│ │ │ └─ 9c4f749837b23847d8e0645101e0cc3643a69d -│ │ ├─ 83 -│ │ │ ├─ 5ccf3b389c6e5a06a11b81d6a4b608d493a71b -│ │ │ └─ 9d270b0df8647c789d176c7e7a2f7a9568f27e -│ │ ├─ 84 -│ │ │ └─ 5f721a9d6ae0934a8b05e3d3d7081cbf5646ec -│ │ ├─ 85 -│ │ │ ├─ 0b12375cea5ac8b841b28b2cefd88045f38abe -│ │ │ └─ 2669d78fdec5eb7497f63f52d65cd5a1dc78b4 -│ │ ├─ 87 -│ │ │ └─ b22148be1830df17efe30e7a02bd55144d67ab -│ │ ├─ 88 -│ │ │ └─ 08221d3bb23675feac89117162a98555aea322 -│ │ ├─ 89 -│ │ │ └─ 9825c6ecabfe30b3e5b60e366026344da83c72 -│ │ ├─ 8a -│ │ │ └─ ba71503288a824ee46b5c32a3c69ad493c5212 -│ │ ├─ 8b -│ │ │ ├─ 224de1bf05a3fa0980cc1be6ac01d5212e4d51 -│ │ │ ├─ 8ee98b1e892516e4e414ba4f44297099bd24e6 -│ │ │ ├─ cfc89f2c9ab3730c4520223dcece72312120d8 -│ │ │ └─ f2b1ccb67098dee9d2ee1f0c442d894a53e163 -│ │ ├─ 8c -│ │ │ ├─ 7c485880b7dffab7935511b2cd0fb65f4c6850 -│ │ │ ├─ ddb65174a94a381bb0cf7a23140ddce8f7e247 -│ │ │ └─ f7b939849c5a0d2f5b8a6c8bd429ad2ab84d5a -│ │ ├─ 8d -│ │ │ └─ 768bd87ec7d3038cf11617807b12041976a5cc -│ │ ├─ 8e -│ │ │ └─ 76e7df3fb230e542c5e56a865642478fbc0544 -│ │ ├─ 8f -│ │ │ ├─ 207b3ad457a974c3fd3117b08028323e99ab5e -│ │ │ ├─ 2fe0ea2449aeec1652adc0a4bc1cf4aa6ab89d -│ │ │ └─ c6ebac2980ac2b8919abba553897f998f1e958 -│ │ ├─ 90 -│ │ │ └─ e37e34415bf179efb2c07c2ab4ad84941b6743 -│ │ ├─ 91 -│ │ │ └─ 4b8686b2409463f445fa52c0735abdba0debf2 -│ │ ├─ 93 -│ │ │ └─ 3abf306c7df4be225c693c086dae5a5fe8a8c8 -│ │ ├─ 94 -│ │ │ ├─ 517da1d2993a6c1eecb831dd504541474b5519 -│ │ │ ├─ 7f0612280734bb124e95280ae8f8c31cd1fbe5 -│ │ │ ├─ 9c35cdc58654357623a143a38ddc9e9dfc6cbf -│ │ │ └─ bd7f19a6c10dbb0d34d2aafbfa66c03d948a9b -│ │ ├─ 95 -│ │ │ └─ af1d4b583629dfbe7376365e6a40685e260b41 -│ │ ├─ 96 -│ │ │ └─ 4260a45838d0c7ac0b5b12420b5ddd11093eea -│ │ ├─ 97 -│ │ │ └─ 5f9b1161316467d153b56f648c6e2ee858f402 -│ │ ├─ 98 -│ │ │ ├─ 205cae1b7cea26f2899ac3b41e20f7456318fd -│ │ │ ├─ 339347924e230b56353db3b557ed8da0fe7099 -│ │ │ ├─ 8d1ac2a544e0297838972d2b1d2b419578572e -│ │ │ └─ d8beb7006a564ab8d6773bc24d3072f81d5774 -│ │ ├─ 99 -│ │ │ ├─ 1ba16d0f731ac50ce37165f3a23aff487d711e -│ │ │ ├─ 96bccb4a22ae4e7ed18884c07ac0d417569bbb -│ │ │ ├─ a2799eb1aba56350ff73242cad1bac7f041a90 -│ │ │ └─ cc92ffe5b5d1db6cf35499b4c69f4dd7f94b78 -│ │ ├─ 9a -│ │ │ ├─ 5f76fb4e509a6fcdb7d250daf509c385a8d87e -│ │ │ └─ 887d9511f3a01f9e79529e9d9ad4cde8f18035 -│ │ ├─ 9b -│ │ │ ├─ 09e6284ae5f86a84374104496685491a9bbc9c -│ │ │ ├─ 16fbb9bec8e4bccf1c58beccdbbd2a29fc53c6 -│ │ │ └─ 1c8cd44cdf5228e410cf353edef945f5ef69ba -│ │ ├─ 9c -│ │ │ └─ efd74a89299894ae735ded1835839f82cf012a -│ │ ├─ 9d -│ │ │ └─ ee04b7c26b6b34a2b0aba897de28e60bea7189 -│ │ ├─ 9e -│ │ │ ├─ 3e0078fd06516435f029b2a1da6595a1454524 -│ │ │ ├─ 960f3e76440d0de65d49f0f193fad5e34813cd -│ │ │ ├─ 9f576cd84aa87e3465bd5353dbd5c75c06e3dc -│ │ │ ├─ a2b30abf7d01ba628fc6fb4de397e2d3037162 -│ │ │ └─ e0d0e493c1ad380d30d7d4fca205f21a9e063a -│ │ ├─ 9f -│ │ │ ├─ 394e5149c929282be15fd61e7d2a652a0b5be8 -│ │ │ └─ ad7aabdc40d79263a9e7483cdecf12385aa31c -│ │ ├─ a0 -│ │ │ ├─ 1c30ec2ed1d0526f9bce1a9689b75887289cfb -│ │ │ ├─ 514b4eec340f3f275fa22fba411f2ea07c3a87 -│ │ │ ├─ 91e79eb8d47fdd920139117e4298b674e2ea6f -│ │ │ └─ 95b9596db6516e17569a3cc140baf7602c984c -│ │ ├─ a2 -│ │ │ ├─ 5ff2606e7b373817999b0bff1818c3d2ac8efa -│ │ │ ├─ d5aa7877affa56fec50ef7ad19d7dade42cd94 -│ │ │ └─ e10bde3bc0520afc508ba37000f6b79fd83361 -│ │ ├─ a4 -│ │ │ ├─ 0c2c25126063f1662615d2d45587163d99ce0b -│ │ │ ├─ 6b5b3a5f194e0a2d761034eb0e0a2113052bbf -│ │ │ └─ 7d3cc3ff25e14d40377a768fb774975ade3eca -│ │ ├─ a5 -│ │ │ ├─ 3d5d8b421f58824cd4b95419ef6853b417e7be -│ │ │ └─ cbf477ec0ed7f6acbae1dd044d2cf38c6656a9 -│ │ ├─ a6 -│ │ │ ├─ 079ea7b32999001b9d7646c4693050e8b35d8c -│ │ │ └─ 31760cc20daefb5442f6b75b2c788b8205cfc4 -│ │ ├─ a7 -│ │ │ ├─ 8d8e1cf48f9d78ab9190bb353a09373eff2c43 -│ │ │ ├─ 99f2c3bcf45b59fdbdc54090f2a174041a4f28 -│ │ │ └─ c9d78ad79ee7b5eae7f11cd2499812909d8a6b -│ │ ├─ a8 -│ │ │ ├─ 0cecd9518354d0b8f10f6b43aa39321975d740 -│ │ │ ├─ 11b902b4590c1feb8b5543f2136aee4ebe6564 -│ │ │ ├─ a673e473dd24d8355e4efa3eeec87b721cee02 -│ │ │ └─ faa452146e10ba29f2d404878d39964cd69b8a -│ │ ├─ a9 -│ │ │ └─ 875a9e9d88fca4d69185f72235c7edf3c0c6b4 -│ │ ├─ aa -│ │ │ └─ 179ff5f6a467b5e238375d74bf878ddea6e5bb -│ │ ├─ ab -│ │ │ ├─ b28537af3ce20617c68902042cb79199560c0a -│ │ │ └─ fe356c1032b33851e87cd0d8309c722425f7c5 -│ │ ├─ ac -│ │ │ ├─ 0ace7de4614c017ceb4c8d08c36609b7305c0a -│ │ │ ├─ b3e89ba6fc89894792c343495da98ab0fa8c5f -│ │ │ ├─ c258ea13d465e9387d1fd1595c1d2265a404ee -│ │ │ ├─ de2f52be952048eac4fcb7177d6593c1d69249 -│ │ │ └─ e2c5b314e54366798ea67e1820c83b5f3972a9 -│ │ ├─ ad -│ │ │ ├─ 45488c898a7e6278577e672c3b628e4bd7a6b5 -│ │ │ ├─ b27afb8f08145781688518e1fddf1906fca44b -│ │ │ └─ e0cfca542c820fe0d723fe4f8399c319ed7f90 -│ │ ├─ ae -│ │ │ ├─ 38d9c22cc79a4ba7cd08a8438f586c15066bdd -│ │ │ └─ 7a5f485473ae83f8d81e92c8a3cb0a99171a06 -│ │ ├─ af -│ │ │ └─ 842dd93845b2fd345359b4a0d4a98546865aef -│ │ ├─ b0 -│ │ │ └─ c25af8bd9d1e44bab60058ad2584fd32565946 -│ │ ├─ b1 -│ │ │ └─ bc7ee63b55072248c0ed1a8a630737927f700e -│ │ ├─ b2 -│ │ │ ├─ 32616dcf1598ffe7815df94d4200a7150a275f -│ │ │ └─ a496ce95627dc7580dbe3f92a73cf42d3c9dc0 -│ │ ├─ b3 -│ │ │ ├─ 0ea07a65d13638daf81c785a136d88d5ebc2be -│ │ │ └─ c3c6d72ad831681d9ce9dbc3a1a14bb2de54da -│ │ ├─ b4 -│ │ │ ├─ 63df2a337691fdabb27bbbcfd628111e65446e -│ │ │ └─ b32943dc00eb6da31dee5af8018c045f63d5ef -│ │ ├─ b5 -│ │ │ ├─ 24b44b065030138a5cc711803bc4937a315c6b -│ │ │ └─ b38ac77c616c2115c64f0cadc4678075a2dfc0 -│ │ ├─ b6 -│ │ │ ├─ 087924a088f626e3e7ce6b68e1c6fda927ad71 -│ │ │ └─ 471895ab69ac726799edb4decd6ac062ec2304 -│ │ ├─ b7 -│ │ │ ├─ 672e264e2ec2d6fc322ee79647f73820ab0be9 -│ │ │ └─ b9df609685a47ac550a62f93932ba185b4e017 -│ │ ├─ b8 -│ │ │ ├─ 4c3d34186e8420a9ec2a441e5daa3ba51e57c8 -│ │ │ └─ ef8f30c0f91056012184bf5b1b5d4a9ab1ae44 -│ │ ├─ b9 -│ │ │ ├─ 2ecda8138f2e3b0943a5ea00a8b2b580b8be6b -│ │ │ ├─ 54823d6621fb155ee9b08fcb7b0cf267d1e674 -│ │ │ ├─ 5f077ccf08642d8170405cbefd14f1b9760751 -│ │ │ └─ a62d2b7dff5340cbc6b629672b665f05a61468 -│ │ ├─ ba -│ │ │ ├─ 5201e98b0c6f005109c4f24f9c629923cdd6a8 -│ │ │ ├─ 85960b5c20558f1059ab858febe5c271f98f88 -│ │ │ ├─ a6061c975b67f03e51a60626150f4a48d725b9 -│ │ │ └─ c6c6f99357e51e2fc6a0782d53e678be926d79 -│ │ ├─ bb -│ │ │ └─ 091512dc5aead4c415fbdbe1a6cf795e6b1a73 -│ │ ├─ bc -│ │ │ ├─ 88d7de4e5b16593e493f22fb4c3fa6d4376f26 -│ │ │ └─ db2b3d8d0b5e2cb4874930a423adb039f31232 -│ │ ├─ bd -│ │ │ ├─ 41da468abaadca85a6a2f250e6912a01ab210b -│ │ │ └─ d51312dfcbf879c5e8b8efbd4240b0ab874325 -│ │ ├─ be -│ │ │ └─ 485737f8d37ee76dc6d4f877ec266e219ffac2 -│ │ ├─ bf -│ │ │ ├─ 664338c8ebc0a8742ead7d40ca145fcca8b609 -│ │ │ └─ 8e07b18b86624b4919b4f0082c00c3cc3e918f -│ │ ├─ c0 -│ │ │ ├─ e662aa11c4e0f89a2b75956f9e58d78773d1fb -│ │ │ └─ fa32a895e8b3b0a4e85ca4fc871cffeb79ba04 -│ │ ├─ c1 -│ │ │ ├─ 3876d1697afe2cde4b6dbc5a6d8c73848cb075 -│ │ │ ├─ 3ae3cc8779ea9f2b09bece1d3facf31eccebde -│ │ │ └─ d37eb1578ac752d844f1b7d99d87110e070cec -│ │ ├─ c3 -│ │ │ ├─ 2420cec865978961f660ecb53e56f4303a8b9a -│ │ │ └─ 4209d9fb9c3af827ff8c2f73ce236bbf20866a -│ │ ├─ c4 -│ │ │ ├─ 9d0c52b8996ecca9ee088c18b937f0eb0b465d -│ │ │ └─ ff954e159533ab7622031b53802cc6f12c1762 -│ │ ├─ c5 -│ │ │ ├─ 650999b08cb033e856341c87d2f625b9015ea6 -│ │ │ └─ cc351b1e1b653788fac49b9cb6cce411879d87 -│ │ ├─ c8 -│ │ │ └─ 4672f478af9fae84256277142b267ad0628bc8 -│ │ ├─ c9 -│ │ │ └─ 073adc5719ee9f750e7e922b0a80bff27bb6db -│ │ ├─ ca -│ │ │ ├─ 4604704ae93b2f00ec6e0e30f7f23ac97cde48 -│ │ │ └─ da823865b7d2a3bf70c13a387cdf5098566d69 -│ │ ├─ cb -│ │ │ └─ 259057f9c40982c8f348200d47ae30b54c95b1 -│ │ ├─ cc -│ │ │ └─ 8685d876210176cb8660ece237ac7ddaea30ed -│ │ ├─ cd -│ │ │ ├─ 07d0aabe054ef492dc5696581dc06279129187 -│ │ │ ├─ 0a212422646a5c87fd9c1c4ccb65febd2f32d4 -│ │ │ └─ a0b82b84917e6ee8e2f21861c711fed5c5666b -│ │ ├─ ce -│ │ │ ├─ 5c57add753e39ded9144aaa8238099c2a026b9 -│ │ │ └─ b1238ec9be74301e3648a4404a218455ee6c00 -│ │ ├─ cf -│ │ │ └─ 81d8d2229040f94e570ea40082f0b4afbdedff -│ │ ├─ d0 -│ │ │ └─ 3cb523d32f9d605886a347624c374056ee56ff -│ │ ├─ d1 -│ │ │ └─ eff4224343f8a82faeff77e331aa101dc7b879 -│ │ ├─ d2 -│ │ │ └─ d984e7eb3da176ba327ef956bfd4b1b5df0eae -│ │ ├─ d3 -│ │ │ └─ a8536ce64cfe5347535e09bd7f48c8fceca11f -│ │ ├─ d4 -│ │ │ ├─ b0d6edbbd96c8185afdb495e39256c5dd997d2 -│ │ │ └─ f1ddb207358db48c498aa71638347937bcc996 -│ │ ├─ d5 -│ │ │ ├─ 91e06f462e12a5535c676f46e2a1cedb13999e -│ │ │ └─ aa880b96e785c8c28447782f3dd543bcd11c9d -│ │ ├─ d6 -│ │ │ └─ d38086a7fdac7c65049157638759b2eb11c3f6 -│ │ ├─ d7 -│ │ │ └─ 072efb0d6b9e95bf5456f059433c3b47d31f93 -│ │ ├─ d8 -│ │ │ └─ e05aef9a82ff793a58ad7b59433b34d6f7fb52 -│ │ ├─ d9 -│ │ │ └─ 72468d2299f67e63432a1f78a824265f3b4818 -│ │ ├─ da -│ │ │ ├─ 74229138c99e70493efc4611bf74c49e673e19 -│ │ │ └─ dc7b4f6b0ae22c88af5a6e293cd58573a6be8d -│ │ ├─ dc -│ │ │ └─ 296cc87330f6d4919a77d0c8d7e70b7d9bed0b -│ │ ├─ dd -│ │ │ ├─ 39e09ea18825da9b4148a60a15fe90f5a51400 -│ │ │ └─ ede036d0e218e39a7f07186b1c54260c139b51 -│ │ ├─ de -│ │ │ ├─ 3f7ede7ecd483b5acab6145714165f5b70b1c6 -│ │ │ ├─ 805be124bc564df6ff9f0024cbdf55e8140d69 -│ │ │ └─ d2d5743f390b36d4d6343c12a7a8d5a9788d88 -│ │ ├─ df -│ │ │ ├─ 8f5d3ef6f7f5252ff02c7958ff16e10f436b2f -│ │ │ └─ c7ceb385cce57487ca1f917049d417570b058b -│ │ ├─ e0 -│ │ │ ├─ 30c3aaa8b86659de7fce974b9692c1f9d78f88 -│ │ │ └─ df80e06a5520a073184f8b90aec03fe50b86ac -│ │ ├─ e2 -│ │ │ ├─ 29e88dab518522e8c28f01a762a78858925154 -│ │ │ ├─ 998e14bec5a9c40ea63b95b863417ec23a6113 -│ │ │ ├─ 9a187e90f639e855debae9c9521f263099c9a5 -│ │ │ └─ e3b9e39e9a6a5273fc8cd24b844b7fb8ddd199 -│ │ ├─ e3 -│ │ │ ├─ 1ebe7fb4550b01f4eb5c75792014db87e1c2d0 -│ │ │ └─ 43319a411624594f57439aa00f8db070ccdec9 -│ │ ├─ e4 -│ │ │ ├─ 87fd4ff98e40125cccaafce4e791141594c2a6 -│ │ │ ├─ 89d32993d308b7daba268cc117ee357ec94965 -│ │ │ └─ d9faefac78f7d02c71a1f5b58f0d4b89c28b18 -│ │ ├─ e5 -│ │ │ ├─ 5b8bda43077055dfe8262f15beaccebef51de5 -│ │ │ └─ eae5b4c890398675006eed53f0110a3b97beae -│ │ ├─ e7 -│ │ │ ├─ 1b58393e95ad90eaca53e4c694dd31457723ab -│ │ │ └─ 3df931fc863cf6772cff213e23efd20bef1a54 -│ │ ├─ e8 -│ │ │ └─ 84eda77f8c61f5722081eddcf763742e07dff7 -│ │ ├─ e9 -│ │ │ └─ 8ebd67b7b3199e82029469ab7677d21f9d4ccf -│ │ ├─ ea -│ │ │ ├─ 742826a7db8b6d8e9ac120fc280a478c6c513e -│ │ │ ├─ b7bc64121ff46e4cb2a6ff3ae4a841a95e96b0 -│ │ │ └─ e0223f95022856994a95933556263282ec604f -│ │ ├─ eb -│ │ │ ├─ c0c77fc8c6362d4c4de65adebaf5120ee28290 -│ │ │ └─ c5762210395053fecfdb8bdb2c71a3f41a23c2 -│ │ ├─ ec -│ │ │ ├─ 079c679f25eba136413b0dbb4d0ca01b23a3ca -│ │ │ ├─ 936d435dddb0b1545d09e75f32eb2e42df8127 -│ │ │ ├─ 9fadb9e075f2c11ccdafbf986d00e669a93861 -│ │ │ ├─ e0b58299126de0472f79f5cd8570ecd7b01d6e -│ │ │ ├─ e7f92f50e95c4fab3a25fd99761b1490ef9739 -│ │ │ ├─ ea0eaa77e643e0f5949252888c1c624b486bae -│ │ │ └─ ef8d4945c62e906711c4b6486f8952f6423f72 -│ │ ├─ ed -│ │ │ ├─ 7d4bcd192bb2026422412309f2fea4fc6b3df9 -│ │ │ └─ b3923c2843f815c27b5133ee938ba140d381a1 -│ │ ├─ ee -│ │ │ ├─ 5f665c59a52c0d10587c8110116ae79b0b8791 -│ │ │ └─ 77beb5d8385e0ea976a42a6a0181ca0cc8d671 -│ │ ├─ ef -│ │ │ ├─ 4c8ba6ba2e00c6366c95c0d44cf0f69208be8d -│ │ │ └─ e6bb947cb3b93f80a1b9336b4f672f34efe09f -│ │ ├─ f1 -│ │ │ ├─ 0a0ae13796d6923b24eff58f17f83f91505c02 -│ │ │ └─ 1ae6fe101cb5b2ac16be58cd22e60f92a21d04 -│ │ ├─ f3 -│ │ │ ├─ 31935ec0503644a3f84a656f828578cc5f5269 -│ │ │ ├─ 7517c4d5c057e4afd04ed4eecee8f4626b405f -│ │ │ └─ f663cca636e86608701373bf6276cfcc40a3d5 -│ │ ├─ f4 -│ │ │ ├─ 1faf4ccc2069320fac9c5ace085a472dfd5cad -│ │ │ ├─ 2f5c665e35c9bd8a99ad7a45e047f150e9b09d -│ │ │ ├─ 6379770073628611beb571eea42ea2021f9232 -│ │ │ └─ 8967b4f3157b97f0c4b195d1fe83e1a2110780 -│ │ ├─ f5 -│ │ │ └─ 97cf09313e3c22557d24201ff0f156c22eb28a -│ │ ├─ f6 -│ │ │ └─ ceedacffa235504d4e997d2e75e0d896868f61 -│ │ ├─ f7 -│ │ │ └─ 69b272632f923484c29a3131150a3a9b0c327f -│ │ ├─ f8 -│ │ │ ├─ 99c40c68ca6da786172dc98292ec748ce0443c -│ │ │ └─ f6b02f286c55bce52d84f27eb012f4f11e2b0e -│ │ ├─ f9 -│ │ │ ├─ 2afce6af14842edf8124c006325c5c4dd2b446 -│ │ │ ├─ 83121477906ae2505f5cfb2a03e02c2f660716 -│ │ │ └─ ad8e9ca04247f5c51a88578e96788a772be13e -│ │ ├─ fa -│ │ │ └─ d769cd167a94de6a293e8a7cc03556b2526c45 -│ │ ├─ fc -│ │ │ ├─ 97a7405694db07c686e29c706afd894cf57912 -│ │ │ └─ df9aee0169993ae1eda0b8680531c90917fa1c -│ │ ├─ fd -│ │ │ ├─ 349497aa8474c4e89ed8201894d2cf2eca5957 -│ │ │ └─ be4637a650f7fc24daf37c2f7199f22e5ab3a8 -│ │ ├─ ff -│ │ │ ├─ 50bc1350fc2be6f1f26dae79c361c37ec133dc -│ │ │ ├─ 50edac24e4f6af4d70161bd00729600ea59aa5 -│ │ │ └─ a08852f9944bac842eca78bf4fcbbdfab2fdf6 -│ │ ├─ info -│ │ └─ pack -│ │ ├─ pack-107d6b412e2489c26de07004f5cb52b17e418dbf.idx -│ │ └─ pack-107d6b412e2489c26de07004f5cb52b17e418dbf.pack -│ ├─ packed-refs -│ └─ refs -│ ├─ heads -│ │ ├─ main -│ │ └─ pratiksha-dev -│ ├─ remotes -│ │ └─ origin -│ │ ├─ HEAD -│ │ └─ pratiksha-dev -│ └─ tags -├─ .gitignore -├─ README.md -├─ analysis -│ └─ .gitkeep -├─ data -│ ├─ .gitkeep -│ ├─ dim_gender_sites.csv -│ └─ dim_location_administrative_units.csv -├─ data_tests -│ └─ .gitkeep -├─ dbt_project.yml -├─ macros -│ ├─ .gitkeep -│ ├─ commcare_default_case_properies.sql -│ ├─ extract_case_table_from_gender_commcare_json.sql -│ ├─ extract_case_table_from_wash_commcare_json.sql -│ ├─ generate_schema_name.sql -│ └─ validate_date.sql -├─ models -│ ├─ .DS_Store -│ ├─ marts -│ │ ├─ education -│ │ │ ├─ education_scholarship_categories_agg.sql -│ │ │ ├─ followup_attendance.sql -│ │ │ ├─ nudges.sql -│ │ │ ├─ parent_satisfaction.sql -│ │ │ ├─ parents_attendance.sql -│ │ │ ├─ public_partnerships.sql -│ │ │ ├─ student_satisfaction.sql -│ │ │ ├─ students_attendance.sql -│ │ │ ├─ teacher_satisfaction.sql -│ │ │ └─ well_being_sessions.sql -│ │ ├─ gender -│ │ │ ├─ case_occurence.sql -│ │ │ ├─ case_occurence_pii.sql -│ │ │ ├─ champions.sql -│ │ │ ├─ counselling.sql -│ │ │ ├─ gbv_leader.sql -│ │ │ ├─ life_skills_training_participants.sql -│ │ │ ├─ life_skills_training_sessions.sql -│ │ │ ├─ mh_score_improvement_descriptive.sql -│ │ │ ├─ safe_house.sql -│ │ │ ├─ safe_house_agg.sql -│ │ │ ├─ sessions_attended.sql -│ │ │ ├─ supported.sql -│ │ │ └─ youth_beneficiaries_disagg.sql -│ │ ├─ org_wide -│ │ │ ├─ county_footprint.sql -│ │ │ └─ mapping.sql -│ │ └─ wash -│ │ ├─ health_indicators.sql -│ │ ├─ health_indicators_schools_improved.sql -│ │ ├─ user_meters_mobiwater.sql -│ │ ├─ wash_facilities.sql -│ │ ├─ wash_marts_tests.yml -│ │ ├─ water_consumption_mobiwater.sql -│ │ └─ water_production.sql -│ ├─ source.yml -│ ├─ staging -│ │ ├─ education -│ │ │ ├─ staging_followup_attendance.sql -│ │ │ ├─ staging_nudges.sql -│ │ │ ├─ staging_parents_attendance.sql -│ │ │ ├─ staging_parents_satisfaction_survey.sql -│ │ │ ├─ staging_public_partnerships.sql -│ │ │ ├─ staging_scholarships.sql -│ │ │ ├─ staging_student_satisfaction_survey.sql -│ │ │ ├─ staging_students_attendance.sql -│ │ │ ├─ staging_teacher_satisfaction_survey.sql -│ │ │ └─ staging_well_being_sessions.sql -│ │ ├─ gender -│ │ │ ├─ staging_champions.sql -│ │ │ ├─ staging_gbv_leaders.sql -│ │ │ ├─ staging_gender_case_occurrences_commcare.sql -│ │ │ ├─ staging_gender_counselling_commcare.sql -│ │ │ ├─ staging_gender_final_mental_health_assesment.sql -│ │ │ ├─ staging_gender_initial_mental_health_assesment.sql -│ │ │ ├─ staging_gender_safe_house_commcare.sql -│ │ │ ├─ staging_gender_survivors_commcare.sql -│ │ │ ├─ staging_life_skills_training_participant_details.sql -│ │ │ ├─ staging_life_skills_training_session_details.sql -│ │ │ ├─ staging_youth_beneficiaries.sql -│ │ │ └─ survivors_data.sql -│ │ ├─ org_wide -│ │ │ ├─ staging_county_footprint.sql -│ │ │ └─ staging_mapping.sql -│ │ └─ wash -│ │ ├─ staging_facilities.sql -│ │ ├─ staging_health_indicators.sql -│ │ ├─ staging_meter_readings_mobiwater.sql -│ │ ├─ staging_user_meters_mobiwater.sql -│ │ ├─ staging_water_production.sql -│ │ └─ wash_staging_tests.yml -│ └─ wash_unit_tests.yml -├─ packages.yml -├─ seeds -│ ├─ dim_gender_sites.csv -│ └─ dim_location_administrative_units.csv -└─ snapshots - └─ .gitkeep - -``` \ No newline at end of file +- Check out [the blog](https://blog.getdbt.com/) for the latest news on dbt's development and best practices \ No newline at end of file diff --git a/models/marts/education/education_scholarship_categories_agg.sql b/models/marts/education/education_scholarship_categories_agg.sql index fa98b8b..b35c253 100644 --- a/models/marts/education/education_scholarship_categories_agg.sql +++ b/models/marts/education/education_scholarship_categories_agg.sql @@ -1,6 +1,6 @@ {{ config( materialized='table', - tags="education_expansion" + tags=["education_expansion", "education"] ) }} SELECT diff --git a/models/marts/education/followup_attendance.sql b/models/marts/education/followup_attendance.sql index ea8ef1d..bc1462c 100644 --- a/models/marts/education/followup_attendance.sql +++ b/models/marts/education/followup_attendance.sql @@ -1,71 +1,66 @@ {{ config( materialized='table', - tags="education_attendance" + tags=["education_attendance", "education"] ) }} WITH clean_data AS ( SELECT - grade, - stream, - name_of_student, - absence_causes, - _airbyte_extracted_at, - school_type, - -- Directly convert "Date_" to a proper date - TO_DATE(date, 'DD/MM/YYYY') AS absence_date, - TO_DATE(estimated_reporting_date, 'DD/MM/YYYY') AS reporting_date + "grade", + "stream", + "name_of_student", + "absence_causes", + "_airbyte_extracted_at", + "school_type", + TO_DATE("date", 'DD/MM/YYYY') AS "absence_date", + TO_DATE("estimated_reporting_date", 'DD/MM/YYYY') AS "reporting_date" FROM {{ ref('staging_followup_attendance') }} ) SELECT - absence_date, - EXTRACT(YEAR FROM absence_date) AS year, + "absence_date", + EXTRACT(YEAR FROM "absence_date") AS "year", -- Calculate term based on the valid date CASE - WHEN - absence_date BETWEEN DATE_TRUNC('year', absence_date) - AND DATE_TRUNC('year', absence_date) + INTERVAL '3 months - 1 day' THEN 'Term 1' - WHEN - absence_date BETWEEN DATE_TRUNC('year', absence_date) + INTERVAL '3 months' - AND DATE_TRUNC('year', absence_date) + INTERVAL '7 months - 1 day' THEN 'Term 2' - WHEN - absence_date BETWEEN DATE_TRUNC('year', absence_date) + INTERVAL '7 months' - AND DATE_TRUNC('year', absence_date) + INTERVAL '12 months - 1 day' THEN 'Term 3' - END AS term, + WHEN "absence_date" BETWEEN DATE_TRUNC('year', "absence_date") + AND DATE_TRUNC('year', "absence_date") + INTERVAL '3 months - 1 day' THEN 'Term 1' + WHEN "absence_date" BETWEEN DATE_TRUNC('year', "absence_date") + INTERVAL '3 months' + AND DATE_TRUNC('year', "absence_date") + INTERVAL '7 months - 1 day' THEN 'Term 2' + WHEN "absence_date" BETWEEN DATE_TRUNC('year', "absence_date") + INTERVAL '7 months' + AND DATE_TRUNC('year', "absence_date") + INTERVAL '12 months - 1 day' THEN 'Term 3' + ELSE NULL + END AS "term", -- Transform Grade values CASE - WHEN grade = 'K' THEN 'Kindergarten' - ELSE CONCAT('Grade ', grade) - END AS grade, + WHEN "grade" = 'K' THEN 'Kindergarten' + ELSE CONCAT('Grade ', "grade") + END AS "grade", -- Retain other columns and transformations - stream, - absence_causes, - reporting_date, - LOWER(school_type) AS school_type, - COUNT(*) AS number_of_absences + "stream", + "absence_causes", + "reporting_date", + LOWER("school_type") AS "school_type", + COUNT(*) AS "number_of_absences" FROM clean_data GROUP BY - absence_date, + "absence_date", CASE - WHEN - absence_date BETWEEN DATE_TRUNC('year', absence_date) - AND DATE_TRUNC('year', absence_date) + INTERVAL '3 months - 1 day' THEN 'Term 1' - WHEN - absence_date BETWEEN DATE_TRUNC('year', absence_date) + INTERVAL '3 months' - AND DATE_TRUNC('year', absence_date) + INTERVAL '7 months - 1 day' THEN 'Term 2' - WHEN - absence_date BETWEEN DATE_TRUNC('year', absence_date) + INTERVAL '7 months' - AND DATE_TRUNC('year', absence_date) + INTERVAL '12 months - 1 day' THEN 'Term 3' + WHEN "absence_date" BETWEEN DATE_TRUNC('year', "absence_date") + AND DATE_TRUNC('year', "absence_date") + INTERVAL '3 months - 1 day' THEN 'Term 1' + WHEN "absence_date" BETWEEN DATE_TRUNC('year', "absence_date") + INTERVAL '3 months' + AND DATE_TRUNC('year', "absence_date") + INTERVAL '7 months - 1 day' THEN 'Term 2' + WHEN "absence_date" BETWEEN DATE_TRUNC('year', "absence_date") + INTERVAL '7 months' + AND DATE_TRUNC('year', "absence_date") + INTERVAL '12 months - 1 day' THEN 'Term 3' + ELSE NULL END, CASE - WHEN grade = 'K' THEN 'Kindergarten' - ELSE CONCAT('Grade ', grade) + WHEN "grade" = 'K' THEN 'Kindergarten' + ELSE CONCAT('Grade ', "grade") END, - stream, - absence_causes, - reporting_date, - LOWER(school_type) \ No newline at end of file + "stream", + "absence_causes", + "reporting_date", + LOWER("school_type") \ No newline at end of file diff --git a/models/marts/education/nudges.sql b/models/marts/education/nudges.sql index 79558c9..9d1f788 100644 --- a/models/marts/education/nudges.sql +++ b/models/marts/education/nudges.sql @@ -1,18 +1,18 @@ {{ config( materialized='table', - tags="education_expansion" + tags=["education_expansion", "education"] ) }} SELECT - term, - CONCAT('Grade ', grade) AS grade, - cohort - AS year, - county, - subcounty, - gender, - nudge_type, - COUNT(*) AS nudge_count + "term", + CONCAT('Grade ', "grade") AS "grade", + "cohort", + "year", + "county", + "subcounty", + "gender", + "nudge_type", + COUNT(*) AS "nudge_count" FROM {{ ref('staging_nudges') }} GROUP BY term, diff --git a/models/marts/education/parent_satisfaction.sql b/models/marts/education/parent_satisfaction.sql index b694188..8fccf86 100644 --- a/models/marts/education/parent_satisfaction.sql +++ b/models/marts/education/parent_satisfaction.sql @@ -1,19 +1,19 @@ {{ config( materialized='table', - tags="education_satisfaction_surveys" + tags=["education_satisfaction_surveys", "education"] ) }} SELECT -- Transform term to "Term X" - INITCAP(REPLACE(term, '_', ' ')) AS term, + INITCAP(REPLACE("term", '_', ' ')) AS "term", -- Transform grade to "Kindergarten" or "Grade X" CASE - WHEN LOWER(grade) LIKE '%kindergarten%' THEN 'Kindergarten' - ELSE CONCAT('Grade ', REGEXP_REPLACE(LOWER(grade), '.*grade', '')) - END AS grade, - LOWER(school) AS school_type, - education_satisfaction, - class_year_of_child AS year -FROM {{ ref("staging_parents_satisfaction_survey") }} + WHEN LOWER("grade") LIKE '%kindergarten%' THEN 'Kindergarten' + ELSE CONCAT('Grade ', REGEXP_REPLACE(LOWER("grade"), '.*grade', '')) + END AS "grade", + LOWER("school") AS "school_type", + "education_satisfaction", + "class_year_of_child" AS "year" +FROM {{ ref("staging_parents_satisfaction_survey") }} \ No newline at end of file diff --git a/models/marts/education/parents_attendance.sql b/models/marts/education/parents_attendance.sql index 2ac1a42..cbc44f1 100644 --- a/models/marts/education/parents_attendance.sql +++ b/models/marts/education/parents_attendance.sql @@ -1,17 +1,17 @@ {{ config( materialized='table', - tags="education_attendance" + tags=["education_attendance", "education"] ) }} SELECT - "Term" AS term, - "Year" AS year, - "Grade" AS grade, - TO_DATE("Meeting_Date", 'DD/MM/YYYY') AS date, - "Meeting_Type" AS meeting_type, - "Number_Present" AS number_present, - "Number_of_Parents" AS number_of_parents, - "Share_of_Parents_Engaged" AS share_of_parents_engaged, - "Attendance_Percentage_" AS attendance_percentage, - LOWER(school_type) AS school_type + "Term" as "term", + "Year" as "year", + "Grade" as "grade", + TO_DATE("Meeting_Date", 'DD/MM/YYYY') AS "date", + "Meeting_Type" as "meeting_type", + "Number_Present" as "number_present", + "Number_of_Parents" as "number_of_parents", + "Share_of_Parents_Engaged" as "share_of_parents_engaged", + "Attendance_Percentage_" as "attendance_percentage", + LOWER("school_type") as "school_type" FROM {{ ref("staging_parents_attendance") }} diff --git a/models/marts/education/public_partnerships.sql b/models/marts/education/public_partnerships.sql index b59b5b3..6145b7e 100644 --- a/models/marts/education/public_partnerships.sql +++ b/models/marts/education/public_partnerships.sql @@ -1,17 +1,17 @@ {{ config( materialized='table', - tags="education_expansion" + tags=["education_expansion", "education"] ) }} SELECT - year, - LOWER(school_name) AS school_name, - county, - mean_kpce_score, - subcounty, - teachers_trained, - students_enrolled, - computers_provided, - toilet_stances_built, - high_touch_low_touch + "year", + LOWER("school_name"), + "county", + "mean_kpce_score", + "subcounty", + "teachers_trained", + "students_enrolled", + "computers_provided", + "toilet_stances_built", + "high_touch_low_touch" FROM {{ ref("staging_public_partnerships") }} diff --git a/models/marts/education/student_satisfaction.sql b/models/marts/education/student_satisfaction.sql index b58a144..bf8a632 100644 --- a/models/marts/education/student_satisfaction.sql +++ b/models/marts/education/student_satisfaction.sql @@ -1,18 +1,19 @@ {{ config( materialized='table', - tags="education_satisfaction_surveys" + tags=["education_satisfaction_surveys", "education"] ) }} SELECT -- Transform term to "Term X" - INITCAP(REPLACE(term, 'term', 'Term ')) AS term, + INITCAP(REPLACE("term", 'term', 'Term ')) AS "term", -- Transform grade to "Kindergarten" or "Grade X" CASE - WHEN LOWER(grade) LIKE '%kindergarten%' THEN 'Kindergarten' - ELSE CONCAT('Grade ', REGEXP_REPLACE(LOWER(grade), '.*grade', '')) - END AS grade, - LOWER(school) AS school_type, - school_satisfaction, - class_year AS year + WHEN LOWER("grade") LIKE '%kindergarten%' THEN 'Kindergarten' + ELSE CONCAT('Grade ', REGEXP_REPLACE(LOWER("grade"), '.*grade', '')) + END AS "grade", + + LOWER("school") AS "school_type", + "school_satisfaction", + "class_year" AS "year" FROM {{ ref("staging_student_satisfaction_survey") }} diff --git a/models/marts/education/students_attendance.sql b/models/marts/education/students_attendance.sql index 56d14f0..652203f 100644 --- a/models/marts/education/students_attendance.sql +++ b/models/marts/education/students_attendance.sql @@ -1,6 +1,6 @@ {{ config( materialized='table', - tags="education_attendance" + tags=["education_attendance", "education"] ) }} SELECT @@ -14,5 +14,4 @@ SELECT "All_Students___Total_Days_Absent" AS total_days_absent, "All_Students___Total_Days_Present" AS total_days_present, LOWER("School_Type") AS school_type -FROM {{ ref("staging_students_attendance") }} - +FROM {{ ref("staging_students_attendance") }} \ No newline at end of file diff --git a/models/marts/education/teacher_satisfaction.sql b/models/marts/education/teacher_satisfaction.sql index 8cc314f..7fe6486 100644 --- a/models/marts/education/teacher_satisfaction.sql +++ b/models/marts/education/teacher_satisfaction.sql @@ -1,13 +1,11 @@ {{ config( materialized='table', - tags="education_satisfaction_surveys" + tags=["education_satisfaction_surveys", "education"] ) }} SELECT - teaching_level, - school_name, - education_satisfaction, - LOWER(school_name) AS school_type, - year -FROM {{ ref("staging_teacher_satisfaction_survey") }} - + "teaching_level", + "education_satisfaction", + LOWER("school_name") AS "school_type", + "year" +FROM {{ ref("staging_teacher_satisfaction_survey") }} \ No newline at end of file diff --git a/models/marts/education/well_being_sessions.sql b/models/marts/education/well_being_sessions.sql index b2ed87b..b355a8f 100644 --- a/models/marts/education/well_being_sessions.sql +++ b/models/marts/education/well_being_sessions.sql @@ -1,15 +1,14 @@ {{ config( materialized='table', - tags="education_well_being_sessions" + tags=["education_well_being_sessions", "education"] ) }} SELECT - TO_DATE("Date", 'DD/MM/YYYY') AS date, - "Grade" AS grade, - "Topic" AS topic, - LOWER("School") AS school_type, - "Stream" AS stream, - CAST("Number_of_stdents_trained" AS INTEGER) AS number_of_students_trained, - "Session_Type" AS session_type -FROM {{ ref("staging_well_being_sessions") }} - + TO_DATE("Date", 'DD/MM/YYYY') AS "date", + "Grade" as "grade", + "Topic" as "topic", + LOWER("School") as "school_type", + "Stream" as "stream", + CAST("Number_of_stdents_trained" AS INTEGER) AS "number_of_students_trained", + "Session_Type" as "session_type" +FROM {{ ref("staging_well_being_sessions") }} \ No newline at end of file diff --git a/models/marts/gender/case_occurence.sql b/models/marts/gender/case_occurence.sql index 5a89a13..82bf1ab 100644 --- a/models/marts/gender/case_occurence.sql +++ b/models/marts/gender/case_occurence.sql @@ -1,5 +1,6 @@ {{ config( - materialized='table' + materialized='table', + tags= ["commcare_extraction", "gender_cases", "gender"] ) }} with diff --git a/models/marts/gender/case_occurence_pii.sql b/models/marts/gender/case_occurence_pii.sql index a2a7310..396266b 100644 --- a/models/marts/gender/case_occurence_pii.sql +++ b/models/marts/gender/case_occurence_pii.sql @@ -1,5 +1,6 @@ {{ config( materialized='table', + tags= ["commcare_extraction", "gender_cases", "gender"] ) }} diff --git a/models/marts/gender/champions.sql b/models/marts/gender/champions.sql index c5ad79b..e5713d6 100644 --- a/models/marts/gender/champions.sql +++ b/models/marts/gender/champions.sql @@ -1,36 +1,43 @@ {{ config( - materialized='table' + materialized='table', + tags=["gender_gbv_leaders_and_champions","gender"] ) }} SELECT - "County" AS county, - "Gender" AS gender, - "National_ID" AS national_id, - "Site" AS site, - "Trained" AS trained, - "Identified" AS identified, - "Date_identified" AS date_identified, - "Date_trained" AS date_trained, - "Active" AS active, + "County" as "county", + "Gender" as "gender", + "National_ID" as "national_id", + "Site" as "site", + "Trained" as "trained", + "Identified" as "identified", + "Date_identified" as "date_identified", + "Date_trained" as "date_trained", + "Active" as "active", CASE -- Both are Yes - WHEN "Trained" = 'Yes' AND "Identified" = 'Yes' THEN 'Trained and Identified' - + WHEN + "Trained" = 'Yes' AND "Identified" = 'Yes' + THEN 'Trained and Identified' + -- Only one is Yes WHEN "Trained" = 'Yes' THEN 'Trained' WHEN "Identified" = 'Yes' THEN 'Identified' - + -- Default: none are Yes ELSE 'None' END AS status, - + CASE - WHEN "Date_trained" IS NOT NULL THEN 'Quarter ' || EXTRACT(QUARTER FROM "Date_trained") + WHEN + "Date_trained" IS NOT NULL + THEN 'Quarter ' || EXTRACT(QUARTER FROM "Date_trained") ELSE 'Unknown' - END AS quarter_trained, + END AS "quarter_trained", CASE - WHEN "Date_identified" IS NOT NULL THEN 'Quarter ' || EXTRACT(QUARTER FROM "Date_identified") + WHEN + "Date_identified" IS NOT NULL + THEN 'Quarter ' || EXTRACT(QUARTER FROM "Date_identified") ELSE 'Unknown' END AS quarter_identified diff --git a/models/marts/gender/counselling.sql b/models/marts/gender/counselling.sql index 0fba7fe..2a27327 100644 --- a/models/marts/gender/counselling.sql +++ b/models/marts/gender/counselling.sql @@ -1,5 +1,6 @@ {{ config( - materialized='table' + materialized='table', + tags=["commcare_extraction","gender_counselling", "gender"] ) }} with diff --git a/models/marts/gender/dim_gender_case_worker_filters.sql b/models/marts/gender/dim_gender_case_worker_filters.sql index 23c9ca1..3630c6f 100644 --- a/models/marts/gender/dim_gender_case_worker_filters.sql +++ b/models/marts/gender/dim_gender_case_worker_filters.sql @@ -1,5 +1,6 @@ {{ config( - materialized='table' + materialized='table', + tags=['gender_dim_tables', "gender"] ) }} WITH unique_combinations AS ( @@ -10,16 +11,14 @@ WITH unique_combinations AS ( case_is_closed FROM {{ ref('case_occurence_pii') }} WHERE - county IS NOT NULL - AND site IS NOT NULL - AND assigned_to IS NOT NULL - AND case_is_closed IS NOT NULL + county IS NOT NULL AND + "site" IS NOT NULL AND + assigned_to IS NOT NULL AND + case_is_closed IS NOT NULL ) SELECT - ROW_NUMBER() OVER ( - ORDER BY county, site, assigned_to, case_is_closed - ) AS id, + ROW_NUMBER() OVER (ORDER BY county, "site", assigned_to, case_is_closed) AS id, county, site, assigned_to, diff --git a/models/marts/gender/dim_gender_overview_filters.sql b/models/marts/gender/dim_gender_overview_filters.sql index 70739b1..dba8ccf 100644 --- a/models/marts/gender/dim_gender_overview_filters.sql +++ b/models/marts/gender/dim_gender_overview_filters.sql @@ -1,5 +1,6 @@ {{ config( - materialized='table' + materialized='table', + tags=['gender_dim_tables', "gender"] ) }} WITH unique_combinations AS ( @@ -10,16 +11,14 @@ WITH unique_combinations AS ( case_is_closed FROM {{ ref('case_occurence') }} WHERE - county IS NOT NULL - AND site IS NOT NULL - AND assigned_to IS NOT NULL - AND case_is_closed IS NOT NULL + county IS NOT NULL AND + "site" IS NOT NULL AND + assigned_to IS NOT NULL AND + case_is_closed IS NOT NULL ) SELECT - ROW_NUMBER() OVER ( - ORDER BY county, site, assigned_to, case_is_closed - ) AS id, + ROW_NUMBER() OVER (ORDER BY county, "site", assigned_to, case_is_closed) AS id, county, site, assigned_to, diff --git a/models/marts/gender/gbv_leader.sql b/models/marts/gender/gbv_leader.sql index 959c012..523e8fa 100644 --- a/models/marts/gender/gbv_leader.sql +++ b/models/marts/gender/gbv_leader.sql @@ -1,5 +1,6 @@ {{ config( - materialized='table' + materialized='table', + tags=["gender_gbv_leaders_and_champions","gender"] ) }} SELECT @@ -13,23 +14,29 @@ SELECT "Date_trained" AS date_trained, CASE -- Both are Yes - WHEN "Trained" = 'Yes' AND "Identified" = 'Yes' THEN 'Trained and Identified' - + WHEN + "Trained" = 'Yes' AND "Identified" = 'Yes' + THEN 'Trained and Identified' + -- Only one is Yes WHEN "Trained" = 'Yes' THEN 'Trained' WHEN "Identified" = 'Yes' THEN 'Identified' - + -- Default: none are Yes ELSE 'None' END AS status, - + CASE - WHEN "Date_trained" IS NOT NULL THEN 'Quarter ' || EXTRACT(QUARTER FROM "Date_trained") + WHEN + "Date_trained" IS NOT NULL + THEN 'Quarter ' || EXTRACT(QUARTER FROM "Date_trained") ELSE 'Unknown' - END AS quarter_trained, + END AS "quarter_trained", CASE - WHEN "Date_identified" IS NOT NULL THEN 'Quarter ' || EXTRACT(QUARTER FROM "Date_identified") + WHEN + "Date_identified" IS NOT NULL + THEN 'Quarter ' || EXTRACT(QUARTER FROM "Date_identified") ELSE 'Unknown' END AS quarter_identified diff --git a/models/marts/gender/life_skills_training_participants.sql b/models/marts/gender/life_skills_training_participants.sql index ab6a3a4..49528da 100644 --- a/models/marts/gender/life_skills_training_participants.sql +++ b/models/marts/gender/life_skills_training_participants.sql @@ -1,5 +1,6 @@ {{ config( - materialized='table' + materialized='table', + tags=['gender_life_skills_training', "gender"] ) }} SELECT * diff --git a/models/marts/gender/life_skills_training_sessions.sql b/models/marts/gender/life_skills_training_sessions.sql index d4f8f2b..6bbc8ad 100644 --- a/models/marts/gender/life_skills_training_sessions.sql +++ b/models/marts/gender/life_skills_training_sessions.sql @@ -1,25 +1,8 @@ {{ config( - materialized='table' + materialized='table', + tags=['gender_life_skills_training', "gender"] ) }} SELECT - id, - indexed_on, - form_name, - comments, - target_group, - user_id, - username, - village_name, - num_girls_in_safe_space, - county, - ward, - constituency, - school_term, - school_year, - school_name, - type_of_school, - num_club_members, - life_skills_form_status, - patron_mobile_number + * FROM {{ ref("staging_life_skills_training_session_details") }} diff --git a/models/marts/gender/mh_score_improvement_descriptive.sql b/models/marts/gender/mh_score_improvement_descriptive.sql index abd921e..cef041a 100644 --- a/models/marts/gender/mh_score_improvement_descriptive.sql +++ b/models/marts/gender/mh_score_improvement_descriptive.sql @@ -1,5 +1,6 @@ {{ config( - materialized='table' + materialized='table', + tags=['gender_mental_health_assesment', "gender"] ) }} WITH initial_assessments AS ( @@ -38,20 +39,18 @@ final_assessments AS ( ( -- Calculate the average of all final mental health scores ( - COALESCE(CAST(behavioral_issues_after_therapy AS NUMERIC), 0) - + COALESCE(CAST(drug_abuse_after_therapy AS NUMERIC), 0) - + COALESCE(CAST(psychiatric_symptoms_after_therapy AS NUMERIC), 0) - + COALESCE(CAST(social_emotional_issues_after_therapy AS NUMERIC), 0) - + COALESCE(CAST(trauma_symptoms_after_therapy AS NUMERIC), 0) - ) - / NULLIF( - ( - CASE WHEN behavioral_issues_after_therapy IS NOT NULL THEN 1 ELSE 0 END - + CASE WHEN drug_abuse_after_therapy IS NOT NULL THEN 1 ELSE 0 END - + CASE WHEN psychiatric_symptoms_after_therapy IS NOT NULL THEN 1 ELSE 0 END - + CASE WHEN social_emotional_issues_after_therapy IS NOT NULL THEN 1 ELSE 0 END - + CASE WHEN trauma_symptoms_after_therapy IS NOT NULL THEN 1 ELSE 0 END - ), + COALESCE(CAST(behavioral_issues_after_therapy AS NUMERIC), 0) + + COALESCE(CAST(drug_abuse_after_therapy AS NUMERIC), 0) + + COALESCE(CAST(psychiatric_symptoms_after_therapy AS NUMERIC), 0) + + COALESCE(CAST(social_emotional_issues_after_therapy AS NUMERIC), 0) + + COALESCE(CAST(trauma_symptoms_after_therapy AS NUMERIC), 0) + ) / + NULLIF( + (CASE WHEN behavioral_issues_after_therapy IS NOT NULL THEN 1 ELSE 0 END + + CASE WHEN drug_abuse_after_therapy IS NOT NULL THEN 1 ELSE 0 END + + CASE WHEN psychiatric_symptoms_after_therapy IS NOT NULL THEN 1 ELSE 0 END + + CASE WHEN social_emotional_issues_after_therapy IS NOT NULL THEN 1 ELSE 0 END + + CASE WHEN trauma_symptoms_after_therapy IS NOT NULL THEN 1 ELSE 0 END), 0 ) ) AS final_avg_score @@ -67,7 +66,7 @@ improved_scores AS ( i.initial_form_filling_date, f.final_form_filling_date, - CASE + CASE WHEN f.final_avg_score < i.initial_avg_score THEN 'Y' ELSE 'N' END AS improved diff --git a/models/marts/gender/safe_house.sql b/models/marts/gender/safe_house.sql index 3576193..3d409a1 100644 --- a/models/marts/gender/safe_house.sql +++ b/models/marts/gender/safe_house.sql @@ -1,5 +1,6 @@ {{ config( - materialized='table' + materialized='table', + tags=["commcare_extraction", "gender_safe_house", "gender"] ) }} with diff --git a/models/marts/gender/safe_house_agg.sql b/models/marts/gender/safe_house_agg.sql index 02a06e1..faf2d36 100644 --- a/models/marts/gender/safe_house_agg.sql +++ b/models/marts/gender/safe_house_agg.sql @@ -1,5 +1,6 @@ {{ config( - materialized='table' + materialized='table', + tags=["commcare_extraction", "gender_safe_house", "gender"] ) }} with diff --git a/models/marts/gender/sessions_attended.sql b/models/marts/gender/sessions_attended.sql index c54271d..9ef1593 100644 --- a/models/marts/gender/sessions_attended.sql +++ b/models/marts/gender/sessions_attended.sql @@ -1,5 +1,6 @@ {{ config( - materialized='table' + materialized='table', + tags=['gender_mental_health_assesment', "gender"] ) }} SELECT @@ -8,4 +9,4 @@ SELECT date_of_final_assessment, session_id FROM {{ ref('staging_gender_final_mental_health_assesment') }} -WHERE sessions_attended IS NOT NULL -- Filter to ensure there are valid session counts +WHERE sessions_attended IS NOT NULL -- Filter to ensure there are valid session counts \ No newline at end of file diff --git a/models/marts/gender/supported.sql b/models/marts/gender/supported.sql index 0df4116..a4ad929 100644 --- a/models/marts/gender/supported.sql +++ b/models/marts/gender/supported.sql @@ -1,5 +1,6 @@ {{ config( - materialized='table' + materialized='table', + tags= ["commcare_extraction", "gender_cases", "gender"] ) }} with @@ -16,39 +17,31 @@ case_occurrences_data as ( from {{ ref("case_occurence_pii") }} ), -date_range as ( - -- Generate a series of months covering the period of interest - select - date_trunc( - 'month', - generate_series( - (select min(date_of_case_reporting) from case_occurrences_data), -- Earliest date_of_reporting - coalesce( - (select max(date_of_case_closure) from case_occurrences_data), -- Latest date_of_case_closure - current_date - ), - interval '1 month' - ) - ) as month -), + date_range as ( + -- Generate a series of months covering the period of interest + select + date_trunc( + 'month', + generate_series( + (select min(date_of_case_reporting) from case_occurrences_data), -- Earliest date_of_reporting + coalesce( + (select max(date_of_case_closure) from case_occurrences_data), -- Latest date_of_case_closure + current_date + ), + interval '1 month' + ) + ) as month + ), -cases_expanded as ( - select - c.parent_case_id, - c.case_name, - c.assigned_to, - c.date_of_case_reporting, - c.date_of_case_closure, - c.county, - c.site, - dr.month - from case_occurrences_data as c - cross join date_range as dr - where - -- Check if the case is open during the given month - c.date_of_case_reporting <= (dr.month + interval '1 month' - interval '1 day') - and (c.date_of_case_closure >= dr.month or c.date_of_case_closure is null) -) + cases_expanded as ( + select c.parent_case_id, c.case_name, c.assigned_to,c.date_of_case_reporting, c.date_of_case_closure, c.county, c.site, dr.month + from case_occurrences_data c + cross join date_range dr + where + -- Check if the case is open during the given month + c.date_of_case_reporting <= (dr.month + interval '1 month' - interval '1 day') + and (c.date_of_case_closure >= dr.month or c.date_of_case_closure is null) + ) select c.month, @@ -59,9 +52,9 @@ select c.site, case when - c.date_of_case_reporting <= (c.month + interval '1 month' - interval '1 day') - and (c.date_of_case_closure >= c.month or c.date_of_case_closure is null) - then 1 + c.date_of_case_reporting <= (month + interval '1 month' - interval '1 day') + and (c.date_of_case_closure >= month or c.date_of_case_closure is null) + then 1 else 0 end as is_case_open from cases_expanded as c diff --git a/models/marts/gender/youth_beneficiaries_disagg.sql b/models/marts/gender/youth_beneficiaries_disagg.sql index dd8dcc4..905f77e 100644 --- a/models/marts/gender/youth_beneficiaries_disagg.sql +++ b/models/marts/gender/youth_beneficiaries_disagg.sql @@ -1,5 +1,6 @@ {{ config( - materialized='table' + materialized='table', + tags=['gender_youth_beneficiaries', "gender"] ) }} WITH initial_data AS ( @@ -16,9 +17,11 @@ WITH initial_data AS ( beneficiary_categories, case_name, date_opened, - NULL AS training_type, -- Placeholder for training_type, specific to subsequent data + -- Placeholder for training_type, specific to subsequent data + NULL AS training_type, indexed_on, - NULL AS parent_case_id, -- Placeholder for parent_case_id, specific to subsequent data + -- Placeholder for parent_case_id, specific to subsequent data + NULL AS parent_case_id, unnest(string_to_array(beneficiary_categories, ' ')) AS category FROM {{ ref('staging_youth_beneficiaries') }} WHERE training_type IS NULL @@ -27,23 +30,23 @@ WITH initial_data AS ( subsequent_data AS ( SELECT s.case_id, - coalesce(s.ward, i.ward) AS ward, - coalesce(s.county, i.county) AS county, - coalesce(s.constituency, i.constituency) AS constituency, - coalesce(s.date_of_registration, i.date_of_registration) AS date_of_registration, - coalesce(s.beneficiary_gender, i.beneficiary_gender) AS beneficiary_gender, - coalesce(s.name_of_the_beneficiary, i.name_of_the_beneficiary) AS name_of_the_beneficiary, - coalesce(s.beneficiary_phone_number, i.beneficiary_phone_number) AS beneficiary_phone_number, - coalesce(s.registered_by, i.registered_by) AS registered_by, - coalesce(s.beneficiary_categories, i.beneficiary_categories) AS beneficiary_categories, - coalesce(s.case_name, i.case_name) AS case_name, - coalesce(s.date_opened, i.date_opened) AS date_opened, + COALESCE(s.ward, i.ward) AS ward, + COALESCE(s.county, i.county) AS county, + COALESCE(s.constituency, i.constituency) AS constituency, + COALESCE(s.date_of_registration, i.date_of_registration) AS date_of_registration, + COALESCE(s.beneficiary_gender, i.beneficiary_gender) AS beneficiary_gender, + COALESCE(s.name_of_the_beneficiary, i.name_of_the_beneficiary) AS name_of_the_beneficiary, + COALESCE(s.beneficiary_phone_number, i.beneficiary_phone_number) AS beneficiary_phone_number, + COALESCE(s.registered_by, i.registered_by) AS registered_by, + COALESCE(s.beneficiary_categories, i.beneficiary_categories) AS beneficiary_categories, + COALESCE(s.case_name, i.case_name) AS case_name, + COALESCE(s.date_opened, i.date_opened) AS date_opened, s.training_type, -- Training type specifically from subsequent data s.indexed_on, s.parent_case_id, -- Keep parent_case_id from subsequent cases - unnest(string_to_array(coalesce(s.beneficiary_categories, i.beneficiary_categories), ' ')) AS category - FROM {{ ref('staging_youth_beneficiaries') }} AS s - LEFT JOIN initial_data AS i ON s.parent_case_id = i.case_id + unnest(string_to_array(COALESCE(s.beneficiary_categories, i.beneficiary_categories), ' ')) AS category + FROM {{ ref('staging_youth_beneficiaries') }} s + LEFT JOIN initial_data i ON s.parent_case_id = i.case_id WHERE s.training_type IS NOT NULL ) diff --git a/models/marts/org_wide/county_footprint.sql b/models/marts/org_wide/county_footprint.sql index 2db3881..83e2d4a 100644 --- a/models/marts/org_wide/county_footprint.sql +++ b/models/marts/org_wide/county_footprint.sql @@ -1,6 +1,6 @@ {{ config( materialized='table', - tags='org_mapping' + tags=['org_mapping', "org_wide"] ) }} SELECT @@ -18,5 +18,4 @@ SELECT CASE WHEN "WASH" = 'Y' THEN 1 ELSE 0 END AS wash, CASE WHEN "Health" = 'Y' THEN 1 ELSE 0 END AS health, CASE WHEN "Libraries" = 'Y' THEN 1 ELSE 0 END AS libraries -FROM {{ ref("staging_county_footprint") }} - +FROM {{ ref("staging_county_footprint") }} \ No newline at end of file diff --git a/models/marts/org_wide/mapping.sql b/models/marts/org_wide/mapping.sql index 924317a..f897cbd 100644 --- a/models/marts/org_wide/mapping.sql +++ b/models/marts/org_wide/mapping.sql @@ -1,55 +1,54 @@ {{ config( materialized='table', - tags='org_mapping' + tags=['org_mapping', "org_wide"] ) }} SELECT - id, - case_id, - case_type, - facility, - school_name, - type_of_school, - ward, - county, - constituency, - office_gender_desk_location, - CAST(received_on AS DATE) AS received_on, + "id", + "case_id", + "case_type", + "facility", + "school_name", + "type_of_school", + "ward", + "county", + "constituency", + "office_gender_desk_location", + CAST("received_on" as DATE) as "received_on", + -- Extract GPS components from gps_location field - CAST(SPLIT_PART(gps_location, ' ', 1) AS FLOAT) AS latitude, - CAST(SPLIT_PART(gps_location, ' ', 2) AS FLOAT) AS longitude, - CAST(SPLIT_PART(gps_location, ' ', 3) AS FLOAT) AS altitude, - CAST(SPLIT_PART(gps_location, ' ', 4) AS FLOAT) AS accuracy, + split_part("gps_location", ' ', 1)::float AS "latitude", + split_part("gps_location", ' ', 2)::float AS "longitude", + split_part("gps_location", ' ', 3)::float AS "altitude", + split_part("gps_location", ' ', 4)::float AS "accuracy", -- Create "Active Programs" column based on program columns CASE - WHEN wash_program = 'yes' AND gender_program = 'yes' AND shofco_education_program = 'yes' THEN 'WASH, Gender, Education' - WHEN wash_program = 'yes' AND gender_program = 'yes' THEN 'WASH, Gender' - WHEN wash_program = 'yes' AND shofco_education_program = 'yes' THEN 'WASH, Education' - WHEN gender_program = 'yes' AND shofco_education_program = 'yes' THEN 'Gender, Education' - WHEN wash_program = 'yes' THEN 'WASH' - WHEN gender_program = 'yes' THEN 'Gender' - WHEN shofco_education_program = 'yes' THEN 'Education' - END AS active_programs, + WHEN "wash_program" = 'yes' AND "gender_program" = 'yes' AND "shofco_education_program" = 'yes' THEN 'WASH, Gender, Education' + WHEN "wash_program" = 'yes' AND "gender_program" = 'yes' THEN 'WASH, Gender' + WHEN "wash_program" = 'yes' AND "shofco_education_program" = 'yes' THEN 'WASH, Education' + WHEN "gender_program" = 'yes' AND "shofco_education_program" = 'yes' THEN 'Gender, Education' + WHEN "wash_program" = 'yes' THEN 'WASH' + WHEN "gender_program" = 'yes' THEN 'Gender' + WHEN "shofco_education_program" = 'yes' THEN 'Education' + ELSE NULL + END AS "active_programs", -- Concatenate intervention into a single column CASE - WHEN gender_intervention IS NOT NULL AND wash_intervention IS NOT NULL AND education_intervention IS NOT NULL - THEN - gender_intervention || ', ' || wash_intervention || ', ' || education_intervention - WHEN gender_intervention IS NOT NULL AND wash_intervention IS NOT NULL - THEN - gender_intervention || ', ' || wash_intervention - WHEN gender_intervention IS NOT NULL AND education_intervention IS NOT NULL - THEN - gender_intervention || ', ' || education_intervention - WHEN wash_intervention IS NOT NULL AND education_intervention IS NOT NULL - THEN - wash_intervention || ', ' || education_intervention - WHEN gender_intervention IS NOT NULL THEN gender_intervention - WHEN wash_intervention IS NOT NULL THEN wash_intervention - WHEN education_intervention IS NOT NULL THEN education_intervention - END AS intervention + WHEN "gender_intervention" IS NOT NULL AND "wash_intervention" IS NOT NULL AND "education_intervention" IS NOT NULL THEN + "gender_intervention" || ', ' || "wash_intervention" || ', ' || "education_intervention" + WHEN "gender_intervention" IS NOT NULL AND "wash_intervention" IS NOT NULL THEN + "gender_intervention" || ', ' || "wash_intervention" + WHEN "gender_intervention" IS NOT NULL AND "education_intervention" IS NOT NULL THEN + "gender_intervention" || ', ' || "education_intervention" + WHEN "wash_intervention" IS NOT NULL AND "education_intervention" IS NOT NULL THEN + "wash_intervention" || ', ' || "education_intervention" + WHEN "gender_intervention" IS NOT NULL THEN "gender_intervention" + WHEN "wash_intervention" IS NOT NULL THEN "wash_intervention" + WHEN "education_intervention" IS NOT NULL THEN "education_intervention" + ELSE NULL + END AS "intervention" FROM {{ ref('staging_mapping') }} diff --git a/models/marts/wash/avg_hygiene_score_term.sql b/models/marts/wash/avg_hygiene_score_term.sql index 9aa1271..a4aaa28 100644 --- a/models/marts/wash/avg_hygiene_score_term.sql +++ b/models/marts/wash/avg_hygiene_score_term.sql @@ -1,6 +1,6 @@ {{ config( materialized='table', - tags='wash_health_indicators' + tags=['wash_health_indicators', "wash"] ) }} WITH latest_scores AS ( diff --git a/models/marts/wash/health_indicators.sql b/models/marts/wash/health_indicators.sql index bd24a27..049444f 100644 --- a/models/marts/wash/health_indicators.sql +++ b/models/marts/wash/health_indicators.sql @@ -1,6 +1,6 @@ {{ config( materialized='table', - tags='wash_health_indicators' + tags=['wash_health_indicators',"wash"] ) }} SELECT @@ -13,7 +13,8 @@ SELECT health_club_active, hygiene_score, CASE - WHEN form_date IS NOT NULL THEN EXTRACT(YEAR FROM CAST(form_date AS DATE)) - END AS year + WHEN "form_date" IS NOT NULL THEN EXTRACT(YEAR FROM CAST("form_date" AS DATE)) + ELSE NULL + END AS "year" FROM {{ ref('staging_health_indicators') }} -WHERE health_club_active=1 +WHERE "health_club_active"=1 \ No newline at end of file diff --git a/models/marts/wash/health_indicators_schools_improved.sql b/models/marts/wash/health_indicators_schools_improved.sql index 0af6f16..344ff9a 100644 --- a/models/marts/wash/health_indicators_schools_improved.sql +++ b/models/marts/wash/health_indicators_schools_improved.sql @@ -1,7 +1,7 @@ {{ config( materialized="table", - tags='wash_health_indicators' + tags=['wash_health_indicators', "wash"] ) }} @@ -32,18 +32,17 @@ schools_with_improvements AS ( final_aggregates AS ( SELECT - h.term, - h.year, - COUNT(DISTINCT h.school_name) AS total_no_schools, - COUNT(DISTINCT s.school_name) AS schools_improved, - COUNT(DISTINCT s.school_name) * 1.0 / COUNT(DISTINCT h.school_name) AS share_of_schools_improved - FROM hygiene_data AS h - LEFT JOIN schools_with_improvements AS s - ON - h.school_name = s.school_name - AND h.term = s.term - AND h.year = s.year - GROUP BY h.term, h.year + h."term", + h."year", + COUNT(DISTINCT h."school_name") AS total_no_schools, + COUNT(DISTINCT s."school_name") AS schools_improved, + COUNT(DISTINCT s."school_name") * 1.0 / COUNT(DISTINCT h."school_name") AS share_of_schools_improved + FROM hygiene_data h + LEFT JOIN schools_with_improvements s + ON h."school_name" = s."school_name" + AND h."term" = s."term" + AND h."year" = s."year" + GROUP BY h."term", h."year" ) SELECT * FROM final_aggregates diff --git a/models/marts/wash/user_meters_mobiwater.sql b/models/marts/wash/user_meters_mobiwater.sql index e1a1519..51da980 100644 --- a/models/marts/wash/user_meters_mobiwater.sql +++ b/models/marts/wash/user_meters_mobiwater.sql @@ -1,9 +1,9 @@ {{ config( materialized='table', - tags='wash_mobiwater' + tags=['wash_mobiwater', "wash"] ) }} SELECT DISTINCT - CAST(flow_device_id AS INTEGER) AS flow_device_id, - flow_device_name +CAST("flow_device_id" AS INTEGER) as flow_device_id, +"flow_device_name" as flow_device_name FROM {{ ref('staging_user_meters_mobiwater') }} diff --git a/models/marts/wash/wash_facilities.sql b/models/marts/wash/wash_facilities.sql index f5086ef..e9fd40a 100644 --- a/models/marts/wash/wash_facilities.sql +++ b/models/marts/wash/wash_facilities.sql @@ -1,30 +1,32 @@ {{ config( materialized='table', - tags='wash_facilities' + tags=['wash_facilities',"wash"] ) }} select - ward, - county, - village, - REGEXP_REPLACE(latitude, '[^0-9.-]', '', 'g') as latitude, - REGEXP_REPLACE(longitude, '[^0-9.-]', '', 'g') as longitude, - subcounty, - date_facility_opened, - facility_id, - facility_name, - facility_type, - date_of_submission, - status_of_facility, - case_name, - case_type, - date_opened, - case_id, - indexed_on, - closed, - created_at, - case - when date_of_submission is not NULL then EXTRACT(year from CAST(date_of_submission as DATE)) - end as year -from {{ ref('staging_facilities') }} -where facility_name != 'test' +"ward", +"county", +"village", +REGEXP_REPLACE("latitude", '[^0-9.-]', '') AS "latitude", +REGEXP_REPLACE("longitude", '[^0-9.-]', '') AS "longitude", +"subcounty", +"date_facility_opened", +"facility_id", +"facility_name", +"facility_type", +"date_of_submission", +"status_of_facility", +"case_name", +"case_type", +"date_opened", +"case_id", +"indexed_on", +"closed", +"created_at", +CASE + WHEN NULLIF("date_of_submission", '') IS NOT NULL + THEN EXTRACT(YEAR FROM CAST(NULLIF("date_of_submission", '') AS DATE)) + ELSE NULL + END AS "year" +FROM {{ ref('staging_facilities') }} +WHERE "facility_name" != 'test' \ No newline at end of file diff --git a/models/marts/wash/water_consumption_mobiwater.sql b/models/marts/wash/water_consumption_mobiwater.sql index 847a1b2..e2b1afa 100644 --- a/models/marts/wash/water_consumption_mobiwater.sql +++ b/models/marts/wash/water_consumption_mobiwater.sql @@ -1,20 +1,20 @@ {{ config( materialized='table', - tags='wash_mobiwater' + tags=['wash_mobiwater', "wash"] ) }} WITH staging_data AS ( SELECT - CAST(date AS DATE) AS date, - CAST(flow_device_id AS NUMERIC) AS flow_device_id, - CAST(value AS NUMERIC) AS value + CAST("date" AS DATE), + CAST("flow_device_id" AS NUMERIC) AS "flow_device_id", + CAST("value" AS NUMERIC) AS "value" FROM {{ ref('staging_meter_readings_mobiwater') }} ), user_meters AS ( SELECT - CAST(flow_device_id AS NUMERIC) AS flow_device_id, - flow_device_name + CAST("flow_device_id" AS NUMERIC) AS "flow_device_id", + "flow_device_name" AS "flow_device_name" FROM {{ ref('user_meters_mobiwater') }} ) diff --git a/models/marts/wash/water_production.sql b/models/marts/wash/water_production.sql index 0f7b1ed..eeaa1cd 100644 --- a/models/marts/wash/water_production.sql +++ b/models/marts/wash/water_production.sql @@ -1,15 +1,16 @@ {{ config( materialized='table', - tags='wash_water_production' + tags=['wash_water_production', "wash"] ) }} select - date, - status, - bh_production, - treated_consumption, - tank, - case - when date is not NULL then EXTRACT(year from TO_DATE(date, 'DD/MM/YYYY')) - end as year -from {{ ref('staging_water_production') }} + "date", + "status", + "bh_production", + "treated_consumption", + "tank", + CASE + WHEN "date" IS NOT NULL THEN EXTRACT(YEAR FROM TO_DATE("date", 'DD/MM/YYYY')) + ELSE NULL + END AS "year" +FROM {{ ref('staging_water_production') }} \ No newline at end of file diff --git a/models/staging/education/staging_followup_attendance.sql b/models/staging/education/staging_followup_attendance.sql index 38d897e..da78e5d 100644 --- a/models/staging/education/staging_followup_attendance.sql +++ b/models/staging/education/staging_followup_attendance.sql @@ -1,6 +1,6 @@ {{ config( materialized='table', - tags="education_attendance" + tags=["education_attendance", "education"] ) }} SELECT diff --git a/models/staging/education/staging_nudges.sql b/models/staging/education/staging_nudges.sql index d55eda9..764e432 100644 --- a/models/staging/education/staging_nudges.sql +++ b/models/staging/education/staging_nudges.sql @@ -1,17 +1,17 @@ {{ config( materialized='table', - tags="education_expansion" + tags=["education_expansion", "education"] ) }} SELECT "Term" AS term, "Year" AS year, - LOWER("COUNTY") AS county, - "Cohort" AS cohort, - LOWER("GENDER") AS gender, - LOWER("SUBCOUNTY") AS subcounty, - "CURRENT_GRADE" AS grade, + "Cohort" AS cohort, + "CURRENT_GRADE" AS grade, "NAME_OF_PUPIL" AS name, "PRIMARY_SCHOOL" AS primary_school, - "NUDGE_TYPE_RECEIVED" AS nudge_type + "NUDGE_TYPE_RECEIVED" AS nudge_type, + LOWER("COUNTY") AS county, + LOWER("GENDER") AS gender, + LOWER("SUBCOUNTY") AS subcounty FROM {{ source('staging_education', 'Nudges') }} diff --git a/models/staging/education/staging_parents_attendance.sql b/models/staging/education/staging_parents_attendance.sql index af7683f..92556c9 100644 --- a/models/staging/education/staging_parents_attendance.sql +++ b/models/staging/education/staging_parents_attendance.sql @@ -1,19 +1,19 @@ {{ config( materialized='table', - tags="education_attendance" + tags=["education_attendance", "education"] ) }} SELECT "Term", "Year", "Grade", - "Cohort", + "Cohort", "Meeting_Date", "Meeting_Type", - "Number_Present", - "Number_of_Parents", - "Attendance_Percentage_", - "Share_of_Parents_Engaged", + "Number_Present", + "Number_of_Parents", + "Attendance_Percentage_", + "Share_of_Parents_Engaged", "Attendance_Data_Collected", _airbyte_raw_id, _airbyte_extracted_at, @@ -25,13 +25,13 @@ SELECT "Term", "Year", "Grade", - "Cohort", + "Cohort", "Meeting_Date", "Meeting_Type", - "Number_Present", - "Number_of_Parents", - "Attendance_Percentage_", - "Share_of_Parents_Engaged", + "Number_Present", + "Number_of_Parents", + "Attendance_Percentage_", + "Share_of_Parents_Engaged", "Attendance_Data_Collected", _airbyte_raw_id, _airbyte_extracted_at, diff --git a/models/staging/education/staging_parents_satisfaction_survey.sql b/models/staging/education/staging_parents_satisfaction_survey.sql index 9affdef..5bcd396 100644 --- a/models/staging/education/staging_parents_satisfaction_survey.sql +++ b/models/staging/education/staging_parents_satisfaction_survey.sql @@ -1,6 +1,6 @@ {{ config( materialized='table', - tags="education_satisfaction_surveys" + tags=["education_satisfaction_surveys", "education"] ) }} WITH source_data AS ( @@ -8,48 +8,107 @@ WITH source_data AS ( id, data AS json_data FROM {{ source('staging_education', 'Parent_Satisfaction_Survey') }} - WHERE data::jsonb->>'archived' IS NULL OR data::jsonb->>'archived' = 'false' + WHERE + data::jsonb ->> 'archived' IS NULL + OR data::jsonb ->> 'archived' = 'false' ) - SELECT -- Basic Details - json_data->'form'->>'student_name' AS student_name, - json_data->'form'->>'grade' AS grade, - json_data->'form'->>'term' AS term, - json_data->'form'->>'school' AS school, - json_data->'form'->>'age_of_your_child' AS child_age, - json_data->'form'->>'class_year_of_child' AS class_year_of_child, - json_data->'form'->>'parentguardian_name' AS parent_name, - + json_data -> 'form' ->> 'student_name' AS student_name, + json_data -> 'form' ->> 'grade' AS grade, + json_data -> 'form' ->> 'term' AS term, + json_data -> 'form' ->> 'school' AS school, + json_data -> 'form' ->> 'age_of_your_child' AS child_age, + json_data -> 'form' ->> 'class_year_of_child' AS class_year_of_child, + json_data -> 'form' ->> 'parentguardian_name' AS parent_name, + -- Satisfaction Scores - json_data->'form'->'section_a'->>'section_a_general_satisfaction_with_the_shofco_school' AS general_satisfaction, - json_data->'form'->'section_a'->>'how_satisfied_are_you_with_the_education_received_by_your_child_at_the_scho' AS education_satisfaction, - json_data->'form'->'section_b'->>'section_b_parents_and_teachers_relationships' AS teacher_parent_relationship, - json_data->'form'->'section_b'->>'how_satisfied_are_you_with_how_parents_and_teachers_relate_at_the_school_on' AS relationship_satisfaction, - json_data->'form'->'section_c'->>'section_c_student-teacher_ratio' AS student_teacher_ratio, - json_data->'form'->'section_c'->>'how_satisfied_are_you_with_the_number_of_students_handled_by_each_teacher_b' AS student_teacher_ratio_satisfaction, - json_data->'form'->'section_d'->>'section_d_school_hygiene_and_sanitation' AS hygiene_satisfaction, - json_data->'form'->'section_d'->>'how_satisfied_are_you_with_the_school_hygiene_and_other_sanitation_services' AS sanitation_satisfaction, - json_data->'form'->'section_e'->>'section_e_school_feeding_program' AS feeding_program_satisfaction, - json_data->'form'->'section_e'->>'how_satisfied_are_you_with_the_school_feeding_program_provided_by_the_schoo' AS feeding_satisfaction, - json_data->'form'->'section_f'->>'section_f_extracurricular_activities' AS extracurricular_satisfaction, - json_data->'form'->'section_f'->>'how_satisfied_are_you_with_the_extracurricular_activities_provided_by_the_s' AS extracurricular_satisfaction_detail, - json_data->'form'->'section_g'->>'section_g_parental_engagement_requested_by_the_school' AS parental_engagement_satisfaction, - json_data->'form'->'section_g'->>'how_satisfied_are_you_with_the_level_of_parental_engagement_requested_by_th' AS parental_engagement_satisfaction_detail, - + json_data + -> 'form' + -> 'section_a' + ->> 'section_a_general_satisfaction_with_the_shofco_school' AS general_satisfaction, + json_data + -> 'form' + -> 'section_a' + ->> 'how_satisfied_are_you_with_the_education_received_by_your_child_at_the_scho' AS education_satisfaction, + json_data + -> 'form' + -> 'section_b' + ->> 'section_b_parents_and_teachers_relationships' AS teacher_parent_relationship, + json_data + -> 'form' + -> 'section_b' + ->> 'how_satisfied_are_you_with_how_parents_and_teachers_relate_at_the_school_on' AS relationship_satisfaction, + json_data + -> 'form' + -> 'section_c' + ->> 'section_c_student-teacher_ratio' AS student_teacher_ratio, + json_data + -> 'form' + -> 'section_c' + ->> 'how_satisfied_are_you_with_the_number_of_students_handled_by_each_teacher_b' AS student_teacher_ratio_satisfaction, + json_data + -> 'form' + -> 'section_d' + ->> 'section_d_school_hygiene_and_sanitation' AS hygiene_satisfaction, + json_data + -> 'form' + -> 'section_d' + ->> 'how_satisfied_are_you_with_the_school_hygiene_and_other_sanitation_services' AS sanitation_satisfaction, + json_data + -> 'form' + -> 'section_e' + ->> 'section_e_school_feeding_program' AS feeding_program_satisfaction, + json_data + -> 'form' + -> 'section_e' + ->> 'how_satisfied_are_you_with_the_school_feeding_program_provided_by_the_schoo' AS feeding_satisfaction, + json_data + -> 'form' + -> 'section_f' + ->> 'section_f_extracurricular_activities' AS extracurricular_satisfaction, + json_data + -> 'form' + -> 'section_f' + ->> 'how_satisfied_are_you_with_the_extracurricular_activities_provided_by_the_s' AS extracurricular_satisfaction_detail, + json_data + -> 'form' + -> 'section_g' + ->> 'section_g_parental_engagement_requested_by_the_school' AS parental_engagement_satisfaction, + json_data + -> 'form' + -> 'section_g' + ->> 'how_satisfied_are_you_with_the_level_of_parental_engagement_requested_by_th' AS parental_engagement_satisfaction_detail, + -- Improvement Suggestions - json_data->'form'->'section_i'->>'section_i_suggestions_for_improvement_at_the_school' AS improvement_suggestions, - json_data->'form'->'section_i'->>'if_you_could_propose_some_changes_at_the_school_what_could_those_be' AS proposed_changes, - + json_data + -> 'form' + -> 'section_i' + ->> 'section_i_suggestions_for_improvement_at_the_school' AS improvement_suggestions, + json_data + -> 'form' + -> 'section_i' + ->> 'if_you_could_propose_some_changes_at_the_school_what_could_those_be' AS proposed_changes, + -- Changes Observed (Section H) - json_data->'form'->'section_h'->>'since_your_daughter_joined_the_shofco_school_which_changes_have_you_seen_in' AS observed_changes, - json_data->'form'->'section_h'->>'section_h_changes_you_have_seen_in_your_child' AS changes_in_child, + json_data + -> 'form' + -> 'section_h' + ->> 'since_your_daughter_joined_the_shofco_school_which_changes_have_you_seen_in' AS observed_changes, + json_data + -> 'form' + -> 'section_h' + ->> 'section_h_changes_you_have_seen_in_your_child' AS changes_in_child, -- Other Details - json_data->'form'->>'in_the_past_one_year_has_you_or_any_member_of_your_family_benefitted_from_o' AS family_benefit, - json_data->'form'->>'parents_satisfaction_survey_background_and_purpose_in_order_to_continuously' AS survey_background, - + json_data + -> 'form' + ->> 'in_the_past_one_year_has_you_or_any_member_of_your_family_benefitted_from_o' AS family_benefit, + json_data + -> 'form' + ->> 'parents_satisfaction_survey_background_and_purpose_in_order_to_continuously' AS survey_background, + -- Submission Details - json_data->>'received_on' AS submission_time + json_data ->> 'received_on' AS submission_time -FROM source_data +FROM source_data \ No newline at end of file diff --git a/models/staging/education/staging_public_partnerships.sql b/models/staging/education/staging_public_partnerships.sql index 22798b8..5ee610a 100644 --- a/models/staging/education/staging_public_partnerships.sql +++ b/models/staging/education/staging_public_partnerships.sql @@ -1,24 +1,24 @@ {{ config( materialized='table', - tags="education_expansion" + tags=["education_expansion", "education"] ) }} SELECT - "Year" AS year, - "School_Name" AS school_name, - "School_County" AS county, - "Mean_KPCE_Score" AS mean_kpce_score, - "School_Subcounty" AS subcounty, - "__Teachers_trained" AS teachers_trained, - "__Students_enrolled" AS students_enrolled, - "__Computers_provided" AS computers_provided, - "T1_Average_Attendance" AS t1_average_attendance, - "T2_Average_Attendance" AS t2_average_attendance, - "T3_Average_Attendance" AS t3_average_attendance, - "__Toilet_stances_built" AS toilet_stances_built, - "High_Touch___Low_Touch" AS high_touch_low_touch, - "Revised_Toilet_Student_Ratio" AS revised_toilet_student_ratio, - "Baseline_Toilet_Student_Ratio" AS baseline_toilet_student_ratio, - "Teacher_Training_Satisfaction" AS teacher_training_satisfaction, - _airbyte_extracted_at + "Year" as "year", + "School_Name" as "school_name", + "School_County" as "county", + "Mean_KPCE_Score" as "mean_kpce_score", + "School_Subcounty" as "subcounty", + "__Teachers_trained" as "teachers_trained", + "__Students_enrolled" as "students_enrolled", + "__Computers_provided" as "computers_provided", + "T1_Average_Attendance" as "t1_average_attendance", + "T2_Average_Attendance" as "t2_average_attendance", + "T3_Average_Attendance" as "t3_average_attendance", + "__Toilet_stances_built" as "toilet_stances_built", + "High_Touch___Low_Touch" as "high_touch_low_touch", + "Revised_Toilet_Student_Ratio" as "revised_toilet_student_ratio", + "Baseline_Toilet_Student_Ratio" as "baseline_toilet_student_ratio", + "Teacher_Training_Satisfaction" as "teacher_training_satisfaction", + "_airbyte_extracted_at" FROM {{ source('staging_education', 'Public_School_Partnerships') }} diff --git a/models/staging/education/staging_scholarships.sql b/models/staging/education/staging_scholarships.sql index 547de34..97629c5 100644 --- a/models/staging/education/staging_scholarships.sql +++ b/models/staging/education/staging_scholarships.sql @@ -1,32 +1,32 @@ {{ config( materialized='table', - tags="education_expansion" + tags=["education_expansion", "education"] ) }} SELECT - "Term" AS term, - "Year" AS year, - "Cohort" AS cohort, - "Orphan_" AS orphan, - "Teen_Mom_" AS teen_mom, - "Home_County" AS county, - "GBV_survivor_" AS gbv_survivor, - "Current_Status" AS current_status, - "Form__current_" AS form, - "Special_needs_" AS special_needs, - "Boarding_OR_Day" AS boarding_or_day, - "Home_Sub_County" AS subcounty, - "School_Location" AS school_location, - "Public_OR_Private" AS public_or_private, - "Form__when_awarded_" AS form_when_awarded, - "Official_School_Name" AS school_name, - "Became_pregnant_during_program" AS became_pregnant_during_program, - "Experienced_GBV_during_program" AS experienced_gbv_during_program, - "Scholarship_Enrollment_Status_T1_2025" AS scholarship_enrollment_status_t1_2025, - "Scholarship_Enrollment_Status_T2_2025" AS scholarship_enrollment_status_t2_2025, - "Scholarship_Enrollment_Status_T3_2024" AS scholarship_enrollment_status_t3_2024, - "Scholarship_Enrollment_Status_T3_2025" AS scholarship_enrollment_status_t3_2025, - "Student_Name__As_Captured_on_Application_" AS school_name_on_application, - "Referred_to_gender_for_psychosocial_counselling_" AS referred_to_psychosocial_counselling, - _airbyte_extracted_at + "Term" as "term", + "Year" as "year", + "Cohort" as "cohort", + "Orphan_" as "orphan", + "Teen_Mom_" as "teen_mom", + "Home_County" as "county", + "GBV_survivor_" as "gbv_survivor", + "Current_Status" as "current_status", + "Form__current_" as "form", + "Special_needs_" as "special_needs", + "Boarding_OR_Day" as "boarding_or_day", + "Home_Sub_County" as "subcounty", + "School_Location" as "school_location", + "Public_OR_Private" as "public_or_private", + "Form__when_awarded_" as "form_when_awarded", + "Official_School_Name" as "school_name", + "Became_pregnant_during_program" as "became_pregnant_during_program", + "Experienced_GBV_during_program" as "experienced_gbv_during_program", + "Scholarship_Enrollment_Status_T1_2025" as "scholarship_enrollment_status_t1_2025", + "Scholarship_Enrollment_Status_T2_2025" as "scholarship_enrollment_status_t2_2025", + "Scholarship_Enrollment_Status_T3_2024" as "scholarship_enrollment_status_t3_2024", + "Scholarship_Enrollment_Status_T3_2025" as "scholarship_enrollment_status_t3_2025", + "Student_Name__As_Captured_on_Application_" as "school_name_on_application", + "Referred_to_gender_for_psychosocial_counselling_" as "referred_to_psychosocial_counselling", + "_airbyte_extracted_at" FROM {{ source('staging_education', 'Scholarships') }} diff --git a/models/staging/education/staging_student_satisfaction_survey.sql b/models/staging/education/staging_student_satisfaction_survey.sql index 59ad019..c00dbf3 100644 --- a/models/staging/education/staging_student_satisfaction_survey.sql +++ b/models/staging/education/staging_student_satisfaction_survey.sql @@ -1,85 +1,205 @@ {{ config( materialized='table', - tags="education_satisfaction_surveys" + tags=["education_satisfaction_surveys", "education"] ) }} WITH source_data AS ( SELECT id, data AS json_data -- Cast the data column to JSONB - FROM {{ source('staging_education', 'Student_Satisfaction_and_Well_Being_Survey') }} - WHERE data::jsonb->>'archived' IS NULL OR data::jsonb->>'archived' = 'false' + FROM + {{ source('staging_education', 'Student_Satisfaction_and_Well_Being_Survey') }} + WHERE + data::jsonb ->> 'archived' IS NULL + OR data::jsonb ->> 'archived' = 'false' ) SELECT -- Student Information - json_data->'form'->'stxudent_information'->>'student_name' AS student_name, - json_data->'form'->'student_information'->>'grade' AS grade, - json_data->'form'->'student_information'->>'term' AS term, - json_data->'form'->'student_information'->>'school' AS school, - json_data->'form'->'student_information'->>'your_class_year' AS class_year, + json_data + -> 'form' + -> 'stxudent_information' + ->> 'student_name' AS student_name, + json_data -> 'form' -> 'student_information' ->> 'grade' AS grade, + json_data -> 'form' -> 'student_information' ->> 'term' AS term, + json_data -> 'form' -> 'student_information' ->> 'school' AS school, + json_data + -> 'form' + -> 'student_information' + ->> 'your_class_year' AS class_year, -- Section A - General Satisfaction - json_data->'form'->'section_a'->>'section_a_general_satisfaction_with_the_school' AS general_satisfaction, - json_data->'form'->'section_a'->>'how_satisfied_are_you_with_the_school_in_general_tick_one_box_please' AS school_satisfaction, - json_data->'form'->'section_a'->>'section_a_commentssuggestions' AS general_satisfaction_comments, + json_data + -> 'form' + -> 'section_a' + ->> 'section_a_general_satisfaction_with_the_school' AS general_satisfaction, + json_data + -> 'form' + -> 'section_a' + ->> 'how_satisfied_are_you_with_the_school_in_general_tick_one_box_please' AS school_satisfaction, + json_data + -> 'form' + -> 'section_a' + ->> 'section_a_commentssuggestions' AS general_satisfaction_comments, -- Section B - Teaching Methods - json_data->'form'->'section_b'->>'section_b_teaching_method_and_teacher_support_to_students' AS teaching_method_satisfaction, - json_data->'form'->'section_b'->>'how_satisfied_are_you_with_how_the_teachers_teach_in_class_tick_one_box_ple' AS teacher_teaching_satisfaction, - json_data->'form'->'section_b'->>'how_satisfied_are_you_with_the_way_the_teachers_support_students_to_learn_b' AS teacher_support_satisfaction, - json_data->'form'->'section_b'->>'section_b1-commentssuggestions' AS teacher_teaching_comments, - json_data->'form'->'section_b'->>'section_b2_commentssuggestions' AS teacher_support_comments, + json_data + -> 'form' + -> 'section_b' + ->> 'section_b_teaching_method_and_teacher_support_to_students' AS teaching_method_satisfaction, + json_data + -> 'form' + -> 'section_b' + ->> 'how_satisfied_are_you_with_how_the_teachers_teach_in_class_tick_one_box_ple' AS teacher_teaching_satisfaction, + json_data + -> 'form' + -> 'section_b' + ->> 'how_satisfied_are_you_with_the_way_the_teachers_support_students_to_learn_b' AS teacher_support_satisfaction, + json_data + -> 'form' + -> 'section_b' + ->> 'section_b1-commentssuggestions' AS teacher_teaching_comments, + json_data + -> 'form' + -> 'section_b' + ->> 'section_b2_commentssuggestions' AS teacher_support_comments, -- Section C - Student-Teacher Relationships - json_data->'form'->'section_c'->>'section_c_student-teacher_relationship' AS student_teacher_relationship, - json_data->'form'->'section_c'->>'how_satisfied_are_you_with_how_the_teachers_relate_with_students_and_how_th' AS student_teacher_relationship_satisfaction, - json_data->'form'->'section_c'->>'section_c-commentssuggestions' AS student_teacher_relationship_comments, + json_data + -> 'form' + -> 'section_c' + ->> 'section_c_student-teacher_relationship' AS student_teacher_relationship, + json_data + -> 'form' + -> 'section_c' + ->> 'how_satisfied_are_you_with_how_the_teachers_relate_with_students_and_how_th' AS student_teacher_relationship_satisfaction, + json_data + -> 'form' + -> 'section_c' + ->> 'section_c-commentssuggestions' AS student_teacher_relationship_comments, -- Section D - Library and Reading Materials - json_data->'form'->'section_d'->>'section_d_access_to_library_and_other_reading_materials' AS library_access, - json_data->'form'->'section_d'->>'how_satisfied_are_you_with_the_library_services_and_other_reading_materials' AS library_satisfaction, - json_data->'form'->'section_d'->>'section_d-commentssuggestions' AS library_comments, + json_data + -> 'form' + -> 'section_d' + ->> 'section_d_access_to_library_and_other_reading_materials' AS library_access, + json_data + -> 'form' + -> 'section_d' + ->> 'how_satisfied_are_you_with_the_library_services_and_other_reading_materials' AS library_satisfaction, + json_data + -> 'form' + -> 'section_d' + ->> 'section_d-commentssuggestions' AS library_comments, -- Section E - STEM Laboratory and Devices - json_data->'form'->'section_e'->>'section_e_access_to_steam_laboratory_and_other_learning_devices_like_comput' AS steam_lab_access, - json_data->'form'->'section_e'->>'how_satisfied_are_you_with_the_steam_laboratory_and_other_learning_devices_' AS steam_lab_satisfaction, - json_data->'form'->'section_e'->>'section_e-commentssuggestions' AS steam_lab_comments, + json_data + -> 'form' + -> 'section_e' + ->> 'section_e_access_to_steam_laboratory_and_other_learning_devices_like_comput' AS steam_lab_access, + json_data + -> 'form' + -> 'section_e' + ->> 'how_satisfied_are_you_with_the_steam_laboratory_and_other_learning_devices_' AS steam_lab_satisfaction, + json_data + -> 'form' + -> 'section_e' + ->> 'section_e-commentssuggestions' AS steam_lab_comments, -- Section F - Hygiene and Sanitation - json_data->'form'->'section_f'->>'section_f_school_hygiene_and_sanitation' AS hygiene_satisfaction, - json_data->'form'->'section_f'->>'how_satisfied_are_you_with_the_school_hygiene_and_other_sanitation_services' AS sanitation_satisfaction, - json_data->'form'->'section_f'->>'section_f-commentssuggestions' AS hygiene_comments, + json_data + -> 'form' + -> 'section_f' + ->> 'section_f_school_hygiene_and_sanitation' AS hygiene_satisfaction, + json_data + -> 'form' + -> 'section_f' + ->> 'how_satisfied_are_you_with_the_school_hygiene_and_other_sanitation_services' AS sanitation_satisfaction, + json_data + -> 'form' + -> 'section_f' + ->> 'section_f-commentssuggestions' AS hygiene_comments, -- Section G - School Feeding Program - json_data->'form'->'section_g'->>'section_g_school_feeding_program' AS feeding_program_satisfaction, - json_data->'form'->'section_g'->>'how_satisfied_are_you_with_the_school_feeding_program_provided_by_the_schoo' AS feeding_satisfaction, - json_data->'form'->'section_g'->>'section_g_-commentssuggestions' AS feeding_program_comments, + json_data + -> 'form' + -> 'section_g' + ->> 'section_g_school_feeding_program' AS feeding_program_satisfaction, + json_data + -> 'form' + -> 'section_g' + ->> 'how_satisfied_are_you_with_the_school_feeding_program_provided_by_the_schoo' AS feeding_satisfaction, + json_data + -> 'form' + -> 'section_g' + ->> 'section_g_-commentssuggestions' AS feeding_program_comments, -- Section H - Extracurricular Activities - json_data->'form'->'section_h'->>'section_h_extracurricular_activities' AS extracurricular_satisfaction, - json_data->'form'->'section_h'->>'how_satisfied_are_you_with_the_extracurricular_activities_provided_by_the_s' AS extracurricular_satisfaction_detail, - json_data->'form'->'section_h'->>'section_h_-commentssuggestions' AS extracurricular_comments, + json_data + -> 'form' + -> 'section_h' + ->> 'section_h_extracurricular_activities' AS extracurricular_satisfaction, + json_data + -> 'form' + -> 'section_h' + ->> 'how_satisfied_are_you_with_the_extracurricular_activities_provided_by_the_s' AS extracurricular_satisfaction_detail, + json_data + -> 'form' + -> 'section_h' + ->> 'section_h_-commentssuggestions' AS extracurricular_comments, -- Section I - Mental Health Support - json_data->'form'->'section_i'->>'section_i_mental_health_support_provided_by_the_school' AS mental_health_support, - json_data->'form'->'section_i'->>'how_satisfied_are_you_with_the_mental_health_support_provided_by_the_school' AS mental_health_satisfaction, - json_data->'form'->'section_i'->>'section_i-commentssuggestions' AS mental_health_comments, + json_data + -> 'form' + -> 'section_i' + ->> 'section_i_mental_health_support_provided_by_the_school' AS mental_health_support, + json_data + -> 'form' + -> 'section_i' + ->> 'how_satisfied_are_you_with_the_mental_health_support_provided_by_the_school' AS mental_health_satisfaction, + json_data + -> 'form' + -> 'section_i' + ->> 'section_i-commentssuggestions' AS mental_health_comments, -- Section J - Likes - json_data->'form'->'section_j'->>'what_do_you_like_most_about_your_school' AS likes_about_school, + json_data + -> 'form' + -> 'section_j' + ->> 'what_do_you_like_most_about_your_school' AS likes_about_school, -- Section K - Improvements - json_data->'form'->'section_k'->>'section_k_areas_to_improve_at_the_school' AS improvement_areas, - json_data->'form'->'section_k'->>'if_you_could_change_anything_at_the_school_what_would_it_be' AS proposed_changes, + json_data + -> 'form' + -> 'section_k' + ->> 'section_k_areas_to_improve_at_the_school' AS improvement_areas, + json_data + -> 'form' + -> 'section_k' + ->> 'if_you_could_change_anything_at_the_school_what_would_it_be' AS proposed_changes, -- Section L - Parent Engagement - json_data->'form'->'section_l'->>'parent_guardian_engagement' AS parent_engagement, + json_data + -> 'form' + -> 'section_l' + ->> 'parent_guardian_engagement' AS parent_engagement, -- Section M - Well-Being - json_data->'form'->'section_m'->>'ive_been_feeling_calm' AS feeling_calm, - json_data->'form'->'section_m'->>'ive_been_in_a_good_mood' AS good_mood, - json_data->'form'->'section_m'->>'i_always_share_my_sweets' AS share_sweets, - json_data->'form'->'section_m'->>'ive_been_feeling_relaxed' AS feeling_relaxed + json_data + -> 'form' + -> 'section_m' + ->> 'ive_been_feeling_calm' AS feeling_calm, + json_data + -> 'form' + -> 'section_m' + ->> 'ive_been_in_a_good_mood' AS good_mood, + json_data + -> 'form' + -> 'section_m' + ->> 'i_always_share_my_sweets' AS share_sweets, + json_data + -> 'form' + -> 'section_m' + ->> 'ive_been_feeling_relaxed' AS feeling_relaxed FROM source_data diff --git a/models/staging/education/staging_students_attendance.sql b/models/staging/education/staging_students_attendance.sql index a80ca39..e804c75 100644 --- a/models/staging/education/staging_students_attendance.sql +++ b/models/staging/education/staging_students_attendance.sql @@ -1,30 +1,16 @@ {{ config( materialized='table', - tags="education_attendance" + tags=["education_attendance", "education"] ) }} SELECT - "Term", - "Year", - "Grade", - "Avg_Days_Attended", - "Total_School_Days", - "Number_of_Students", - "Attendance_Percentage", - "All_Students___Total_Days_Absent", - "All_Students___Total_Days_Present", - 'KSG' AS "School_Type" + "Term", "Year", "Grade", "Avg_Days_Attended", "Total_School_Days", + "Number_of_Students", "Attendance_Percentage", "All_Students___Total_Days_Absent", + "All_Students___Total_Days_Present", 'KSG' AS "School_Type" FROM {{ source('staging_education', 'KSG_Summary') }} UNION ALL SELECT - "Term", - '2024' AS "Year", - "Grade", - "Avg_Days_Attended", - "Total_School_Days", - "Number_of_Students", - "Attendance_Percentage", - "All_Students___Total_Days_Absent", - "All_Students___Total_Days_Present", - 'MSG' AS "School_Type" + "Term", '2024' AS "Year", "Grade", "Avg_Days_Attended", "Total_School_Days", + "Number_of_Students", "Attendance_Percentage", "All_Students___Total_Days_Absent", + "All_Students___Total_Days_Present", 'MSG' AS "School_Type" FROM {{ source('staging_education', 'MSG_Summary') }} diff --git a/models/staging/education/staging_teacher_satisfaction_survey.sql b/models/staging/education/staging_teacher_satisfaction_survey.sql index 289aa9c..95f3def 100644 --- a/models/staging/education/staging_teacher_satisfaction_survey.sql +++ b/models/staging/education/staging_teacher_satisfaction_survey.sql @@ -1,14 +1,16 @@ {{ config( materialized='table', - tags="education_satisfaction_surveys" + tags=["education_satisfaction_surveys", "education"] ) }} WITH source_data AS ( SELECT id, - data AS json_data + data AS json_data FROM {{ source('staging_education', 'Teachers_Satisfaction_Survey') }} - WHERE data::jsonb->>'archived' IS NULL OR data::jsonb->>'archived' = 'false' + WHERE + data::jsonb ->> 'archived' IS NULL + OR data::jsonb ->> 'archived' = 'false' ) SELECT @@ -17,48 +19,113 @@ SELECT json_data->'form'->>'which_level_do_you_teach_please_tick_one_of_the_following' AS teaching_level, CASE - WHEN json_data->>'received_on' IS NOT NULL - THEN - EXTRACT(YEAR FROM TO_TIMESTAMP(LEFT(json_data->>'received_on', 19), 'YYYY-MM-DD"T"HH24:MI:SS')) - END AS year, + WHEN json_data->>'received_on' IS NOT NULL THEN + EXTRACT(YEAR FROM TO_TIMESTAMP(LEFT(json_data->>'received_on', 19), 'YYYY-MM-DD"T"HH24:MI:SS')) + ELSE NULL + END AS "year", -- Section A - General Satisfaction - json_data->'form'->'section_a'->>'section_a_general_satisfaction_with_the_shofco_school' AS general_satisfaction, - json_data->'form'->'section_a'->>'how_satisfied_are_you_with_the_education_received_by_your_child_at_the_scho' AS education_satisfaction, + json_data + -> 'form' + -> 'section_a' + ->> 'section_a_general_satisfaction_with_the_shofco_school' AS general_satisfaction, + json_data + -> 'form' + -> 'section_a' + ->> 'how_satisfied_are_you_with_the_education_received_by_your_child_at_the_scho' AS education_satisfaction, -- Section B - Parent-Teacher Relationships - json_data->'form'->'section_b'->>'section_b_parents_and_teachers_relationships' AS parent_teacher_relationship, - json_data->'form'->'section_b'->>'how_satisfied_are_you_with_how_parents_and_teachers_relate_at_the_school_on' AS relationship_satisfaction, + json_data + -> 'form' + -> 'section_b' + ->> 'section_b_parents_and_teachers_relationships' AS parent_teacher_relationship, + json_data + -> 'form' + -> 'section_b' + ->> 'how_satisfied_are_you_with_how_parents_and_teachers_relate_at_the_school_on' AS relationship_satisfaction, -- Section C - Student-Teacher Ratio - json_data->'form'->'section_c'->>'section_c_student-teacher_ratio' AS student_teacher_ratio, - json_data->'form'->'section_c'->>'how_satisfied_are_you_with_the_number_of_students_handled_by_each_teacher_b' AS student_teacher_ratio_satisfaction, - json_data->'form'->'section_c'->>'sectionc_commentsrecommendation' AS student_teacher_ratio_comments, + json_data + -> 'form' + -> 'section_c' + ->> 'section_c_student-teacher_ratio' AS student_teacher_ratio, + json_data + -> 'form' + -> 'section_c' + ->> 'how_satisfied_are_you_with_the_number_of_students_handled_by_each_teacher_b' AS student_teacher_ratio_satisfaction, + json_data + -> 'form' + -> 'section_c' + ->> 'sectionc_commentsrecommendation' AS student_teacher_ratio_comments, -- Section D - Hygiene and Sanitation - json_data->'form'->'section_d'->>'section_d_school_hygiene_and_sanitation' AS hygiene_satisfaction, - json_data->'form'->'section_d'->>'how_satisfied_are_you_with_the_school_hygiene_and_other_sanitation_services' AS sanitation_satisfaction, - json_data->'form'->'section_d'->>'sectiond_commentssuggestions' AS sanitation_comments, + json_data + -> 'form' + -> 'section_d' + ->> 'section_d_school_hygiene_and_sanitation' AS hygiene_satisfaction, + json_data + -> 'form' + -> 'section_d' + ->> 'how_satisfied_are_you_with_the_school_hygiene_and_other_sanitation_services' AS sanitation_satisfaction, + json_data + -> 'form' + -> 'section_d' + ->> 'sectiond_commentssuggestions' AS sanitation_comments, -- Section E - School Feeding Program - json_data->'form'->'section_e'->>'section_e_school_feeding_program' AS feeding_program_satisfaction, - json_data->'form'->'section_e'->>'how_satisfied_are_you_with_the_school_feeding_program_provided_by_the_schoo' AS feeding_satisfaction, - json_data->'form'->'section_e'->>'sectione_commentssuggestions' AS feeding_program_comments, + json_data + -> 'form' + -> 'section_e' + ->> 'section_e_school_feeding_program' AS feeding_program_satisfaction, + json_data + -> 'form' + -> 'section_e' + ->> 'how_satisfied_are_you_with_the_school_feeding_program_provided_by_the_schoo' AS feeding_satisfaction, + json_data + -> 'form' + -> 'section_e' + ->> 'sectione_commentssuggestions' AS feeding_program_comments, -- Section F - Extracurricular Activities - json_data->'form'->'section_f'->>'section_f_extracurricular_activities' AS extracurricular_satisfaction, - json_data->'form'->'section_f'->>'how_satisfied_are_you_with_the_extracurricular_activities_provided_by_the_s' AS extracurricular_satisfaction_detail, - json_data->'form'->'section_f'->>'sectionf_commentssuggestions' AS extracurricular_comments, + json_data + -> 'form' + -> 'section_f' + ->> 'section_f_extracurricular_activities' AS extracurricular_satisfaction, + json_data + -> 'form' + -> 'section_f' + ->> 'how_satisfied_are_you_with_the_extracurricular_activities_provided_by_the_s' AS extracurricular_satisfaction_detail, + json_data + -> 'form' + -> 'section_f' + ->> 'sectionf_commentssuggestions' AS extracurricular_comments, -- Section G - Teacher Engagement - json_data->'form'->'section_g'->>'section_g_teacher_engagement_beyond_normal_class_teaching' AS teacher_engagement, - json_data->'form'->'section_g'->>'how_satisfied_are_you_with_the_level_of_teacher_engagement_in_non-teaching_' AS teacher_engagement_satisfaction, - json_data->'form'->'section_g'->>'sectiong_commentssuggestions' AS teacher_engagement_comments, + json_data + -> 'form' + -> 'section_g' + ->> 'section_g_teacher_engagement_beyond_normal_class_teaching' AS teacher_engagement, + json_data + -> 'form' + -> 'section_g' + ->> 'how_satisfied_are_you_with_the_level_of_teacher_engagement_in_non-teaching_' AS teacher_engagement_satisfaction, + json_data + -> 'form' + -> 'section_g' + ->> 'sectiong_commentssuggestions' AS teacher_engagement_comments, -- Section H - Suggestions for Improvement - json_data->'form'->'section_h'->>'section_h_suggestions_for_improvement_at_the_school' AS improvement_suggestions, - json_data->'form'->'section_h'->>'if_you_could_propose_some_changes_at_the_school_what_could_those_be' AS proposed_changes, + json_data + -> 'form' + -> 'section_h' + ->> 'section_h_suggestions_for_improvement_at_the_school' AS improvement_suggestions, + json_data + -> 'form' + -> 'section_h' + ->> 'if_you_could_propose_some_changes_at_the_school_what_could_those_be' AS proposed_changes, -- Additional Details - json_data->'form'->>'background_and_purpose_in_order_to_continuously_improve_on_our_education_se' AS survey_background + json_data + -> 'form' + ->> 'background_and_purpose_in_order_to_continuously_improve_on_our_education_se' AS survey_background FROM source_data diff --git a/models/staging/education/staging_well_being_sessions.sql b/models/staging/education/staging_well_being_sessions.sql index e6a6fe8..bdef587 100644 --- a/models/staging/education/staging_well_being_sessions.sql +++ b/models/staging/education/staging_well_being_sessions.sql @@ -1,14 +1,10 @@ {{ config( materialized='table', - tags="education_well_being_sessions" + tags=["education_well_being_sessions", "education"] ) }} SELECT - "Date", - "Grade", - "Topic", - "School", - "Stream", + "Date", "Grade", "Topic", "School", "Stream", '1' AS "Number_of_stdents_trained", 'Individual' AS "Session_Type" FROM {{ source('staging_education', 'Individual_Sessions') }} diff --git a/models/staging/gender/staging_champions.sql b/models/staging/gender/staging_champions.sql index d82e4b9..ba9d485 100644 --- a/models/staging/gender/staging_champions.sql +++ b/models/staging/gender/staging_champions.sql @@ -1,6 +1,6 @@ {{ config( materialized='table', - tags="gender_gbv_leaders_and_champions" + tags=["gender_gbv_leaders_and_champions","gender"] ) }} with champions_cte as ( diff --git a/models/staging/gender/staging_gbv_leaders.sql b/models/staging/gender/staging_gbv_leaders.sql index 3052d06..5c2479b 100644 --- a/models/staging/gender/staging_gbv_leaders.sql +++ b/models/staging/gender/staging_gbv_leaders.sql @@ -1,6 +1,6 @@ {{ config( materialized='table', - tags="gender_gbv_leaders_and_champions" + tags=["gender_gbv_leaders_and_champions", "gender"] ) }} with gbv_cte as ( select diff --git a/models/staging/gender/staging_gender_case_occurrences_commcare.sql b/models/staging/gender/staging_gender_case_occurrences_commcare.sql index e55b8bd..2468bcf 100644 --- a/models/staging/gender/staging_gender_case_occurrences_commcare.sql +++ b/models/staging/gender/staging_gender_case_occurrences_commcare.sql @@ -3,7 +3,7 @@ materialized="table", unique_key="case_id", alias="staging_gender_case_occurrences_commcare", - tags= ["commcare_extraction", "gender_cases"] + tags= ["commcare_extraction", "gender_cases", "gender"] ) }} diff --git a/models/staging/gender/staging_gender_counselling_commcare.sql b/models/staging/gender/staging_gender_counselling_commcare.sql index 9c52804..11ac967 100644 --- a/models/staging/gender/staging_gender_counselling_commcare.sql +++ b/models/staging/gender/staging_gender_counselling_commcare.sql @@ -1,6 +1,8 @@ {{ config( - materialized="table", unique_key="case_id", tags=["commcare_extraction","gender_counselling"] + materialized="table", + unique_key="case_id", + tags=["commcare_extraction","gender_counselling", "gender"] ) }} diff --git a/models/staging/gender/staging_gender_final_mental_health_assesment.sql b/models/staging/gender/staging_gender_final_mental_health_assesment.sql index 21640e4..a0da418 100644 --- a/models/staging/gender/staging_gender_final_mental_health_assesment.sql +++ b/models/staging/gender/staging_gender_final_mental_health_assesment.sql @@ -1,56 +1,98 @@ {{ config( materialized='table', - tags='gender_mental_health_assesment' + tags=['gender_mental_health_assesment', "gender"] ) }} WITH mental_health_assessment_data AS ( SELECT id, - data::jsonb->'form'->'case'->>'@case_id' AS case_id, -- Extract the case ID - data::jsonb->'form'->'case'->>'@user_id' AS user_id, -- Extract the user ID - data::jsonb->'form'->>'sessions_attended' AS sessions_attended, - data::jsonb->'form'->>'concluding_comments' AS concluding_comments, - data::jsonb->'form'->>'final_assessment_by' AS final_assessment_by, - data::jsonb->'form'->>'date_of_final_assessment' AS date_of_final_assessment, - data::jsonb->'form'->>'please_provide_more_information_about_the_clients_satisfaction_score' AS client_satisfaction_score_comments, - data::jsonb->'form'->>'what_is_the_clients_level_of_satisfaction_with_the_counselling_services_pro' AS client_satisfaction_level, + -- Extract the case ID + data::jsonb -> 'form' -> 'case' ->> '@case_id' AS case_id, + -- Extract the user ID + data::jsonb -> 'form' -> 'case' ->> '@user_id' AS user_id, + data::jsonb -> 'form' ->> 'sessions_attended' AS sessions_attended, + data::jsonb -> 'form' ->> 'concluding_comments' AS concluding_comments, + data::jsonb -> 'form' ->> 'final_assessment_by' AS final_assessment_by, + data::jsonb + -> 'form' + ->> 'date_of_final_assessment' AS date_of_final_assessment, + data::jsonb + -> 'form' + ->> 'please_provide_more_information_about_the_clients_satisfaction_score' AS client_satisfaction_score_comments, + data::jsonb + -> 'form' + ->> 'what_is_the_clients_level_of_satisfaction_with_the_counselling_services_pro' AS client_satisfaction_level, -- Extract all relevant mental health scores after therapy from both 'update' and 'client_mental_health_scores' COALESCE( - data::jsonb->'form'->'update'->>'client_mental_health_score_behavioral_issues_after_therapy', - data::jsonb->'form'->'client_mental_health_scores'->>'client_mental_health_score_behavioral_issues_after_therapy' + data::jsonb + -> 'form' + -> 'update' + ->> 'client_mental_health_score_behavioral_issues_after_therapy', + data::jsonb + -> 'form' + -> 'client_mental_health_scores' + ->> 'client_mental_health_score_behavioral_issues_after_therapy' ) AS behavioral_issues_after_therapy, COALESCE( - data::jsonb->'form'->'update'->>'client_mental_health_score_drug_abuse_after_therapy', - data::jsonb->'form'->'client_mental_health_scores'->>'client_mental_health_score_drug_abuse_after_therapy' + data::jsonb + -> 'form' + -> 'update' + ->> 'client_mental_health_score_drug_abuse_after_therapy', + data::jsonb + -> 'form' + -> 'client_mental_health_scores' + ->> 'client_mental_health_score_drug_abuse_after_therapy' ) AS drug_abuse_after_therapy, COALESCE( - data::jsonb->'form'->'update'->>'client_mental_health_score_psychiatric_symptoms_after_therapy', - data::jsonb->'form'->'client_mental_health_scores'->>'client_mental_health_score_psychiatric_symptoms_after_therapy' + data::jsonb + -> 'form' + -> 'update' + ->> 'client_mental_health_score_psychiatric_symptoms_after_therapy', + data::jsonb + -> 'form' + -> 'client_mental_health_scores' + ->> 'client_mental_health_score_psychiatric_symptoms_after_therapy' ) AS psychiatric_symptoms_after_therapy, COALESCE( - data::jsonb->'form'->'update'->>'client_mental_health_score_social_emotional_issues_after_therapy', - data::jsonb->'form'->'client_mental_health_scores'->>'client_mental_health_score_social_emotional_issues_after_therapy' + data::jsonb + -> 'form' + -> 'update' + ->> 'client_mental_health_score_social_emotional_issues_after_therapy', + data::jsonb + -> 'form' + -> 'client_mental_health_scores' + ->> 'client_mental_health_score_social_emotional_issues_after_therapy' ) AS social_emotional_issues_after_therapy, COALESCE( - data::jsonb->'form'->'update'->>'client_mental_health_score_trauma_symptoms_after_therapy', - data::jsonb->'form'->'client_mental_health_scores'->>'client_mental_health_score_trauma_symptoms_after_therapy' + data::jsonb + -> 'form' + -> 'update' + ->> 'client_mental_health_score_trauma_symptoms_after_therapy', + data::jsonb + -> 'form' + -> 'client_mental_health_scores' + ->> 'client_mental_health_score_trauma_symptoms_after_therapy' ) AS trauma_symptoms_after_therapy, - data::jsonb->'meta'->>'instanceID' AS session_id, -- Extract the session ID - data::jsonb->>'received_on' AS final_form_filling_date -- Use 'received_on' for the form-filling date + -- Extract the session ID + data::jsonb -> 'meta' ->> 'instanceID' AS session_id, + -- Use 'received_on' for the form-filling date + data::jsonb ->> 'received_on' AS final_form_filling_date FROM {{ source('staging_gender', 'Final_Mental_Health_Assessment_Form') }} - WHERE data::jsonb->>'archived' IS NULL OR data::jsonb->>'archived' = 'false' + WHERE + data::jsonb ->> 'archived' IS NULL + OR data::jsonb ->> 'archived' = 'false' ) SELECT DISTINCT id, - case_id, - user_id, + case_id, + user_id, sessions_attended, concluding_comments, final_assessment_by, diff --git a/models/staging/gender/staging_gender_initial_mental_health_assesment.sql b/models/staging/gender/staging_gender_initial_mental_health_assesment.sql index 04492fe..affcbe6 100644 --- a/models/staging/gender/staging_gender_initial_mental_health_assesment.sql +++ b/models/staging/gender/staging_gender_initial_mental_health_assesment.sql @@ -1,6 +1,6 @@ {{ config( materialized='table', - tags="gender_mental_health_assesment" + tags=["gender_mental_health_assesment", "gender"] ) }} WITH initial_mental_health_assessment_staging AS ( @@ -8,28 +8,45 @@ WITH initial_mental_health_assessment_staging AS ( id, -- Extract the unique form ID -- Extract the case ID and user ID from 'case' - data::jsonb->'form'->'case'->>'@case_id' AS case_id, - data::jsonb->'form'->'case'->>'@user_id' AS user_id, + data::jsonb -> 'form' -> 'case' ->> '@case_id' AS case_id, + data::jsonb -> 'form' -> 'case' ->> '@user_id' AS user_id, -- Extract all relevant mental health scores from 'client_mental_health_scores' - data::jsonb->'form'->'client_mental_health_scores'->>'client_mental_health_score_behavioral_issues' AS behavioral_issues, - data::jsonb->'form'->'client_mental_health_scores'->>'client_mental_health_score_drug_abuse' AS drug_abuse, - data::jsonb->'form'->'client_mental_health_scores'->>'client_mental_health_score_psychiatric_symptoms' AS psychiatric_symptoms, - data::jsonb->'form'->'client_mental_health_scores'->>'client_mental_health_score_social_emotional_issues' AS social_emotional_issues, - data::jsonb->'form'->'client_mental_health_scores'->>'client_mental_health_score_trauma_symptoms' AS trauma_symptoms, + data::jsonb + -> 'form' + -> 'client_mental_health_scores' + ->> 'client_mental_health_score_behavioral_issues' AS behavioral_issues, + data::jsonb + -> 'form' + -> 'client_mental_health_scores' + ->> 'client_mental_health_score_drug_abuse' AS drug_abuse, + data::jsonb + -> 'form' + -> 'client_mental_health_scores' + ->> 'client_mental_health_score_psychiatric_symptoms' AS psychiatric_symptoms, + data::jsonb + -> 'form' + -> 'client_mental_health_scores' + ->> 'client_mental_health_score_social_emotional_issues' AS social_emotional_issues, + data::jsonb + -> 'form' + -> 'client_mental_health_scores' + ->> 'client_mental_health_score_trauma_symptoms' AS trauma_symptoms, -- Extract metadata like session ID and form filling date - data::jsonb->'form'->'meta'->>'instanceID' AS session_id, - data::jsonb->>'received_on' AS initial_form_filling_date + data::jsonb -> 'form' -> 'meta' ->> 'instanceID' AS session_id, + data::jsonb ->> 'received_on' AS initial_form_filling_date FROM {{ source('staging_gender', 'Initial_Mental_Health_Asssessment') }} - WHERE data::jsonb->>'archived' IS NULL OR data::jsonb->>'archived' = 'false' + WHERE + data::jsonb ->> 'archived' IS NULL + OR data::jsonb ->> 'archived' = 'false' ) SELECT DISTINCT id, initial_form_filling_date, - case_id, - user_id, + case_id, + user_id, -- Include all relevant mental health scores as separate columns behavioral_issues, drug_abuse, diff --git a/models/staging/gender/staging_gender_safe_house_commcare.sql b/models/staging/gender/staging_gender_safe_house_commcare.sql index a65824c..cb0248e 100644 --- a/models/staging/gender/staging_gender_safe_house_commcare.sql +++ b/models/staging/gender/staging_gender_safe_house_commcare.sql @@ -3,7 +3,7 @@ materialized="table", unique_key="case_id", alias="staging_gender_safe_house_commcare", - tags=["commcare_extraction", "gender_safe_house"] + tags=["commcare_extraction", "gender_safe_house", "gender"] ) }} diff --git a/models/staging/gender/staging_gender_survivors_commcare.sql b/models/staging/gender/staging_gender_survivors_commcare.sql index dadc7b4..a869c98 100644 --- a/models/staging/gender/staging_gender_survivors_commcare.sql +++ b/models/staging/gender/staging_gender_survivors_commcare.sql @@ -3,7 +3,7 @@ materialized="table", unique_key="case_id", alias="staging_gender_survivors_commcare", - tags= ["commcare_extraction", "gender_survivors"] + tags= ["commcare_extraction", "gender_survivors", "gender"] ) }} diff --git a/models/staging/gender/staging_life_skills_training_participant_details.sql b/models/staging/gender/staging_life_skills_training_participant_details.sql index 08dc5cb..ddba4ae 100644 --- a/models/staging/gender/staging_life_skills_training_participant_details.sql +++ b/models/staging/gender/staging_life_skills_training_participant_details.sql @@ -1,57 +1,69 @@ {{ config( - materialized='table', tags='gender_life_skills_training' + materialized='table', + tags=['gender_life_skills_training',"gender"] ) }} WITH roc_club_participants AS ( SELECT - data::jsonb->'form'->>'target_group' AS target_group, - (data::jsonb->'form'->'school_information'->>'term') AS term, -- Extract term directly from JSON - CASE - WHEN data::jsonb->'form'->'school_information'->>'year' = 'choice5' THEN '2024' - ELSE data::jsonb->'form'->'school_information'->>'year' + data::jsonb -> 'form' ->> 'target_group' AS target_group, + -- Extract term directly from JSON + (data::jsonb -> 'form' -> 'school_information' ->> 'term') AS term, + CASE + WHEN + data::jsonb -> 'form' -> 'school_information' ->> 'year' + = 'choice5' + THEN '2024' + ELSE data::jsonb -> 'form' -> 'school_information' ->> 'year' END AS year, - data::jsonb->>'received_on' AS form_filling_date, -- Use 'received_on' for the form-filling date - data::jsonb->'form'->'meta'->>'instanceID' AS session_id, -- Extract the session ID - jsonb_array_elements(data->'form'->'membership_details') AS participant_data, + -- Use 'received_on' for the form-filling date + data::jsonb ->> 'received_on' AS form_filling_date, + -- Extract the session ID + data::jsonb -> 'form' -> 'meta' ->> 'instanceID' AS session_id, + jsonb_array_elements( + data -> 'form' -> 'membership_details' + ) AS participant_data, -- Assign start and end dates for each term as timestamp CASE - WHEN (data::jsonb->'form'->'school_information'->>'term') = 'term_1' THEN to_timestamp('2024-08-31', 'YYYY-MM-DD') - WHEN (data::jsonb->'form'->'school_information'->>'term') = 'term_2' THEN to_timestamp('2024-01-01', 'YYYY-MM-DD') - WHEN (data::jsonb->'form'->'school_information'->>'term') = 'term3' THEN to_timestamp('2024-04-21', 'YYYY-MM-DD') + WHEN (data::jsonb->'form'->'school_information'->>'term') = 'term_1' THEN TO_TIMESTAMP('2024-08-31', 'YYYY-MM-DD') + WHEN (data::jsonb->'form'->'school_information'->>'term') = 'term_2' THEN TO_TIMESTAMP('2024-01-01', 'YYYY-MM-DD') + WHEN (data::jsonb->'form'->'school_information'->>'term') = 'term3' THEN TO_TIMESTAMP('2024-04-21', 'YYYY-MM-DD') ELSE NULL::timestamp END AS term_start_date, - + CASE - WHEN (data::jsonb->'form'->'school_information'->>'term') = 'term_1' THEN to_timestamp('2024-12-31', 'YYYY-MM-DD') - WHEN (data::jsonb->'form'->'school_information'->>'term') = 'term_2' THEN to_timestamp('2024-04-20', 'YYYY-MM-DD') - WHEN (data::jsonb->'form'->'school_information'->>'term') = 'term3' THEN to_timestamp('2024-08-31', 'YYYY-MM-DD') + WHEN (data::jsonb->'form'->'school_information'->>'term') = 'term_1' THEN TO_TIMESTAMP('2024-12-31', 'YYYY-MM-DD') + WHEN (data::jsonb->'form'->'school_information'->>'term') = 'term_2' THEN TO_TIMESTAMP('2024-04-20', 'YYYY-MM-DD') + WHEN (data::jsonb->'form'->'school_information'->>'term') = 'term3' THEN TO_TIMESTAMP('2024-08-31', 'YYYY-MM-DD') ELSE NULL::timestamp END AS term_end_date FROM {{ source('staging_gender', 'IIVC_Life_Skills_Training') }} - WHERE - data::jsonb->'form'->>'target_group' = 'roc_club' - AND jsonb_typeof(data->'form'->'membership_details') = 'array' -- Ensure it's an array - AND (data::jsonb->>'archived' IS NULL OR data::jsonb->>'archived' = 'false') + WHERE data::jsonb->'form'->>'target_group' = 'roc_club' + AND jsonb_typeof(data->'form'->'membership_details') = 'array' -- Ensure it's an array + AND (data::jsonb->>'archived' IS NULL OR data::jsonb->>'archived' = 'false') ), community_safe_space_participants AS ( SELECT - data::jsonb->'form'->>'target_group' AS target_group, - 'Unknown' AS term, -- Set term as 'Unknown' for community safe space - 'Unknown' AS year, -- Set year as 'Unknown' for community safe space - data::jsonb->>'received_on' AS form_filling_date, -- Use 'received_on' for the form-filling date - data::jsonb->'form'->'meta'->>'instanceID' AS session_id, -- Extract the session ID - jsonb_array_elements(data->'form'->'community_safe_space_participants_details') AS participant_data, + 'Unknown' AS term, + 'Unknown' AS year, -- Set term as 'Unknown' for community safe space + -- Set year as 'Unknown' for community safe space + NULL::timestamp AS term_start_date, + -- Use 'received_on' for the form-filling date + NULL::timestamp AS term_end_date, + -- Extract the session ID + data::jsonb -> 'form' ->> 'target_group' AS target_group, + data::jsonb ->> 'received_on' AS form_filling_date, -- Use NULL for timestamp fields to maintain consistency with ROC Club - NULL::timestamp AS term_start_date, - NULL::timestamp AS term_end_date + data::jsonb -> 'form' -> 'meta' ->> 'instanceID' AS session_id, + jsonb_array_elements( + data -> 'form' -> 'community_safe_space_participants_details' + ) AS participant_data FROM {{ source('staging_gender', 'IIVC_Life_Skills_Training') }} - WHERE - data::jsonb->'form'->>'target_group' = 'community_safe_space' - AND jsonb_typeof(data->'form'->'community_safe_space_participants_details') = 'array' -- Ensure it's an array - AND (data::jsonb->>'archived' IS NULL OR data::jsonb->>'archived' = 'false') + WHERE data::jsonb->'form'->>'target_group' = 'community_safe_space' + AND jsonb_typeof(data->'form'->'community_safe_space_participants_details') = 'array' -- Ensure it's an array + AND (data::jsonb->>'archived' IS NULL OR data::jsonb->>'archived' = 'false') ) -- Combine the participants from both roc_club and community_safe_space @@ -63,8 +75,10 @@ SELECT DISTINCT term_end_date, -- End date based on the term or NULL form_filling_date, -- The form's actual submission date session_id, -- Include the session ID - participant_data->>'member_full_names_first_middle_surname' AS participant_name, -- For ROC Club - participant_data->>'member_gender' AS gender -- For ROC Club + -- For ROC Club + participant_data + ->> 'member_full_names_first_middle_surname' AS participant_name, + participant_data ->> 'member_gender' AS gender -- For ROC Club FROM roc_club_participants UNION ALL @@ -77,6 +91,7 @@ SELECT DISTINCT term_end_date, -- NULL for community safe space form_filling_date, -- The form's actual submission date session_id, -- Include the session ID - participant_data->>'full_name_first_middle_surname' AS participant_name, -- For Community Safe Space - participant_data->>'gender' AS gender -- For Community Safe Space + -- For Community Safe Space + participant_data ->> 'full_name_first_middle_surname' AS participant_name, + participant_data ->> 'gender' AS gender -- For Community Safe Space FROM community_safe_space_participants diff --git a/models/staging/gender/staging_life_skills_training_session_details.sql b/models/staging/gender/staging_life_skills_training_session_details.sql index c8d458f..3f5f903 100644 --- a/models/staging/gender/staging_life_skills_training_session_details.sql +++ b/models/staging/gender/staging_life_skills_training_session_details.sql @@ -1,5 +1,6 @@ {{ config( - materialized='table', tags='gender_life_skills_training' + materialized='table', + tags=['gender_life_skills_training', "gender"] ) }} WITH source_data AS ( @@ -8,37 +9,60 @@ WITH source_data AS ( indexed_on, data::jsonb AS json_data FROM {{ source('staging_gender', 'IIVC_Life_Skills_Training') }} - WHERE data::jsonb->>'archived' IS NULL OR data::jsonb->>'archived' = 'false' + WHERE + data::jsonb ->> 'archived' IS NULL + OR data::jsonb ->> 'archived' = 'false' ) SELECT DISTINCT id, indexed_on, - json_data->'form'->>'@name' AS form_name, - json_data->'form'->>'comments' AS comments, - json_data->'form'->>'target_group' AS target_group, - json_data->'form'->'meta'->>'userID' AS user_id, - json_data->'form'->'meta'->>'username' AS username, - + json_data -> 'form' ->> '@name' AS form_name, + json_data -> 'form' ->> 'comments' AS comments, + json_data -> 'form' ->> 'target_group' AS target_group, + json_data -> 'form' -> 'meta' ->> 'userID' AS user_id, + json_data -> 'form' -> 'meta' ->> 'username' AS username, + -- Community Information - json_data->'form'->'community_information'->>'name_of_village' AS village_name, - json_data->'form'->'community_information'->>'name_of_the_community_safe_space' AS community_safe_space_name, - json_data->'form'->'community_information'->>'number_of_girls_in_the_community_safe_space' AS num_girls_in_safe_space, + json_data + -> 'form' + -> 'community_information' + ->> 'name_of_village' AS village_name, + json_data + -> 'form' + -> 'community_information' + ->> 'name_of_the_community_safe_space' AS community_safe_space_name, + json_data + -> 'form' + -> 'community_information' + ->> 'number_of_girls_in_the_community_safe_space' AS num_girls_in_safe_space, -- Geographical Information - json_data->'form'->'geographical_location'->>'county' AS county, - json_data->'form'->'geographical_location'->>'ward' AS ward, - json_data->'form'->'geographical_location'->>'constituency' AS constituency, + json_data -> 'form' -> 'geographical_location' ->> 'county' AS county, + json_data -> 'form' -> 'geographical_location' ->> 'ward' AS ward, + json_data + -> 'form' + -> 'geographical_location' + ->> 'constituency' AS constituency, -- School Information - json_data->'form'->'school_information'->>'term' AS school_term, - json_data->'form'->'school_information'->>'year' AS school_year, - json_data->'form'->'school_information'->>'school_name' AS school_name, - json_data->'form'->'school_information'->>'type_of_school' AS type_of_school, - json_data->'form'->'school_information'->>'number_of_club_membership' AS num_club_members, + json_data -> 'form' -> 'school_information' ->> 'term' AS school_term, + json_data -> 'form' -> 'school_information' ->> 'year' AS school_year, + json_data + -> 'form' + -> 'school_information' + ->> 'school_name' AS school_name, + json_data + -> 'form' + -> 'school_information' + ->> 'type_of_school' AS type_of_school, + json_data + -> 'form' + -> 'school_information' + ->> 'number_of_club_membership' AS num_club_members, -- Other relevant details - json_data->'form'->'life_skills_form' AS life_skills_form_status, - json_data->'form'->'club_patron_mobile_number' AS patron_mobile_number + json_data -> 'form' -> 'life_skills_form' AS life_skills_form_status, + json_data -> 'form' -> 'club_patron_mobile_number' AS patron_mobile_number FROM source_data diff --git a/models/staging/gender/staging_youth_beneficiaries.sql b/models/staging/gender/staging_youth_beneficiaries.sql index 64f0903..b1f9b87 100644 --- a/models/staging/gender/staging_youth_beneficiaries.sql +++ b/models/staging/gender/staging_youth_beneficiaries.sql @@ -1,49 +1,75 @@ {{ config( - materialized='table', tags='gender_youth_beneficiaries' + materialized='table', + tags=['gender_youth_beneficiaries', "gender"] ) }} WITH initial_cases AS ( SELECT - data::json->>'case_id' AS case_id, - data::json->'properties'->>'ward' AS ward, - data::json->'properties'->>'county' AS county, - data::json->'properties'->>'constituency' AS constituency, - data::json->'properties'->>'date_of_registration' AS date_of_registration, - data::json->'properties'->>'beneficiary_gender' AS beneficiary_gender, - data::json->'properties'->>'name_of_the_beneficiary' AS name_of_the_beneficiary, - data::json->'properties'->>'beneficiary_phone_number' AS beneficiary_phone_number, - data::json->'properties'->>'registered_by' AS registered_by, - data::json->'properties'->>'beneficiary_categories' AS beneficiary_categories, - data::json->'properties'->>'case_name' AS case_name, - data::json->'properties'->>'date_opened' AS date_opened, - NULL AS training_type, -- Placeholder for training_type, specific to subsequent cases + data::json ->> 'case_id' AS case_id, + data::json -> 'properties' ->> 'ward' AS ward, + data::json -> 'properties' ->> 'county' AS county, + data::json -> 'properties' ->> 'constituency' AS constituency, + data::json + -> 'properties' + ->> 'date_of_registration' AS date_of_registration, + data::json + -> 'properties' + ->> 'beneficiary_gender' AS beneficiary_gender, + data::json + -> 'properties' + ->> 'name_of_the_beneficiary' AS name_of_the_beneficiary, + data::json + -> 'properties' + ->> 'beneficiary_phone_number' AS beneficiary_phone_number, + data::json -> 'properties' ->> 'registered_by' AS registered_by, + data::json + -> 'properties' + ->> 'beneficiary_categories' AS beneficiary_categories, + data::json -> 'properties' ->> 'case_name' AS case_name, + data::json -> 'properties' ->> 'date_opened' AS date_opened, + -- Placeholder for training_type, specific to subsequent cases + NULL AS training_type, indexed_on, - NULL AS parent_case_id -- Placeholder for parent_case_id, specific to subsequent cases + -- Placeholder for parent_case_id, specific to subsequent cases + NULL AS parent_case_id FROM {{ source('staging_youth', 'zzz_case') }} - WHERE - data::json->'indices'->>'parent' IS NULL - AND (data::jsonb->>'archived' IS NULL OR data::jsonb->>'archived' = 'false') + WHERE data::json->'indices'->>'parent' IS NULL + AND (data::jsonb->>'archived' IS NULL OR data::jsonb->>'archived' = 'false') ), subsequent_cases AS ( SELECT - data::json->>'case_id' AS case_id, - data::json->'properties'->>'ward' AS ward, - data::json->'properties'->>'county' AS county, - data::json->'properties'->>'constituency' AS constituency, - data::json->'properties'->>'date_of_registration' AS date_of_registration, - data::json->'properties'->>'beneficiary_gender' AS beneficiary_gender, - data::json->'properties'->>'name_of_the_beneficiary' AS name_of_the_beneficiary, - data::json->'properties'->>'beneficiary_phone_number' AS beneficiary_phone_number, - data::json->'properties'->>'registered_by' AS registered_by, - data::json->'properties'->>'beneficiary_categories' AS beneficiary_categories, - data::json->'properties'->>'case_name' AS case_name, - data::json->'properties'->>'date_opened' AS date_opened, - data::json->'properties'->>'mental_health_training_session_type' AS training_type, -- Training type from subsequent cases + data::json ->> 'case_id' AS case_id, + data::json -> 'properties' ->> 'ward' AS ward, + data::json -> 'properties' ->> 'county' AS county, + data::json -> 'properties' ->> 'constituency' AS constituency, + data::json + -> 'properties' + ->> 'date_of_registration' AS date_of_registration, + data::json + -> 'properties' + ->> 'beneficiary_gender' AS beneficiary_gender, + data::json + -> 'properties' + ->> 'name_of_the_beneficiary' AS name_of_the_beneficiary, + data::json + -> 'properties' + ->> 'beneficiary_phone_number' AS beneficiary_phone_number, + data::json -> 'properties' ->> 'registered_by' AS registered_by, + data::json + -> 'properties' + ->> 'beneficiary_categories' AS beneficiary_categories, + data::json -> 'properties' ->> 'case_name' AS case_name, + data::json -> 'properties' ->> 'date_opened' AS date_opened, + -- Training type from subsequent cases + data::json + -> 'properties' + ->> 'mental_health_training_session_type' AS training_type, indexed_on, - data::json->'indices'->'parent'->>'case_id' AS parent_case_id -- Parent case ID for subsequent cases + -- Parent case ID for subsequent cases + data::json -> 'indices' -> 'parent' ->> 'case_id' AS parent_case_id FROM {{ source('staging_youth', 'zzz_case') }} - WHERE data::json->'indices'->>'parent' IS NOT NULL + WHERE data::json -> 'indices' ->> 'parent' IS NOT NULL ) SELECT * FROM initial_cases diff --git a/models/staging/gender/survivors_data.sql b/models/staging/gender/survivors_data.sql index 147c257..7c442ee 100644 --- a/models/staging/gender/survivors_data.sql +++ b/models/staging/gender/survivors_data.sql @@ -1,5 +1,6 @@ {{ config( - materialized='table', tags='gender_survivors' + materialized='table', + tags=['gender_survivors', "gender"] ) }} with diff --git a/models/staging/org_wide/staging_county_footprint.sql b/models/staging/org_wide/staging_county_footprint.sql index 1e94766..152fbff 100644 --- a/models/staging/org_wide/staging_county_footprint.sql +++ b/models/staging/org_wide/staging_county_footprint.sql @@ -1,6 +1,6 @@ {{ config( materialized='table', - tags="org_mapping" + tags=["org_mapping", "org_wide"] ) }} SELECT diff --git a/models/staging/org_wide/staging_mapping.sql b/models/staging/org_wide/staging_mapping.sql index 38fb0d6..4e0e949 100644 --- a/models/staging/org_wide/staging_mapping.sql +++ b/models/staging/org_wide/staging_mapping.sql @@ -1,33 +1,35 @@ {{ config( materialized='table', - tags="org_mapping" + tags=["org_mapping", "org_wide"] ) }} WITH combined_case_data AS ( SELECT - id, - data::jsonb->'form'->'case'->'@case_id' AS case_id, - data::jsonb->'form'->'case'->'create'->>'case_type' AS case_type, -- Extract the case type - data::jsonb->'form'->>'comments' AS comments, - data::jsonb->'form'->>'facility' AS facility, - data::jsonb->'form'->'school_information'->>'school_name' AS school_name, - data::jsonb->'form'->'school_information'->>'wash_program' AS wash_program, - data::jsonb->'form'->'school_information'->>'gender_program' AS gender_program, - data::jsonb->'form'->'school_information'->>'gender_intervention' AS gender_intervention, - data::jsonb->'form'->'school_information'->>'education_intervention' AS education_intervention, - data::jsonb->'form'->'school_information'->>'which_wash_interventions_are_in_the_school' AS wash_intervention, - data::jsonb->'form'->'school_information'->>'type_of_school' AS type_of_school, - data::jsonb->'form'->'school_information'->>'does_the_school_have_shofco_education_program' AS shofco_education_program, - data::jsonb->'form'->'geographical_location'->>'ward' AS ward, - data::jsonb->'form'->'geographical_location'->>'county' AS county, - data::jsonb->'form'->'geographical_location'->>'constituency' AS constituency, - data::jsonb->'form'->'geographical_location'->>'name_of_the_interviewer' AS interviewer_name, - data::jsonb->'form'->>'gps_location_of_the_facility' AS gps_location, - data::jsonb->'form'->>'officegender_desk_locationname' AS office_gender_desk_location, - data::jsonb->>'received_on' AS received_on, - data::jsonb->>'type' AS data_type + "id", + data::jsonb->'form'->'case'->'@case_id' AS "case_id", + data::jsonb->'form'->'case'->'create'->>'case_type' AS "case_type", -- Extract the case type + data::jsonb->'form'->>'comments' AS "comments", + data::jsonb->'form'->>'facility' AS "facility", + data::jsonb->'form'->'school_information'->>'school_name' AS "school_name", + data::jsonb->'form'->'school_information'->>'wash_program' AS "wash_program", + data::jsonb->'form'->'school_information'->>'gender_program' AS "gender_program", + data::jsonb->'form'->'school_information'->>'gender_intervention' AS "gender_intervention", + data::jsonb->'form'->'school_information'->>'education_intervention' AS "education_intervention", + data::jsonb->'form'->'school_information'->>'which_wash_interventions_are_in_the_school' AS "wash_intervention", + data::jsonb->'form'->'school_information'->>'type_of_school' AS "type_of_school", + data::jsonb->'form'->'school_information'->>'does_the_school_have_shofco_education_program' AS "shofco_education_program", + data::jsonb->'form'->'geographical_location'->>'ward' AS "ward", + data::jsonb->'form'->'geographical_location'->>'county' AS "county", + data::jsonb->'form'->'geographical_location'->>'constituency' AS "constituency", + data::jsonb->'form'->'geographical_location'->>'name_of_the_interviewer' AS "interviewer_name", + data::jsonb->'form'->>'gps_location_of_the_facility' AS "gps_location", + data::jsonb->'form'->>'officegender_desk_locationname' AS "office_gender_desk_location", + data::jsonb->>'received_on' AS "received_on", + data::jsonb->>'type' AS "data_type" FROM {{ source('staging_gender', 'IIVC_Mapping') }} - WHERE data::jsonb->>'archived' IS NULL OR data::jsonb->>'archived' = 'false' + WHERE + data::jsonb ->> 'archived' IS NULL + OR data::jsonb ->> 'archived' = 'false' ) SELECT @@ -52,4 +54,4 @@ SELECT office_gender_desk_location, received_on, data_type -FROM combined_case_data +FROM combined_case_data \ No newline at end of file diff --git a/models/staging/wash/staging_facilities.sql b/models/staging/wash/staging_facilities.sql index 7a729de..ead3b6a 100644 --- a/models/staging/wash/staging_facilities.sql +++ b/models/staging/wash/staging_facilities.sql @@ -3,7 +3,7 @@ materialized="table", unique_key="case_id", alias="staging_facilities", - tags= ["commcare_extraction", "wash_facilities"] + tags= ["commcare_extraction", "wash_facilities", "wash"] ) }} diff --git a/models/staging/wash/staging_health_indicators.sql b/models/staging/wash/staging_health_indicators.sql index 07c2442..59a291c 100644 --- a/models/staging/wash/staging_health_indicators.sql +++ b/models/staging/wash/staging_health_indicators.sql @@ -1,55 +1,54 @@ {{ config( materialized='table', - tags="wash_health_indicators" + tags=["wash_health_indicators", "wash"] ) }} -SELECT - -- Basic metadata - data->>'id' AS id, - data->'form'->>'date' AS form_date, - -- Extract term from form_date - CASE - WHEN data->'form'->>'date' ~ '^\d{4}-\d{2}-\d{2}$' - THEN + SELECT + -- Basic metadata + "data"->>'id' AS "id", + "data"->'form'->>'date' AS "form_date", + -- Extract term from form_date + CASE + WHEN "data"->'form'->>'date' ~ '^\d{4}-\d{2}-\d{2}$' THEN CASE - WHEN EXTRACT(MONTH FROM TO_DATE(data->'form'->>'date', 'YYYY-MM-DD')) BETWEEN 1 AND 3 THEN 'Term 1' - WHEN EXTRACT(MONTH FROM TO_DATE(data->'form'->>'date', 'YYYY-MM-DD')) BETWEEN 4 AND 7 THEN 'Term 2' - WHEN EXTRACT(MONTH FROM TO_DATE(data->'form'->>'date', 'YYYY-MM-DD')) BETWEEN 8 AND 12 THEN 'Term 3' + WHEN EXTRACT(MONTH FROM TO_DATE("data"->'form'->>'date', 'YYYY-MM-DD')) BETWEEN 1 AND 3 THEN 'Term 1' + WHEN EXTRACT(MONTH FROM TO_DATE("data"->'form'->>'date', 'YYYY-MM-DD')) BETWEEN 4 AND 7 THEN 'Term 2' + WHEN EXTRACT(MONTH FROM TO_DATE("data"->'form'->>'date', 'YYYY-MM-DD')) BETWEEN 8 AND 12 THEN 'Term 3' END - END AS term, - data->'form'->>'school_name' AS school_name, - data->'form'->'school_population'->>'number_of_health_club_members_boys' AS health_club_boys, - data->'form'->'school_population'->>'number_of_health_club_members_girls' AS health_club_girls, + ELSE NULL + END AS "term", + "data"->'form'->>'school_name' AS "school_name", + "data"->'form'->'school_population'->>'number_of_health_club_members_boys' AS "health_club_boys", + "data"->'form'->'school_population'->>'number_of_health_club_members_girls' AS "health_club_girls", - -- Health club status - CASE - WHEN data->'form'->'monitoring_indicator_2'->>'an_active_and_representative_health_club_established_check_the_record_of_th' = 'yes' - THEN 1 - ELSE 0 - END AS health_club_active, + -- Health club status + CASE + WHEN "data"->'form'->'monitoring_indicator_2'->>'an_active_and_representative_health_club_established_check_the_record_of_th' = 'yes' + THEN 1 ELSE 0 + END AS "health_club_active", - ( - CASE WHEN data->'form'->'monitoring_indicator_1'->>'weekly_health_club_meetings_conducted_check_the_club_register_and_minutes_o' = 'yes' THEN 1 ELSE 0 END - + CASE WHEN data->'form'->'monitoring_indicator_2'->>'an_active_and_representative_health_club_established_check_the_record_of_th' = 'yes' THEN 1 ELSE 0 END - + CASE WHEN data->'form'->'monitoring_indicator_3'->>'the_health_club_members_have_been_taken_through_water_sanitation_and_hygien' = 'yes' THEN 1 ELSE 0 END - + CASE WHEN data->'form'->'monitoring_indicator_4'->>'observe_the_cleanliness_of_pupilsstudents_check_the_school_uniformsphysical' = 'yes' THEN 1 ELSE 0 END - + CASE WHEN data->'form'->'monitoring_indicator_5'->>'observe_if_the_school_has_a_water_storage_reservoir_check_the_capacity_and_' = 'yes' THEN 1 ELSE 0 END - + CASE WHEN data->'form'->'monitoring_indicator_6'->>'all_pupils_drink_safe_water_observe_the_source_of_drinking_water_and_inquir' = 'yes' THEN 1 ELSE 0 END - + CASE WHEN data->'form'->'monitoring_indicator_7'->>'structural_aspect_of_the_toilet' = 'yes' THEN 1 ELSE 0 END - + CASE WHEN data->'form'->'monitoring_indicator_8'->>'toiletslatrines_are_used_and_maintained_well_observation_of_the_cleanliness' = 'yes' THEN 1 ELSE 0 END - + CASE WHEN data->'form'->'monitoring_indicator_9'->>'observe_the_sanitation_ratio_student-toilet_ration_as_per_the_public_health' = 'yes' THEN 1 ELSE 0 END - + CASE WHEN data->'form'->'monitoring_indicator_10'->>'cleaning_roster_confirm_if_it_is_daily' = 'yes' THEN 1 ELSE 0 END - + CASE WHEN data->'form'->'monitoring_indicator_11'->>'school_environment_is_kept_clean_observe_the_cleanliness_of_the_classrooms_' = 'yes' THEN 1 ELSE 0 END - + CASE WHEN data->'form'->'monitoring_indicator_12'->>'school_classroom_is_kept_clean_observe_the_cleanliness_of_the_classrooms_an' = 'yes' THEN 1 ELSE 0 END - + CASE WHEN data->'form'->'monitoring_indicator_13'->>'refuse_well_managed_and_refuse_pit_kept_clean_ask_if_the_refuse_is_managed_' = 'yes' THEN 1 ELSE 0 END - + CASE WHEN data->'form'->'monitoring_indicator_14'->>'food_is_prepared_hygienically_observe_the_hygiene_of_the_food_preparation_a' = 'yes' THEN 1 ELSE 0 END - + CASE WHEN data->'form'->'monitoring_indicator_15'->>'observe_food_containers_discourage_serving_food_in_plastics' = 'yes' THEN 1 ELSE 0 END - + CASE WHEN data->'form'->'monitoring_indicator_16'->>'observe_if_the_school_has_functional_and_adequate_hand-washing_facilities_c' = 'yes' THEN 1 ELSE 0 END - + CASE WHEN data->'form'->'monitoring_indicator_17'->>'observe_handwashing_practice_with_running_water_and_soap_observe_children_d' = 'yes' THEN 1 ELSE 0 END - + CASE WHEN data->'form'->'monitoring_indicator_18'->>'interview_a_few_pupils_if_they_receive_sanitary_towels_sample_pupils_from_d' = 'yes' THEN 1 ELSE 0 END - + CASE WHEN data->'form'->'monitoring_indicator_19'->>'observe_how_used_sanitary_towels_are_disposed_accordingly_check_the_availab' = 'yes' THEN 1 ELSE 0 END - + CASE WHEN data->'form'->'monitoring_indicator_20'->>'inquire_from_the_club_members_if_they_take_lead_in_planning_for_hygiene_pro' = 'yes' THEN 1 ELSE 0 END - + CASE WHEN data->'form'->'monitoring_indicator_21'->>'observe_whether_the_soaps_are_strategically_placed_at_the_hand_washing_stat' = 'yes' THEN 1 ELSE 0 END - + CASE WHEN data->'form'->'monitoring_indicator_22'->>'observe_if_the_school_has_water_for_hand_washing_check_the_presence_of_wate' = 'yes' THEN 1 ELSE 0 END - ) AS hygiene_score -FROM {{ source('staging_wash', 'SCHOOL_HEALTH_CLUB_MONITORING_INDICATORS') }} + ( + CASE WHEN "data"->'form'->'monitoring_indicator_1'->>'weekly_health_club_meetings_conducted_check_the_club_register_and_minutes_o' = 'yes' THEN 1 ELSE 0 END + + CASE WHEN "data"->'form'->'monitoring_indicator_2'->>'an_active_and_representative_health_club_established_check_the_record_of_th' = 'yes' THEN 1 ELSE 0 END + + CASE WHEN "data"->'form'->'monitoring_indicator_3'->>'the_health_club_members_have_been_taken_through_water_sanitation_and_hygien' = 'yes' THEN 1 ELSE 0 END + + CASE WHEN "data"->'form'->'monitoring_indicator_4'->>'observe_the_cleanliness_of_pupilsstudents_check_the_school_uniformsphysical' = 'yes' THEN 1 ELSE 0 END + + CASE WHEN "data"->'form'->'monitoring_indicator_5'->>'observe_if_the_school_has_a_water_storage_reservoir_check_the_capacity_and_' = 'yes' THEN 1 ELSE 0 END + + CASE WHEN "data"->'form'->'monitoring_indicator_6'->>'all_pupils_drink_safe_water_observe_the_source_of_drinking_water_and_inquir' = 'yes' THEN 1 ELSE 0 END + + CASE WHEN "data"->'form'->'monitoring_indicator_7'->>'structural_aspect_of_the_toilet' = 'yes' THEN 1 ELSE 0 END + + CASE WHEN "data"->'form'->'monitoring_indicator_8'->>'toiletslatrines_are_used_and_maintained_well_observation_of_the_cleanliness' = 'yes' THEN 1 ELSE 0 END + + CASE WHEN "data"->'form'->'monitoring_indicator_9'->>'observe_the_sanitation_ratio_student-toilet_ration_as_per_the_public_health' = 'yes' THEN 1 ELSE 0 END + + CASE WHEN "data"->'form'->'monitoring_indicator_10'->>'cleaning_roster_confirm_if_it_is_daily' = 'yes' THEN 1 ELSE 0 END + + CASE WHEN "data"->'form'->'monitoring_indicator_11'->>'school_environment_is_kept_clean_observe_the_cleanliness_of_the_classrooms_' = 'yes' THEN 1 ELSE 0 END + + CASE WHEN "data"->'form'->'monitoring_indicator_12'->>'school_classroom_is_kept_clean_observe_the_cleanliness_of_the_classrooms_an' = 'yes' THEN 1 ELSE 0 END + + CASE WHEN "data"->'form'->'monitoring_indicator_13'->>'refuse_well_managed_and_refuse_pit_kept_clean_ask_if_the_refuse_is_managed_' = 'yes' THEN 1 ELSE 0 END + + CASE WHEN "data"->'form'->'monitoring_indicator_14'->>'food_is_prepared_hygienically_observe_the_hygiene_of_the_food_preparation_a' = 'yes' THEN 1 ELSE 0 END + + CASE WHEN "data"->'form'->'monitoring_indicator_15'->>'observe_food_containers_discourage_serving_food_in_plastics' = 'yes' THEN 1 ELSE 0 END + + CASE WHEN "data"->'form'->'monitoring_indicator_16'->>'observe_if_the_school_has_functional_and_adequate_hand-washing_facilities_c' = 'yes' THEN 1 ELSE 0 END + + CASE WHEN "data"->'form'->'monitoring_indicator_17'->>'observe_handwashing_practice_with_running_water_and_soap_observe_children_d' = 'yes' THEN 1 ELSE 0 END + + CASE WHEN "data"->'form'->'monitoring_indicator_18'->>'interview_a_few_pupils_if_they_receive_sanitary_towels_sample_pupils_from_d' = 'yes' THEN 1 ELSE 0 END + + CASE WHEN "data"->'form'->'monitoring_indicator_19'->>'observe_how_used_sanitary_towels_are_disposed_accordingly_check_the_availab' = 'yes' THEN 1 ELSE 0 END + + CASE WHEN "data"->'form'->'monitoring_indicator_20'->>'inquire_from_the_club_members_if_they_take_lead_in_planning_for_hygiene_pro' = 'yes' THEN 1 ELSE 0 END + + CASE WHEN "data"->'form'->'monitoring_indicator_21'->>'observe_whether_the_soaps_are_strategically_placed_at_the_hand_washing_stat' = 'yes' THEN 1 ELSE 0 END + + CASE WHEN "data"->'form'->'monitoring_indicator_22'->>'observe_if_the_school_has_water_for_hand_washing_check_the_presence_of_wate' = 'yes' THEN 1 ELSE 0 END + ) AS "hygiene_score" + FROM {{ source('staging_wash', 'SCHOOL_HEALTH_CLUB_MONITORING_INDICATORS') }} diff --git a/models/staging/wash/staging_meter_readings_mobiwater.sql b/models/staging/wash/staging_meter_readings_mobiwater.sql index b8a424e..effe203 100644 --- a/models/staging/wash/staging_meter_readings_mobiwater.sql +++ b/models/staging/wash/staging_meter_readings_mobiwater.sql @@ -1,6 +1,6 @@ {{ config( materialized='table', - tags='wash_mobiwater' + tags=['wash_mobiwater', "wash"] ) }} SELECT DISTINCT diff --git a/models/staging/wash/staging_user_meters_mobiwater.sql b/models/staging/wash/staging_user_meters_mobiwater.sql index 644c955..0ae4318 100644 --- a/models/staging/wash/staging_user_meters_mobiwater.sql +++ b/models/staging/wash/staging_user_meters_mobiwater.sql @@ -1,6 +1,6 @@ {{ config( materialized='table', - tags='wash_mobiwater' + tags=['wash_mobiwater', "wash"] ) }} diff --git a/models/staging/wash/staging_water_production.sql b/models/staging/wash/staging_water_production.sql index cb1435d..536ff06 100644 --- a/models/staging/wash/staging_water_production.sql +++ b/models/staging/wash/staging_water_production.sql @@ -1,76 +1,71 @@ {{ config( materialized='table', - tags="wash_water_production" + tags=["wash_water_production", "wash"] ) }} -WITH lindi_cte AS +WITH lindi_cte as ( - SELECT - "DATE" AS date, - "Status" AS status, - "BH_Abstraction" AS bh_production, - "TREATED_Production" AS treated_consumption, - 'Lindi' AS tank - FROM {{ source('staging_wash', 'Lindi') }} - WHERE - CAST("BH_Abstraction" AS NUMERIC) >= 0 - AND "BH_METER" IS NOT NULL AND CAST("TREATED_Production" AS NUMERIC) >= 0 + SELECT + "DATE" as "date", + "Status" as "status", + "BH_Abstraction" as "bh_production", + "TREATED_Production" as "treated_consumption", + 'Lindi' as "tank" + FROM {{ source('staging_wash', 'Lindi') }} + WHERE CAST("BH_Abstraction" AS NUMERIC) >= 0 + AND "BH_METER" IS NOT NULL AND CAST("TREATED_Production" AS NUMERIC) >= 0 ), -laini_saba_cte AS +laini_saba_cte as ( - SELECT - "DATE" AS date, - "Status" AS status, - "BH_Abstraction" AS bh_production, - "TREATED_Production" AS treated_consumption, - 'Laini Saba' AS tank - FROM {{ source('staging_wash', 'Laini_Saba') }} - WHERE - CAST("BH_Abstraction" AS NUMERIC) >= 0 - AND "BH_METER" IS NOT NULL AND CAST("TREATED_Production" AS NUMERIC) >= 0 + SELECT + "DATE" as "date", + "Status" as "status", + "BH_Abstraction" as "bh_production", + "TREATED_Production" as "treated_consumption", + 'Laini Saba' as "tank" + FROM {{ source('staging_wash', 'Laini_Saba') }} + WHERE CAST("BH_Abstraction" AS NUMERIC) >= 0 + AND "BH_METER" IS NOT NULL AND CAST("TREATED_Production" AS NUMERIC) >= 0 ), -hq_cte AS +hq_cte as ( - SELECT - "DATE" AS date, - "Status" AS status, - "BH_Abstraction" AS bh_production, - "TREATED_PRODUCTION" AS treated_consumption, - 'HQ' AS tank - FROM {{ source('staging_wash', 'HQ') }} - WHERE - CAST("BH_Abstraction" AS NUMERIC) >= 0 - AND "BH_METER" IS NOT NULL AND CAST("TREATED_PRODUCTION" AS NUMERIC) >= 0 + SELECT + "DATE" as "date", + "Status" as "status", + "BH_Abstraction" as "bh_production", + "TREATED_PRODUCTION" as "treated_consumption", + 'HQ' as "tank" + FROM {{ source('staging_wash', 'HQ') }} + WHERE CAST("BH_Abstraction" AS NUMERIC) >= 0 + AND "BH_METER" IS NOT NULL AND CAST("TREATED_PRODUCTION" AS NUMERIC) >= 0 ), -makina_cte AS +makina_cte as ( - SELECT - "DATE" AS date, - "Status" AS status, - "BH_Abstraction" AS bh_production, - "TREATEDProduction" AS treated_consumption, - 'Makina' AS tank - FROM {{ source('staging_wash', 'Makina') }} - WHERE - CAST("BH_Abstraction" AS NUMERIC) >= 0 - AND "BH_METER" IS NOT NULL AND CAST("TREATEDProduction" AS NUMERIC) >= 0 + SELECT + "DATE" as "date", + "Status" as "status", + "BH_Abstraction" as "bh_production", + "TREATEDProduction" as "treated_consumption", + 'Makina' as "tank" + FROM {{ source('staging_wash', 'Makina') }} + WHERE CAST("BH_Abstraction" AS NUMERIC) >= 0 + AND "BH_METER" IS NOT NULL AND CAST("TREATEDProduction" AS NUMERIC) >= 0 ), -subra_cte AS +subra_cte as ( - SELECT - "DATE" AS date, - "Status" AS status, - CAST((CAST("B2_Abstraction" AS NUMERIC) + CAST("BH1_Abstraction" AS NUMERIC)) AS VARCHAR) AS bh_production, - "TREATED_Production" AS treated_consumption, - 'Subra' AS tank - FROM {{ source('staging_wash', 'Subra') }} - WHERE - CAST("B2_Abstraction" AS NUMERIC) + CAST("BH1_Abstraction" AS NUMERIC) >= 0 - AND "BH_1_METER" IS NOT NULL AND CAST("TREATED_Production" AS NUMERIC) >= 0 + SELECT + "DATE" as "date", + "Status" as "status", + CAST((CAST("B2_Abstraction" AS NUMERIC) + CAST("BH1_Abstraction" AS NUMERIC)) AS VARCHAR) as "bh_production", + "TREATED_Production" as "treated_consumption", + 'Subra' as "tank" + FROM {{ source('staging_wash', 'Subra') }} + WHERE CAST("B2_Abstraction" AS NUMERIC) + CAST("BH1_Abstraction" AS NUMERIC) >= 0 + AND "BH_1_METER" IS NOT NULL AND CAST("TREATED_Production" AS NUMERIC) >= 0 ) SELECT *