-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #356 from nfdi4plants/datamap
Rework data nodes
- Loading branch information
Showing
69 changed files
with
1,951 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
namespace ARCtrl.Contract | ||
|
||
open ARCtrl.FileSystem | ||
open ARCtrl.Path | ||
open ARCtrl.Spreadsheet | ||
open ARCtrl | ||
open ARCtrl.Helper | ||
open FsSpreadsheet | ||
|
||
[<AutoOpen>] | ||
module DatamapContractExtensions = | ||
|
||
let (|DatamapPath|_|) (input) = | ||
match input with | ||
| [|AssaysFolderName; anyAssayName; DataMapFileName|] -> | ||
let path = ARCtrl.Path.combineMany input | ||
Some path | ||
| [|StudiesFolderName; anyStudyName; DataMapFileName|] -> | ||
let path = ARCtrl.Path.combineMany input | ||
Some path | ||
| _ -> None | ||
|
||
type DataMap with | ||
|
||
member this.ToCreateContractForAssay (assayIdentifier : string) = | ||
let path = Identifier.Assay.datamapFileNameFromIdentifier assayIdentifier | ||
Contract.createCreate(path, DTOType.ISA_Datamap, DTO.Spreadsheet (this |> DataMap.toFsWorkbook)) | ||
|
||
member this.ToUpdateContractForAssay (assayIdentifier : string) = | ||
let path = Identifier.Assay.datamapFileNameFromIdentifier assayIdentifier | ||
let c = Contract.createUpdate(path, DTOType.ISA_Datamap, DTO.Spreadsheet (this |> DataMap.toFsWorkbook)) | ||
c | ||
|
||
member this.ToDeleteContractForAssay (assayIdentifier : string) = | ||
let path = Identifier.Assay.datamapFileNameFromIdentifier assayIdentifier | ||
let c = Contract.createDelete(path) | ||
c | ||
|
||
static member toDeleteContractForAssay (assayIdentifier : string) = | ||
fun (dataMap : DataMap) -> | ||
dataMap.ToDeleteContractForAssay(assayIdentifier) | ||
|
||
static member toUpdateContractForAssay (assayIdentifier : string) = | ||
fun (dataMap : DataMap) -> | ||
dataMap.ToUpdateContractForAssay(assayIdentifier) | ||
|
||
static member tryFromReadContractForAssay (assayIdentifier : string) (c:Contract) = | ||
let path = Identifier.Assay.datamapFileNameFromIdentifier assayIdentifier | ||
match c with | ||
| {Path = p; Operation = READ; DTOType = Some DTOType.ISA_Datamap; DTO = Some (DTO.Spreadsheet fsworkbook)} when p = path -> | ||
let dm = | ||
fsworkbook :?> FsWorkbook | ||
|> DataMap.fromFsWorkbook | ||
dm.StaticHash <- dm.GetHashCode() | ||
dm | ||
|> Some | ||
| _ -> None | ||
|
||
|
||
member this.ToCreateContractForStudy (studyIdentifier : string) = | ||
let path = Identifier.Study.datamapFileNameFromIdentifier studyIdentifier | ||
Contract.createCreate(path, DTOType.ISA_Datamap, DTO.Spreadsheet (this |> DataMap.toFsWorkbook)) | ||
|
||
member this.ToUpdateContractForStudy (studyIdentifier : string) = | ||
let path = Identifier.Study.datamapFileNameFromIdentifier studyIdentifier | ||
let c = Contract.createUpdate(path, DTOType.ISA_Datamap, DTO.Spreadsheet (this |> DataMap.toFsWorkbook)) | ||
c | ||
|
||
member this.ToDeleteContractForStudy (studyIdentifier : string) = | ||
let path = Identifier.Study.datamapFileNameFromIdentifier studyIdentifier | ||
let c = Contract.createDelete(path) | ||
c | ||
|
||
static member toDeleteContractForStudy (studyIdentifier : string) = | ||
fun (dataMap : DataMap) -> | ||
dataMap.ToDeleteContractForStudy(studyIdentifier) | ||
|
||
static member toUpdateContractForStudy (studyIdentifier : string) = | ||
fun (dataMap : DataMap) -> | ||
dataMap.ToUpdateContractForStudy(studyIdentifier) | ||
|
||
|
||
static member tryFromReadContractForStudy (studyIdentifier : string) (c:Contract) = | ||
let path = Identifier.Study.datamapFileNameFromIdentifier studyIdentifier | ||
match c with | ||
| {Path = p; Operation = READ; DTOType = Some DTOType.ISA_Datamap; DTO = Some (DTO.Spreadsheet fsworkbook)} when p = path-> | ||
let dm = | ||
fsworkbook :?> FsWorkbook | ||
|> DataMap.fromFsWorkbook | ||
dm.StaticHash <- dm.GetHashCode() | ||
Some (dm) | ||
| _ -> None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.