Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drip
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
backup
Drip
Commits
672235a4
Commit
672235a4
authored
6 years ago
by
Julia Friesel
Browse files
Options
Downloads
Patches
Plain Diff
Detect all 3 phases
parent
f7e1152f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/sympto/index.js
+5
-3
5 additions, 3 deletions
lib/sympto/index.js
test/sympto/index.spec.js
+33
-6
33 additions, 6 deletions
test/sympto/index.spec.js
with
38 additions
and
9 deletions
lib/sympto/index.js
+
5
−
3
View file @
672235a4
...
...
@@ -18,7 +18,7 @@ export default function ({ cycle, previousCycle }) {
}
// if there was no first higher measurement in the previous cycle,
// no infertile preovulatory phase may be assumed
// no infertile pre
-
ovulatory phase may be assumed
if
(
getTemperatureShift
(
previousCycle
).
detected
&&
!
cycle
[
0
].
mucus
)
{
status
.
phases
.
preOvulatory
=
getPreOvulatoryPhase
(
cycle
)
}
...
...
@@ -45,7 +45,7 @@ export default function ({ cycle, previousCycle }) {
temperatureShift
.
evaluationCompleteDay
.
date
>
mucusShift
.
evaluationCompleteDay
.
date
?
temperatureShift
.
evaluationCompleteDay
:
mucusShift
.
evaluationCompleteDay
const
prevPeriOvulatoryDays
=
status
.
phases
.
periOvulatory
.
cycleDays
const
prevPeriOvulatoryDays
=
periPhase
.
cycleDays
const
periOvulatoryEndIndex
=
prevPeriOvulatoryDays
.
indexOf
(
periOvulatoryEnd
)
status
.
phases
.
postOvulatory
=
{
...
...
@@ -56,10 +56,12 @@ export default function ({ cycle, previousCycle }) {
cycleDays
:
prevPeriOvulatoryDays
.
slice
(
periOvulatoryEndIndex
)
}
status
.
phases
.
periOvulatory
.
cycleDays
=
prevPeriOvulatoryDays
.
slice
(
0
,
periOvulatoryEndIndex
+
1
)
periPhase
.
cycleDays
=
prevPeriOvulatoryDays
.
slice
(
0
,
periOvulatoryEndIndex
+
1
)
periPhase
.
end
=
status
.
phases
.
postOvulatory
.
start
status
.
mucusShift
=
mucusShift
status
.
temperatureShift
=
temperatureShift
status
.
assumeFertility
=
false
return
status
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/sympto/index.spec.js
+
33
−
6
View file @
672235a4
...
...
@@ -79,7 +79,7 @@ const cycleWithTempAndNoMucusShift = [
describe
(
'
sympto
'
,
()
=>
{
describe
(
'
evaluating mucus and temperature shift together
'
,
()
=>
{
describe
(
'
with no previous higher measurement
'
,
()
=>
{
it
(
'
with no shifts detects only periovulatory
'
,
function
()
{
it
(
'
with no shifts detects only peri
-
ovulatory
'
,
function
()
{
const
values
=
[
{
temperature
:
36.6
,
bleeding
:
2
},
{
temperature
:
36.65
},
...
...
@@ -108,7 +108,7 @@ describe('sympto', () => {
})
})
it
(
'
with shifts detects only periovulatory and postovulatory
'
,
function
()
{
it
(
'
with shifts detects only peri
-
ovulatory and post
-
ovulatory
'
,
function
()
{
const
status
=
getSensiplanStatus
({
cycle
:
cycleWithTempAndMucusShift
,
previousCycle
:
cycleWithoutTempShift
...
...
@@ -116,10 +116,11 @@ describe('sympto', () => {
expect
(
status
.
temperatureShift
).
to
.
be
.
an
(
'
object
'
)
expect
(
status
.
mucusShift
).
to
.
be
.
an
(
'
object
'
)
expect
(
status
.
assumeFertility
).
to
.
be
.
tru
e
()
expect
(
Object
.
keys
(
status
.
phases
)).
to
.
eql
(
[
'
periOvulatory
'
,
'
postOvulatory
'
]
)
expect
(
status
.
assumeFertility
).
to
.
be
.
fals
e
()
expect
(
Object
.
keys
(
status
.
phases
)
.
length
).
to
.
eql
(
2
)
expect
(
status
.
phases
.
periOvulatory
).
to
.
eql
({
start
:
{
date
:
'
2018-06-01
'
},
end
:
{
date
:
'
2018-06-21
'
,
time
:
'
18:00
'
},
cycleDays
:
cycleWithTempAndMucusShift
.
slice
(
0
,
21
)
})
expect
(
status
.
phases
.
postOvulatory
).
to
.
eql
({
...
...
@@ -133,14 +134,14 @@ describe('sympto', () => {
})
})
describe
(
'
with previous higher measurement
'
,
()
=>
{
describe
(
'
with no shifts detects pre- and periovulatory phase
'
,
function
()
{
describe
(
'
with no shifts detects pre- and peri
-
ovulatory phase
'
,
function
()
{
it
(
'
according to 5-day-rule
'
,
function
()
{
const
status
=
getSensiplanStatus
({
cycle
:
cycleWithTempAndNoMucusShift
,
previousCycle
:
cycleWithTempShift
})
expect
(
Object
.
keys
(
status
.
phases
)).
to
.
eql
(
[
'
periOvulatory
'
,
'
preOvulatory
'
]
)
expect
(
Object
.
keys
(
status
.
phases
)
.
length
).
to
.
eql
(
2
)
expect
(
status
.
assumeFertility
).
to
.
be
.
true
()
expect
(
status
.
phases
.
preOvulatory
).
to
.
eql
({
cycleDays
:
cycleWithTempAndNoMucusShift
.
slice
(
0
,
5
),
...
...
@@ -154,5 +155,31 @@ describe('sympto', () => {
})
})
describe
(
'
with shifts detects pre- and peri-ovulatory phase
'
,
function
()
{
it
(
'
according to 5-day-rule
'
,
function
()
{
const
status
=
getSensiplanStatus
({
cycle
:
cycleWithTempAndMucusShift
,
previousCycle
:
cycleWithTempShift
})
expect
(
Object
.
keys
(
status
.
phases
).
length
).
to
.
eql
(
3
)
expect
(
status
.
assumeFertility
).
to
.
be
.
false
()
expect
(
status
.
phases
.
preOvulatory
).
to
.
eql
({
cycleDays
:
cycleWithTempAndMucusShift
.
slice
(
0
,
5
),
start
:
{
date
:
'
2018-06-01
'
},
end
:
{
date
:
'
2018-06-05
'
}
})
expect
(
status
.
phases
.
periOvulatory
).
to
.
eql
({
cycleDays
:
cycleWithTempAndMucusShift
.
slice
(
5
,
21
),
start
:
{
date
:
'
2018-06-06
'
},
end
:
{
date
:
'
2018-06-21
'
,
time
:
'
18:00
'
}
})
expect
(
status
.
phases
.
postOvulatory
).
to
.
eql
({
cycleDays
:
cycleWithTempAndMucusShift
.
slice
(
20
),
start
:
{
date
:
'
2018-06-21
'
,
time
:
'
18:00
'
}
})
})
})
})
})
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment