packages feed

hasklepias 0.16.0 → 0.16.1

raw patch · 7 files changed

+25/−10 lines, 7 files

Files

ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for hasklepias +## 0.16.1++* Updates `FromJSON` instance for `Domain`, so that a JSON event with `"domain" = "Enrollment"` is deserialized into `Event` whose `Domain` is `Enrollment`.+ ## 0.16.0  * Adds a basic framework for `Feature` definition templates. Initially, this includes two templates for enrollment related features:
examples/ExampleCohort1.hs view
@@ -330,9 +330,9 @@ testData1 = sort     [ m 2010 1 1 1   ["is_female"] (Demographics (DemographicsFacts (DemographicsInfo Gender  (Just "Female")) ))     , m 2010 1 1 1   ["is_birth_year"] (Demographics (DemographicsFacts (DemographicsInfo BirthYear (Just "1960")) ))-    , m 2016 1 1 699 ["enrollment"] (Enrollment EnrollmentFacts)-    , m 2018 1 1 30  ["enrollment"] (Enrollment EnrollmentFacts)-    , m 2018 2 1 30  ["enrollment"] (Enrollment EnrollmentFacts)+    , m 2016 1 1 699 ["enrollment"] (Enrollment (EnrollmentFacts ()))+    , m 2018 1 1 30  ["enrollment"] (Enrollment (EnrollmentFacts ()))+    , m 2018 2 1 30  ["enrollment"] (Enrollment (EnrollmentFacts ()))     , m 2017 6 5 1   ["is_diabetes_inpatient"] (UnimplementedDomain ())     , m 2017 8 1 91  ["is_ppi"] (UnimplementedDomain ())     ]@@ -344,9 +344,9 @@ testData2 = sort     [ m 2010 1 1 1   ["is_female"] (Demographics (DemographicsFacts (DemographicsInfo Gender  (Just "Female")) ))     , m 2010 1 1 1   ["is_birth_year"] (Demographics (DemographicsFacts (DemographicsInfo BirthYear (Just "1980")) ))-    , m 2016 1 1 730 ["enrollment"] (Enrollment EnrollmentFacts)-    , m 2018 1 1 30  ["enrollment"] (Enrollment EnrollmentFacts)-    , m 2018 2 1 30  ["enrollment"] (Enrollment EnrollmentFacts)+    , m 2016 1 1 730 ["enrollment"] (Enrollment (EnrollmentFacts ()))+    , m 2018 1 1 30  ["enrollment"] (Enrollment (EnrollmentFacts ()))+    , m 2018 2 1 30  ["enrollment"] (Enrollment (EnrollmentFacts ()))     ]  testSubject2 :: Subject (Events Day)
hasklepias.cabal view
@@ -1,6 +1,6 @@ cabal-version:  2.2 name:           hasklepias-version:        0.16.0+version:        0.16.1 description:    Please see the README on GitHub at <https://github.com/novisci/asclepias#readme> homepage:       https://github.com/novisci/asclepias/#readme bug-reports:    https://github.com/novisci/asclepias/issues
src/EventData/Aeson.hs view
@@ -63,6 +63,7 @@         domain :: Text <- o .: "domain"         case domain of             "Demographics" -> Demographics <$> o .: "facts"+            "Enrollment"   -> pure $ Enrollment (EnrollmentFacts () )               _              -> pure (UnimplementedDomain ())  instance FromJSON Concept where
src/EventData/Context/Domain/Enrollment.hs view
@@ -26,10 +26,11 @@ import GHC.Generics             ( Generic ) import GHC.Show                 ( Show ) +-- data Plan = Plan   -- | An enrollment fact-data EnrollmentFacts = EnrollmentFacts { -  -- TODO add plan fact+newtype EnrollmentFacts = EnrollmentFacts {+     _plan :: () -- TODO add plan fact   }    deriving( Eq, Show, Generic ) 
src/Hasklepias/Templates/Features/Enrollment.hs view
@@ -96,7 +96,7 @@  makeEnrollmentEvent :: (IntervalSizeable a b) => b -> a -> Event a makeEnrollmentEvent dur bgn = -  event (beginerval dur bgn) (context ( Enrollment EnrollmentFacts) mempty)+  event (beginerval dur bgn) (context ( Enrollment (EnrollmentFacts ())) mempty)  defIsEnrolledTestCases :: [TemplateTestCase    (F "index" (Index Interval Int), F "events" [Event Int]) Status]
test/EventData/AesonSpec.hs view
@@ -73,9 +73,16 @@ dmo :: Domain dmo = Demographics $ DemographicsFacts (DemographicsInfo BirthYear (Just "1987")) +enl :: Domain +enl = Enrollment (EnrollmentFacts ())+ jsonDemoTest :: B.ByteString jsonDemoTest = "{\"domain\":\"Demographics\",\"facts\":{\"demo\":{\"field\":\"BirthYear\",\"info\":\"1987\"}}}" +jsonEnrollTest :: B.ByteString+jsonEnrollTest = "{\"domain\":\"Enrollment\",\"facts\":{\"plan\":{\"exchange\":\"Medicare\"}}}"++ jsonOtherTest :: B.ByteString jsonOtherTest = "{\"domain\":\"Labs\",\"facts\":{\"code\":{\"code\":\"XYZ\"}}}" @@ -94,5 +101,7 @@        parseEventDayLines testInputsDay `shouldBe` ([], [testOutDay1, testOutDay2])     it "jsonDemoTest is parsed correctly" $        decode jsonDemoTest  `shouldBe` Just dmo+    it "jsonEnrollTest is parsed correctly" $+       decode jsonEnrollTest  `shouldBe` Just enl     it "jsonOtherTest is parsed correctly" $        decode jsonOtherTest  `shouldBe` Just (UnimplementedDomain ())