Pogues icon indicating copy to clipboard operation
Pogues copied to clipboard

Object ID as GUID

Open romaintailhurat opened this issue 2 years ago • 3 comments

Currently, objects ID are unique hashes based on a timestamp. Though it is enough for the identification of questionnaires inside Pogues, it is not compliant with the DDI standard, whereas GUID are.

This could be an easy implementation (seen here):

function uuidv4() {
  return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
    (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
  );
}

To do:

  • [x] implemented the JS part and check that it doesn't break anything
  • [x] test that the GUIDs are Colectica compliant
  • [ ] list every non GUID identifiers (ex: Sequence-<identifier)>)
  • [ ] change that to true GUID

romaintailhurat avatar Apr 29 '22 10:04 romaintailhurat

🐛 When first creating a questionnaire, the redirect is to a wrong URL (something like http://qfrmspogfolht01.ad.insee.intra/questionnaire/undefined)

But the questionnaire is in fact created and reachable after this first bug (with a round trip to the home page and back).

romaintailhurat avatar Jun 16 '22 12:06 romaintailhurat

Another problem: we want to generate GUID in part for globally identifying the object and to reuse them - at Insee via our own metadata repository.

Problem is - may be ? - we add prefix to the ID of some element. For example, a Sequence using the GUID algo will be IDed as:

<r:ID>Sequence-14563d61-4417-42d7-a177-3e6b08d28c64</r:ID>

Another and more complex example is the parameters handling:

<d:QuestionItem>
    <r:Agency>fr.insee</r:Agency>
    <r:ID>9006bff0-2637-4863-adfd-cfa27f79143c</r:ID>
    <r:Version>1</r:Version>
    <d:QuestionItemName>
        <r:String xml:lang="fr-FR">SUPAHDUPAH</r:String>
    </d:QuestionItemName>
    <r:OutParameter isArray="false">
        <r:Agency>fr.insee</r:Agency>
        <r:ID>9006bff0-2637-4863-adfd-cfa27f79143c-QOP-69cac9eb-f661-4364-91b5-f1efc9da0235</r:ID>
        <r:Version>1</r:Version>
        <r:ParameterName>
            <r:String xml:lang="fr-FR">SUPAHDUPAH</r:String>
        </r:ParameterName>
    </r:OutParameter>
    <r:Binding>
        <r:SourceParameterReference>
            <r:Agency>fr.insee</r:Agency>
            <r:ID>9006bff0-2637-4863-adfd-cfa27f79143c-RDOP-69cac9eb-f661-4364-91b5-f1efc9da0235</r:ID>
            <r:Version>1</r:Version>
            <r:TypeOfObject>OutParameter</r:TypeOfObject>
        </r:SourceParameterReference>
        <r:TargetParameterReference>
            <r:Agency>fr.insee</r:Agency>
            <r:ID>9006bff0-2637-4863-adfd-cfa27f79143c-QOP-69cac9eb-f661-4364-91b5-f1efc9da0235</r:ID>
            <r:Version>1</r:Version>
            <r:TypeOfObject>OutParameter</r:TypeOfObject>
        </r:TargetParameterReference>
    </r:Binding>
</d:QuestionItem

romaintailhurat avatar Jun 20 '22 14:06 romaintailhurat

Do we need that when using Eno twice, we have : Pogues2ddi( ddi2Pogues(ddiFile) ) = ddiFile ? If so, we will have a problem, because : 9006bff0-2637-4863-adfd-cfa27f79143c-RDOP-69cac9eb-f661-4364-91b5-f1efc9da0235 and 9006bff0-2637-4863-adfd-cfa27f79143c-QOP-69cac9eb-f661-4364-91b5-f1efc9da0235 Are generated from the same pogues's element. In ddi2pogues, the id with -RDOP- is just not used (DDI is richer than Pogues)

On the same way, do we want ddi2lunatic(ddiFile) to be everywhen the same ? In Lunatic, statements have ids (so all different). In DDI, they are mutualized (the same id may be used for several statements)

A solution would be to create a composite uuid. I don't know how. Even if there is no automatic way, we could add 1 to the uuid to create the -RDOP- one. We could add uuids (at least a part of them) in the second case. (perhaps available only with Eno V3)

BulotF avatar Sep 02 '22 15:09 BulotF