Skip to content

Commit eddad84

Browse files
committed
refactor readme for unapply logic
1 parent a0a80e9 commit eddad84

File tree

1 file changed

+77
-28
lines changed

1 file changed

+77
-28
lines changed

sde_collections/models/README_UNAPPLY_LOGIC.md

Lines changed: 77 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,56 +14,105 @@
1414
- Delta URL exists with pattern effect
1515
- Pattern is removed
1616
```
17-
Curated: None
18-
Delta: division=BIOLOGY (from pattern)
19-
[Pattern removed]
20-
Result: Delta remains with division=None
17+
Curated: None exists
18+
Delta: url=new.com, division=None
19+
```
20+
`[Pattern: division=BIOLOGY], created`
21+
```
22+
Curated: None exists
23+
Delta: url=new.com, division=BIOLOGY
24+
```
25+
`[Pattern: division=BIOLOGY], deleted`
26+
```
27+
Curated: None exists
28+
Delta: url=new.com, division=None
2129
```
2230

23-
### Case 2: Delta and Curated Exist
31+
### Case 2: Delta Created to Apply Pattern
2432
**Scenario:**
25-
- Both curated and delta URLs exist
33+
- A Curated with no division already exists
34+
- A pattern is created
35+
- A delta is created to to apply a pattern
2636
- Pattern is removed
37+
- Delta should be deleted
38+
```
39+
Curated: division=None
2740
```
28-
Curated: division=GENERAL
41+
`[Pattern: division=BIOLOGY], created`
42+
```
43+
Curated: division=None
2944
Delta: division=BIOLOGY (from pattern)
30-
[Pattern removed]
31-
Result: Delta reverts to curated value (division=GENERAL)
32-
If delta now matches curated exactly, delta is deleted
45+
```
46+
`[Pattern: division=BIOLOGY], deleted`
47+
```
48+
Curated: division=None
3349
```
3450

35-
### Case 3: Curated Only
36-
**Scenario:**
37-
- Only curated URL exists
51+
### Case 3: Pre-existing Delta
52+
- A Curated with no division already exists
53+
- A Delta with an updated scraped_title exists
54+
- A pattern is created to set division
55+
- A delta is created to apply a pattern
3856
- Pattern is removed
57+
- Delta should be maintained because of scraped_title
58+
59+
```
60+
Curated: division=None
61+
Delta: scraped_title="Modified", division=None
62+
```
63+
`[Pattern: division=BIOLOGY], created`
64+
```
65+
Curated: division=None
66+
Delta: scraped_title="Modified", division=BIOLOGY (from pattern)
67+
```
68+
`[Pattern: division=BIOLOGY], deleted`
3969
```
40-
Curated: division=GENERAL
41-
Delta: None
42-
[Pattern removed]
43-
Result: New delta created with division=None
70+
Curated: division=None
71+
Delta: scraped_title="Modified", division=None
4472
```
4573

4674
### Case 4: Multiple Pattern Effects
4775
**Scenario:**
4876
- Delta has changes from multiple patterns
4977
- One pattern is removed
5078
```
51-
Curated: division=GENERAL, doc_type=DOCUMENTATION
5279
Delta: division=BIOLOGY, doc_type=DATA (from two patterns)
53-
[Division pattern removed]
54-
Result: Delta remains with division=GENERAL, doc_type=DATA preserved
80+
Pattern: division=BIOLOGY
81+
Pattern: doc_type=DATA
82+
```
83+
`[Pattern: division=BIOLOGY], deleted`
84+
```
85+
Delta: division=None, doc_type=DATA
86+
Pattern: doc_type=DATA
5587
```
5688

57-
### Case 5: Pattern Removal with Manual Changes
58-
**Scenario:**
59-
- Delta has both pattern effect and manual changes
60-
- Pattern is removed
89+
### Case 5: Overlapping Patterns, Specific Deleted
6190
```
62-
Curated: division=GENERAL, title="Original"
63-
Delta: division=BIOLOGY, title="Modified" (pattern + manual)
64-
[Pattern removed]
65-
Result: Delta remains with division=GENERAL, title="Modified" preserved
91+
Curated: division=ASTROPHYSICS (because of specific pattern)
92+
Specific Pattern: division=ASTROPHYSICS
93+
General Pattern: division=BIOLOGY
6694
```
95+
`[Specific Pattern: division=ASTROPHYSICS], deleted`
96+
97+
```
98+
Curated: division=BIOLOGY (because of general pattern)
99+
General Pattern: division=BIOLOGY
100+
```
101+
102+
103+
### Case 6: Overlapping Patterns, General Deleted
104+
```
105+
Curated: division=ASTROPHYSICS (because of specific pattern)
106+
Specific Pattern: division=ASTROPHYSICS
107+
General Pattern: division=BIOLOGY
108+
```
109+
`[General Pattern: division=BIOLOGY], deleted`
110+
111+
```
112+
Curated: division=ASTROPHYSICS (because of specific pattern)
113+
Specific Pattern: division=ASTROPHYSICS
114+
```
115+
67116

68117
## Implementation Steps
69118

0 commit comments

Comments
 (0)